Page 1 of 3

Started a mediabrowser on iOS - some troubles

PostPosted: Sat Dec 08, 2012 10:52 pm
by LeChatNoir
Hi there,

I'm an iOS coder and a friend told me about Serviio. I'd like to be able to browse his serviio through an iPhone.
So we talk a little about that and I think I'll give it a try.

I've already contact Will. He helps me with docs and the way to start.

So I've run succesfully a ping call, through the CDS REstfull API.
And now, I'm trying the login process. And it's a little bit harder.

I've successfully generated the signature. And I'm calling cds/login with POST method with 2 parameters : signature and X-Serviio-Date (with the same date I used to compute the signature).

Problem : I got an undocumented response :-(
httpCode : 415

I must be wrong somewhere but I'm stalled right now...

Re: Started a mediabrowser on iOS - some troubles

PostPosted: Sun Dec 09, 2012 12:13 am
by zip
415 is Unsupported media. I think it happens when you don't send Content-Type header (application/xml or application/json, depending on the payload)

Re: Started a mediabrowser on iOS - some troubles

PostPosted: Sun Dec 09, 2012 8:49 am
by LeChatNoir
Perfect, you were right :) Thxs.
My client framework send a "application/x-www-form-urlencoded" content type.
I'll serialized it to be able to send xml or json content type.

One more question : I understood that X-Serviio-Date must be added to HTTP header.
But what about the signature ?
I understood that I have to add it to the "Authorization" header.

So when I post my request, I haven't any param to pass through ? The 2 necessary params are in the HTTP header ? Am I right ?

Thxs

Re: Started a mediabrowser on iOS - some troubles

PostPosted: Sun Dec 09, 2012 9:31 am
by will
Yes thats correct. For my login POST, I set the following headers (set up on my connection by doing setHeader(HEADER_NAME, HEADER_VALUE)):

  Code:
Accept: application/json
Accept-Charset: UTF-8
X-Serviio-Date: GENERATED_DATE
Authorization: GENERATED_SIG


On other point, generate the date using something like US date formatting, some other locales will work, but others won't.

Also make sure you use developer tools built into your webbrowser (or as a plugin), or something like http://hurl.it/ it will make things much quicker for the initial testing.

Re: Started a mediabrowser on iOS - some troubles

PostPosted: Sun Dec 09, 2012 10:33 am
by Xmantium
Looking forward to the completion of this app! Please please make it compatible with iPad.

Have you got plans to include your own player or use external player like ServiiGo?

Re: Started a mediabrowser on iOS - some troubles

PostPosted: Sun Dec 09, 2012 11:23 am
by LeChatNoir
Cool thxs.
Of course, I'll keep you update about the app.
For the moment, I'm just making a proto for a friend.
But yes, I'll certainly release an app on the store and ok, I'll make a universal one (iPhone/iPad).
See you soon, for the next pb :)

Re: Started a mediabrowser on iOS - some troubles

PostPosted: Sun Dec 09, 2012 10:20 pm
by LeChatNoir
Ok, thks to you, login is now ok. I got my magic token :)

So, I'm exploring now the browse API.

A the moment, I only have 1 question : I didn't really understand the profile_id argument. What is that ? When I test request with 0, I've got an HTTP 500, with 1, it's ok. With 2, too :-)


Thxs

Re: Started a mediabrowser on iOS - some troubles

PostPosted: Sun Dec 09, 2012 10:35 pm
by will
It is the id of the profile (stored in profiles/application-profiles.xml on the server), which describe how to process files for a particular device / client application, ie transcode unsupported formats. 1 is a generic profile that does nothing, MediaBrowser uses 'flash_player', ServiiGo uses 'serviigo'. For now use 1, but you will need to write a dedicated profile (with our help) that maximises the files that can be played back under iOS in order to play back different types of video and audio files.

Re: Started a mediabrowser on iOS - some troubles

PostPosted: Mon Dec 10, 2012 9:31 am
by zip
Re profile - Serviio cannot transcode to H264 / apple http ATM, so native playback of transcoded files will not be possible. You can still play H264/mov files natively, and the rest probably using a dedicated iOS player that can play those (eg 8Player).

Re: Started a mediabrowser on iOS - some troubles

PostPosted: Tue Dec 11, 2012 3:20 pm
by LeChatNoir
Hi there.

Ok, in my proto, I can now browse through the differents folders thanks to the cds/browse API.
Now, I'm working on the audio player.

I've understood that I have to download the resource from the url I got previously with cds/resource API.
But when I'm downloading a mp3, it's a little bit long (I'm testing through 3G Internet). I've compared with ServiGo app and loading is much more faster.

So I'm wondering if there is a trick in ServiiGo ? Like asking resource for first 10 seconds of the resources for caching and asking for rest just after ?
No ?

Re: Started a mediabrowser on iOS - some troubles

PostPosted: Tue Dec 11, 2012 3:37 pm
by zip
You can do range requests, for supported files (usually not transcoded), as described in the API docs. Other than that, from my experience, you just give an mp3 player component the URL (or Input stream from the URL) and it should start playing it as it gets the data - no need to download the full file first.

Re: Started a mediabrowser on iOS - some troubles

PostPosted: Tue Dec 11, 2012 3:46 pm
by LeChatNoir
Oh yes, you must be right.

I'm just looking through a classic download and sure, through a player, with just the URL, the player will manage the stream automaticaly...

Good thing. Something I've not to build :mrgreen:

Thxs

Re: Started a mediabrowser on iOS - some troubles

PostPosted: Fri Dec 14, 2012 10:12 am
by LeChatNoir
Hi there,

Ok, my iOS client progress is good.

I've got many questions to Will and zip :
=> how can I name my app ? At the beginning, I thought calling it ServiGo but I realized that the Go was for Google :) So, what do you think ? Is it better to call it like its grand sister on Android ? Or is it better to call it ServiOS ?
=> Similar question around the app Icon... Is it better to use the same as the Android application ? Or you don't mind...

I think I will release a first version with only audoi player and photos browser. The movie part is maybe less used and it's a really big part to manage on iOS... And first contacts with player developer are not very hot :)

Bye

Re: Started a mediabrowser on iOS - some troubles

PostPosted: Fri Dec 14, 2012 3:08 pm
by Xmantium
Hi LeChatNoir, with ServiiGo - i think it meant "Serviio on the Go" hence ServiiGo as users can use MediaBrowser on their mobile on the go

I think ServiiOS (Serviio + iOS) will be a great name for a Console control only app like ServiiDroid (Serviio + Android) and ServiiWP (Serviio + Windows Phone)

Unless your your also putting in Serviio Console control and mediabrowser all in one app, ServiiOS is a great name!

If the app is just for MediaBroswer, possible suggestions ServiiBrowser, ServiiOS Browser, ServiiAIR Play, ServiiPlay, ServiiPlayer, ServiiMedia

Re: Started a mediabrowser on iOS - some troubles

PostPosted: Fri Dec 14, 2012 5:29 pm
by will
Definately use a different name and icon (to both ServiiGo and Serviio). Makes it easier for users and avoids confusing over branding/association of the addons and the different developers. My ServiiGo icon would also look very out of place on iOS.

Sounds like you are making excellent progress. Is there no way on iOS to send a message to the OS containing a link to a video and get it to find a suitable player.

Re: Started a mediabrowser on iOS - some troubles

PostPosted: Fri Dec 14, 2012 9:53 pm
by LeChatNoir
Ok, I'll choose another name so. I'll certainly choose one of Xmantium :-)

About that :
Is there no way on iOS to send a message to the OS containing a link to a video and get it to find a suitable player.

I don't think it's possible... Each application is sandboxed... And applications can communicate through url schemes... But my knowledge is not illimited :-) I'll investigate. Under Android, you manage the case like this ?

Re: Started a mediabrowser on iOS - some troubles

PostPosted: Fri Dec 14, 2012 10:55 pm
by zip
Is there not a built-in video player component? Obviously it'll be limited to mp4/h264/aac files for now.

Re: Started a mediabrowser on iOS - some troubles

PostPosted: Fri Dec 14, 2012 10:57 pm
by Xmantium
LeChatNoir it maybe possible, i do it all the with my daughters iPad... but its files stored locally... not sure it will work for streaming
I usually use FileBrowser to copy over video files to the iPad, then when i click on the file it says Open to, then lists the choices of Video players, i personally use CineXplayer as it plays all formats of files. Ive seen other apps that also has "Open up with..." the chosen app feature such as iDownloader

My daughters away till Xmas with my wifes family so cant show you screenshots.
Worst case scenario, there must be an open source video players for iOS that could be possibly built in to your app.
The hard part can be getting it approved by Apple. Its one of the reason i chose to stay away from Apple's locked down system.

About the name choosing, your welcome to use any of my suggestions.
I remember the rant Will, me and other forums users had for the Android console, finally i was glad Will eventually chosen ServiiDroid!!

Re: Started a mediabrowser on iOS - some troubles

PostPosted: Fri Dec 14, 2012 11:17 pm
by LeChatNoir
Ok, I'll look at that... and keep you update.

I guess that this part is the hard part for me because video is an unknown domain for me...
I know the iOS standard API is limited about formats. Apple sells movies so I guess they're not interested on people paying mkv ^^
But as I said, I'm not very comfortable with this domain...

But it's the advantage of serviio no ? Serviio can encode movies before streaming ? Am I right ? So iOS users could setup their serviio to say : movie must be streamed in H.264 format for iOS.
No ?

Re: Started a mediabrowser on iOS - some troubles

PostPosted: Fri Dec 14, 2012 11:52 pm
by zip
yes, but Serviio doesn't support transcoding to h264 yet