What are the supported video MIME types by AVPlayer?

I am using AVPlayer to play video files downloaded from a URL. Is there a way to determine what video MIME types are supported by AVPlayer?

I tried using -

[AVURLAsset audiovisualMIMETypes]

which rerturns following supported MIME types for video -

"video/3gpp2",

"video/quicktime",

"video/mp4",

"video/avi",

"video/x-m4v",

"video/3gpp"

However, when I use AVI files, the AVPlayer fails to play those & return error - "Failed to play media file".

Is there a subtle & reliable way to determine what video formats does the AVPlayer support?


Contradictorily, as per above list avi seems to be a supported type, but the isPlayable check on AVAsset returns false for avi files. (Why?) Strange!


Note: I don't want to use isPlayable check on AVAsset object as it makes a network call & I have many files which makes it not preferable.

Replies

Note: I don't want to use isPlayable check on AVAsset object as it makes a network call & I have many files which makes it not preferable.


Understood, but you could call it the first time you meet a certain type, and keep track of the result in an array. So, newt time you have such a file, you can immediately react, without waiting for network response. Or flag the files if you present them in a tableView as not readable…

Are you suggesting I build an exhaustive list of file extentions by learning which files can/can't be played in AVPlayer? Isn't there a cleaner way to do this?

I mean, using [AVURLAsset audiovisualMIMETypes] seems logical, but why does it return the MIME types that it can't play(e.g .avi)?

If I remember correctly AVPlayer supports only motion-jpeg in avi.


Anyway, even if the container format is supported by AVPlayer, the video and audio formats inside might not be supported. The only way to be sure is to know the video and audio formats too.