Swift: How should a header URL be tweaked inorder for AVPlayer to stream it?

I have a URL with headers which looks like

https://www.url.com/api/assets/download/{assetlocation}?type=asset&id={id}&otherid={otherid}.


The Completed URL looks this

https://www.url.com/api/assets/download/as13-12sa-123-sqr1?type=asset&id=11&otherid=22.

and after appending "MP4" extension the users looks like

https://www.url.com/api/assets/download/as13-12sa-123-sqr1.mp4?type=asset&id=11&otherid=22.


I am passing this URL to the viewcontroller called video view controller to play in the AVPlayer. But all I can see a blank screen. Then I tried to append mp4 extension. Even then it is the same case, it just displaying a blank screen. The same link is used in our Android App and it is streaming the video there and it is the working fine when I try to open it in the browser.


I tried adding a different url http://techslides.com/demos/sample-videos/small.mp4 and then the AVPlayer is streaming and playing the video perfectly. I tried adding similar URLs like above and they all worked perfectly. I am still not able to figure out why is our URL not streamable.


I have also tried to upload the video in our URL in dropbox and tried to stream with the dropbox link, it streamed perfectly without any issue.


I would be glad if someone can give suggestions on how to stream a URL with headers. If any changes had to be made to backend, what makes a ideal URL for iOS streaming. What should the URL contain inorder for it to be streamed by iOS.

Replies

did you get any info about this issue? we had the same problem playing video from url without extension at the end ...