Forum Xamarin.iOS
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

MPMoviePlayerController or AVPlayerViewController with self signed certificate

I can not get my self signed certificate to work using https with MPMoviePlayerController or AVPlayerViewController.

I've tried using AVPlayerViewController with an AVUrlAsset and a custom resource loader delegate but in ShouldWaitForResponseToAuthenticationChallenge the NSUrlAuthenticationChallenge sender is throwing a cast exception of:

Unable to cast object of type 'AVFoundation.AVAssetResourceLoader' to type 'Foundation.NSUrlConnection'

I'm not sure where to go from here. My use case is a private internal network where there is no domain or host known ahead of time, but the server and client I control.

I am using ServicePointManager.ServerCertificateValidationCallback to validate the thumbprint of my known self signed certificate for other requests which works well but I can't for the life of me get a video to play.

Anyone have any advice?

Answers

  • ConnorFlaat.1662ConnorFlaat.1662 USMember ✭✭

    I'm starting to think the Unable to cast object of type 'AVFoundation.AVAssetResourceLoader' to type 'Foundation.NSUrlConnection' from the NSUrlAuthenticationChallenge Sender is a bug in Xamarin.

  • cejay2001cejay2001 Member

    Did you ever find a solution to this.. your post is from 2016 and this bug is still there?? How else have developers been able to achieve range downloads (ie streaming) without using this delegate handler?

    There's a similar mechanism using MKWebView where you can assign the correct credentials when receiving an authorisation challenge from the web server. Yet this type cast exception still occurs in Xamarin when trying to access the Sender property. Anyone??

Sign In or Register to comment.