set file offset for streaming ?

Need help? Post your questions here.

Moderator: moderators

set file offset for streaming ?

Postby HansW » Mon Oct 18, 2010 4:38 pm

Hi,
i've developed a WebOS 1.4 ( Palm Pre ) client for subsonic. I'am using a html5 audio object to play songs. This is generaly working, but i've got problems with setting the current playback position.
I'am not sure if its a WebOS related problem or just not possible with html5. If i set the current playback position beyond the point to where the audio stream is already buffered/downloaded i get an error.

This is a real problem for big audio files, like audiobooks. I want to be able to bookmark the current position on app exit and resume play afterwards.

Would it be possible to add an offset parameter to the REST api, to make the server stream the file from that offset ? How are offsets handled in general ?

Thanks in advance
HansW
 
Posts: 2
Joined: Mon Oct 18, 2010 4:26 pm

Postby Tippi » Mon Oct 18, 2010 5:39 pm

Hi!

Great, I also planned to develop a WebOS client. But for training I just started with a Java client.
So sorry, can't really help you, but it's good to see that others are interested too.

In my java client, I tried also to implement a slider to choose the playback position. But results were disappointing, so i removed it. I'm sure, you cannot start playback at a position which is not yet streamed. An additional parameter for the stream-method in the API would be great (also for me).

If you find another solution, please post it here. Could be really helpful.

Greetz, Tippi
Tippi
 
Posts: 12
Joined: Sun Oct 17, 2010 8:24 am
Location: CB, Germany

after looking at the source code..

Postby HansW » Tue Oct 26, 2010 7:13 am

i went through the source and found this..

Code: Select all
  // First, look for "Range" HTTP header.
213           LongRange range = StringUtil.parseRange(request.getHeader("Range"));
214           if (range != null) {
215               return range;
216           }
217   
218           // Second, look for "offsetSeconds" request parameter.
219           String offsetSeconds = request.getParameter("offsetSeconds");
220           range = parseAndConvertOffsetSeconds(offsetSeconds, file);
221           if (range != null) {
222               return range;
223           }
224   


it looks like there is a request parameter for that already in place. Why is that not documented in the API ?

I've not tested it yet, but from the code it looks like it should work. A big thank you to myself for helping me out.
HansW
 
Posts: 2
Joined: Mon Oct 18, 2010 4:26 pm


Return to Help

Who is online

Users browsing this forum: No registered users and 10 guests