Page 1 of 1

[tvOS ]Network Stream Authorization HTTP Header

Posted: 08 Aug 2016 11:19
by sarimsidd
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

Re: [tvOS ]Network Stream Authorization HTTP Header

Posted: 09 Aug 2016 11:34
by fkuehne
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.

Re: [tvOS ]Network Stream Authorization HTTP Header

Posted: 09 Aug 2016 21:34
by sarimsidd
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

Re: [tvOS ]Network Stream Authorization HTTP Header

Posted: 10 Aug 2016 19:41
by fkuehne
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.