Currently, we are using a standard AVPlayer
via AVPlayerViewController
to play video. We are streaming video from a url in the format https://ourdomain/media/mediaid?jwt=authTokenHere. The url, as you can see, has no extension; however the headers are being set on the payload to indicate that the response is a video.
Though the links results in the video playing fine in desktop Safari and Chrome, it will not play via iOS's AVPlayer
in our application. Is there some particular format that AVPlayer
expects?
Alright - ended up discovering the answer to this is multifaceted. Here's what I needed to do to get things working.
By updating our backend to provide this response AND append the correct extension to the video files, we are now streaming to AVPlayer
as expected. Thank you to everyone who offered tips!
AVURLAsset
is require a file extension to work. unfortunately there are already some radars open for the same issue from iOS 5 but it seems even it is not updated on iOS 10.
Radar links:
AVURLAsset should not require a file extension to work
AVURLAsset should not require a file extension to work
WorkAround / Hack:
Cycle through the playable MIME types and create a symbolic links to the actual file with the extension and check if they are playable.
Note:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With