Streaming video or sound without a file extension in the url in iOS

I am trying to transfer video or sound from the Internet using AVPlayer, but the files stored on the server are just hashes and they are saved without a file extension, so if I try to open a stream, for example http://example.com/fileHash it does not will play, and AVPlayer crosses the play button, but when a URL with a file extension like http://example.com/fileName.mp4 works well.

I am on iOS and use the latest Swift syntax, the stream I want to play using AVPlayerViewController, so I just pass the url to the view from prepareForSegue

override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { if segue.identifier == "showVideoPlayerVC" { print(sender as! NSURL) //print http://example.com/fileHash let destVc = segue.destinationViewController as! AVPlayerViewController destVc.player = AVPlayer(URL: sender as! NSURL) } } 
+5
source share

All Articles