I am using the streaming url from CloudFront.
Sample URL: https://d14nt81hc5bide.cloudfront.net/qyYj1PcUkYg2ALDfzAdhZAmb
On Android , it is working fine but in iOS it says: domain = AVFoundationErrorDomain , code = -11828
From apple doc the error code 11828 is AVErrorFileFormatNotRecognized. The media could not be opened because it is not in a recognized format.
Can someone suggest how to fix this error?
AVFoundation can be picky if an URL or the header of the response does not contain information about container format of the media (mp4
,mov
,...), which is the case here (no 'file extension' in the URL, and no content type in the response header).
Other media libraries and players seem to willing to just start loading and then guess the format by inspecting the incoming data, which is probably why they work in this case.
Unfortunately, to my knowledge at least, there is no (reliable) way to tell AVFoundation programmatically the format to expect and go ahead with that.
As you mention, This Error rise because AVFoundation can not recognize your media format.
Try to declare your mime type when upload media files to server
More about mime type here
more info: AWS streaming media content tutorial
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