Results 1 to 7 of 7

Thread: Phonon and buffer of local file

  1. #1
    Join Date
    Jul 2009
    Location
    Valladolid, Spain
    Posts
    125
    Thanks
    16
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Phonon and buffer of local file

    I'm trying to play a file with Phonon. Eveything works just fine if the file is "as-it-should-be", I mean, the file has the size that it should have (non-corrupt mp3 file for example.)
    The problem comes when I try to play a file that I'm asynchronously downloading.

    If I do

    Qt Code:
    1. self.mediaObject.setCurrentSource(Phonon.MediaSource("Path"))
    To copy to clipboard, switch view to plain text mode 

    file will play just for a sec or so (the bytes that were downloding while the app was creating the controls, etc...

    Is there any way that I can tell Phonon that this file isn't complete and that it should read/wait for buffer?

  2. #2
    Join Date
    Jul 2009
    Location
    Valladolid, Spain
    Posts
    125
    Thanks
    16
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Phonon and buffer of local file

    Nobody knows how to stream a local incomplete file?

  3. #3
    Join Date
    Dec 2008
    Location
    Poland
    Posts
    383
    Thanks
    52
    Thanked 42 Times in 42 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Phonon and buffer of local file

    I don't know If I understand correctly, but this is probably what You should try to use:
    Qt Code:
    1. self.mediaObject.setCurrentSource(Phonon.MediaSource(QUrl("Path")))
    To copy to clipboard, switch view to plain text mode 
    Look also for Phonon::MediaSource::Type and try other types.
    I personally use QUrl to play movies from HTTP, so I think it should handle.
    If you want to download and play partially file that is currently downloaded, then this probably won't help You, although I can be wrong on this one.
    In the near future - corporate networks reach out to the stars. Electrons and light flow throughout the universe.
    The advance of computerization however, has not yet wiped out nations and ethnic groups.

  4. #4
    Join Date
    Jul 2009
    Location
    Valladolid, Spain
    Posts
    125
    Thanks
    16
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Phonon and buffer of local file

    I'm already using the QUrl("Path") thingy. But what I'm trying to do is to play a file that I'm downloading at the same time, so that would be:

    1. Start downloading file via async
    2. Start playing local file
    3. Play while not EOF (pause when buffer needed)

  5. #5
    Join Date
    Dec 2008
    Location
    Poland
    Posts
    383
    Thanks
    52
    Thanked 42 Times in 42 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Phonon and buffer of local file

    AFAIK you could do something like this:

    1. download file and store data in buffer
    2. play buffer
    MediaObject m;
    QBuffer *someBuffer;
    m.setCurrentSource(someBuffer);
    3. save to file

    Sorry but I can't help You more then this simply because I didn't used it before.
    Last edited by Talei; 14th October 2010 at 23:03.
    In the near future - corporate networks reach out to the stars. Electrons and light flow throughout the universe.
    The advance of computerization however, has not yet wiped out nations and ethnic groups.

  6. #6
    Join Date
    Jul 2009
    Location
    Valladolid, Spain
    Posts
    125
    Thanks
    16
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Phonon and buffer of local file

    Thanks! Tomorrow morning I'll read docs about buffer and I'll try it out

  7. #7
    Join Date
    Nov 2012
    Posts
    2
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Phonon and buffer of local file

    Hi,

    I'm facing the same problem while playing audio. Did you find out the solution? If so then please share your knowledge.

    Thanks in advance.

Similar Threads

  1. QDesktopServices open url & local file & pdf or doc
    By patrik08 in forum Qt Programming
    Replies: 9
    Last Post: 14th April 2012, 04:42
  2. Opening local flash(.swf) file in QtWebKit?
    By DanLT3 in forum Qt Programming
    Replies: 1
    Last Post: 24th March 2011, 15:22
  3. Phonon access to waveform/buffer
    By er453r in forum Qt Programming
    Replies: 1
    Last Post: 10th July 2010, 12:28
  4. Replies: 4
    Last Post: 22nd June 2010, 10:59
  5. Password on local file/folder
    By icebox25 in forum Qt Programming
    Replies: 3
    Last Post: 13th April 2007, 16:33

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.