[tvOS ]Network Stream Authorization HTTP Header

iOS, iPad, iPhone, tvOS specific usage questions
sarimsidd
New Cone
New Cone
Posts: 4
Joined: 08 Aug 2016 10:53

[tvOS ]Network Stream Authorization HTTP Header

Postby sarimsidd » 08 Aug 2016 11:19

Hi,
I am new to iOS/tvOS, currently, I'm working on an Apple TV app that plays video streams from cloud services like Dropbox/Amazon Drive. Network Streams that does not require Authorization headers (like dropbox) works fine, however, I am having trouble with network streams that requires HTTP headers (like Amazon Drive). I don't see any way of adding HTTP headers, as the method 'mediaWithURL' only accepts a URL. This is what I am trying

Code: Select all

mPlayer = [[VLCMediaPlayer alloc] init]; mPlayer.delegate = self; mPlayer.libraryInstance.debugLogging = YES; mPlayer.drawable = self.view; [mPlayer setMedia:[VLCMedia mediaWithURL:[NSURL URLWithString::@"http://someserver.com/path/Sample.mkv"]]]];
Any help would be greatly appreciated.

Thanks

fkuehne
Developer
Developer
Posts: 7264
Joined: 16 Mar 2004 19:37
VLC version: 0.4.6 - present
Operating System: Darwin
Location: Germany
Contact:

Re: [tvOS ]Network Stream Authorization HTTP Header

Postby fkuehne » 09 Aug 2016 11:34

VLCKit does not allow you to set HTTP Headers at this point.

A work-around we use in VLC-iOS is to do a request using Foundation's networking API, wait for the redirect to the actual file URL and feed the redirect URL to VLC as this one typically does not require the Authorization header to be set.
VideoLAN
Felix Paul Kühne
Medic. VLC developer for appleOS since before you were born.
Blog: https://www.feepk.net

sarimsidd
New Cone
New Cone
Posts: 4
Joined: 08 Aug 2016 10:53

Re: [tvOS ]Network Stream Authorization HTTP Header

Postby sarimsidd » 09 Aug 2016 21:34

Thanks for replying.
A work-around we use in VLC-iOS is to do a request using Foundation's networking API, wait for the redirect to the actual file URL and feed the redirect URL to VLC as this one typically does not require the Authorization header to be set.
But the above approach does not work for most of the resources, It did work for Box but had no luck with other services. Not every resource with Authorization headers sends a redirect request and below is never called.

Code: Select all

-(void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task willPerformHTTPRedirection:(NSHTTPURLResponse *)response newRequest:(NSURLRequest *)request completionHandler:(void (^)(NSURLRequest * _Nullable))completionHandler{
Is there any other workaround I need to look at?

Thanks

fkuehne
Developer
Developer
Posts: 7264
Joined: 16 Mar 2004 19:37
VLC version: 0.4.6 - present
Operating System: Darwin
Location: Germany
Contact:

Re: [tvOS ]Network Stream Authorization HTTP Header

Postby fkuehne » 10 Aug 2016 19:41

No, this is the work-around I had in mind and that is the one we use for Box.

If this fails in your scenario, we need to add a proper VLCKit and libvlc API for that feature, which was discussed every now and then, but nobody ever actually did it. Patch welcome and happy to help guide you through the review process.
VideoLAN
Felix Paul Kühne
Medic. VLC developer for appleOS since before you were born.
Blog: https://www.feepk.net


Return to “VLC for iOS, iPadOS and Apple TV”

Who is online

Users browsing this forum: No registered users and 40 guests