PDA

View Full Version : Phonon and buffer of local file



alexandernst
13th October 2010, 18:54
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



self.mediaObject.setCurrentSource(Phonon.MediaSour ce("Path"))


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?

alexandernst
14th October 2010, 10:01
Nobody knows how to stream a local incomplete file?

Talei
14th October 2010, 22:38
I don't know If I understand correctly, but this is probably what You should try to use:

self.mediaObject.setCurrentSource(Phonon.MediaSour ce(QUrl("Path")))
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.

alexandernst
14th October 2010, 22:51
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)

Talei
14th October 2010, 22:56
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.

alexandernst
14th October 2010, 23:10
Thanks! Tomorrow morning I'll read docs about buffer and I'll try it out ;)

dheeraj.chitrapur
28th November 2012, 09:15
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.