Problem in streaming ogg file


#1

Hi All,

Hope you are doing well.

In my application I am downloading ogg file by using URL class and createInputStream() API of URL class. I am using a while loop in a thread to stream this downloading.
The problem I am facing is suppose I download 100K bytes at first time and then the other file in the while loop, then while playback I can play the first chunk of track very well but after the play finish the 100k of data then it started giving static output with original sound and even the play is bit in speed. I debugged into the OggReader but couldn’t any clue.

Please help me out!!!

Thanks in advance!

Santo.


#2

Sounds like it’s probably just a simple mistake, but impossible to tell from your description…


#3

Hi Jules,

I will explain it again.
I have download thread to download the ogg format track from server, using URL class.
In run() method of thread I am downloading first 100k bytes then using a while loop to download the rest of the data.
Now when I start playback(still downloading is going on) I can able to play the 1st portion of the track which i download before while loop very well. And after that the track plays bit in speed and with the static sound.

Please let me know if this is still not clear to you.

Thanks for your time!!!


#4

Do you buffer the downloaded contents till it reaches 100K, if you are please make a check whether you are writing the right contents to the files.


#5

I understood the first time - you’ve obviously just messed-up your file writing loop, but how do you expect us to be able to tell you what you’ve done wrong in code that we’ve never seen?


#6

Yes I am buffering the downloaded content, and I am able to play the same downloaded file outside my application with any other media player. So the contents are correct. Even If I load the same file next time in my application I can able to play.
The only problem is while streaming I am not able to play the downloading contents. I think this is again the same issue with the length of the file, because when we load a file using juce the file size will be fix it won’t change as the actual file is changed due to streaming.

Please let me know how can I change the static file size to dynamic one?


#7

Can you post the code where you are buffering the downloaded contents and also the code where you write the downloaded contents to the file. It would be helpful in understanding the problem.


#8

Ah, I see. Well, that’s really a limitation of juce’s ogg reader class - it doesn’t expect the file to change while it’s using it.

There might actually be a way to trick it into working, if you were to create a special file reader InputStream that avoided returning the size of the stream… No idea if that’d work!


#9

Hi Jules,

Thanks for your suggestion!!!
I will try it, and let you know the result!

Thanks,
Santo.