FAQ  •  Register  •  Login

[CDS API] - Playing back transcoded Audio

<<

will

DLNA master

Posts: 2138

Joined: Mon Aug 30, 2010 11:18 am

Location: UK

Post Tue Sep 04, 2012 6:29 pm

[CDS API] - Playing back transcoded Audio

First question, is the content length for transcoded audio always 900000000 (I need to detect whether I can give a progress update based on percentage)

Second question is more implementation, what is the best way to detect when I have finished downloading the complete audio file?

I have the following in a loop, but inputStream.read(buf) doesn't return on the final (or I suppose final+1) read. Looking online, I either need to know the content length, which won't happen, or the server needs to close the connection.
  Code:
while (true) {
   int numread = inputStream.read(buf);   
   if (numread <= 0) {
      success = true;
      break;
   }

   fileStream.write(buf, 0, numread);
   mTotalBytes += numread;
   ...
   update progress
   ...
}
Will

ServiiDroid (Android Console) Developer: Download | Home | Support
ServiiGo (Android 3G/4G/WiFi Playback App) Developer: Download | Home | Support
<<

zip

User avatar

Serviio developer / Site Admin

Posts: 17212

Joined: Sat Oct 24, 2009 12:24 pm

Location: London, UK

Post Wed Sep 05, 2012 9:15 pm

Re: [CDS API] - Playing back transcoded Audio

The 90000000 is a randon length, needed by Http 1.0 DLNA renderers, who don't support chunked encoding. I *think* the connection should close, can you try with wget or similar?
<<

will

DLNA master

Posts: 2138

Joined: Mon Aug 30, 2010 11:18 am

Location: UK

Post Wed Sep 05, 2012 9:21 pm

Re: [CDS API] - Playing back transcoded Audio

Ok, I don't mind what it is, I just need a consistent way to tell if the file is being transcoded right now, or if it is native/from an already transcoded file. Is there a better way to detect it?

I'll try wget in the morning to see if that sheds any light. (The code works fine for non transcoded audio)
Will

ServiiDroid (Android Console) Developer: Download | Home | Support
ServiiGo (Android 3G/4G/WiFi Playback App) Developer: Download | Home | Support
<<

zip

User avatar

Serviio developer / Site Admin

Posts: 17212

Joined: Sat Oct 24, 2009 12:24 pm

Location: London, UK

Post Wed Sep 05, 2012 9:24 pm

Re: [CDS API] - Playing back transcoded Audio

For DLNA Serviio sends CI value of 1 in the protocol info for file that is being transcoded and 0 for file that is played natively or already is fully transcoded. I guess I could add another attribute to the API to mimick this.

We can talk about it later. For now you can check for the 900000... value, as a hack.
<<

will

DLNA master

Posts: 2138

Joined: Mon Aug 30, 2010 11:18 am

Location: UK

Post Thu Sep 06, 2012 8:35 pm

Re: [CDS API] - Playing back transcoded Audio

Doesn't look like it closes the connection, wget downloads the file then hangs.
  Code:
wget http://192.168.15.100:23424/cds/resource/17962/MEDIA_ITEM/MP3-0/ORIGINAL,serviigo?authToken=3b35f135f2c3425c88e363f2780445d7
--2012-09-06 21:26:07--  http://192.168.15.100:23424/cds/resource/17962/MEDIA_ITEM/MP3-0/ORIGINAL,serviigo?authToken=3b35f135f2c3425c88e363f2780445d7
Connecting to 192.168.15.100:23424... connected.
HTTP request sent, awaiting response... 200 OK
Length: 900000000 (858M) [audio/mpeg]
Saving to: `ORIGINAL,serviigo?authToken=3b35f135f2c3425c88e363f2780445d7.2'

 0% [>                                                                                                                  ] 5,383,131   --.-K/s  eta 2h 28m
Will

ServiiDroid (Android Console) Developer: Download | Home | Support
ServiiGo (Android 3G/4G/WiFi Playback App) Developer: Download | Home | Support
<<

zip

User avatar

Serviio developer / Site Admin

Posts: 17212

Joined: Sat Oct 24, 2009 12:24 pm

Location: London, UK

Post Thu Sep 06, 2012 11:34 pm

Re: [CDS API] - Playing back transcoded Audio

I have now fixed this, hopefully not breaking anything else ;-) Do you need a build? I'm away for the weekend but could send you one next week.
<<

will

DLNA master

Posts: 2138

Joined: Mon Aug 30, 2010 11:18 am

Location: UK

Post Fri Sep 07, 2012 6:50 am

Re: [CDS API] - Playing back transcoded Audio

A build next week would be good, thanks.
Will

ServiiDroid (Android Console) Developer: Download | Home | Support
ServiiGo (Android 3G/4G/WiFi Playback App) Developer: Download | Home | Support

Return to Third-party tools integration

Who is online

Users browsing this forum: No registered users and 20 guests

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.