13

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?

AmerllicA
  • 29,059
  • 15
  • 130
  • 154
user3804063
  • 809
  • 1
  • 14
  • 32

3 Answers3

1

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.

NoHalfBits
  • 604
  • 1
  • 5
  • 10
1

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

William
  • 862
  • 7
  • 14
0

I had no other option but to make my CloudFront URL to have .mp3 attached. And then it works for ios.

AmerllicA
  • 29,059
  • 15
  • 130
  • 154
user3804063
  • 809
  • 1
  • 14
  • 32