关于MPMoviePlayerViewController播放网络地址,没播放就自动dimiss的问题

废话不多说,今天开发中遇到MPMoviePlayerViewController播放网络视频,没播放就自动dismiss的问题,Android端可以正常播放,但是IOS拍的视频上传到服务器端后可以正常播放,IOS模拟器测试又是好的,蛋疼,最后怀疑是视频编码的问题。看到MPMoviePlayerViewController文档中有这么一段描述:

Supported Formats

This class plays any movie or audio file supported in iOS. This includes both streamed content and fixed-length files. For movie files, this typically means files with the extensions .mov, .mp4, .mpv, and .3gp and using one of the following compression standards:

  • H.264 Baseline Profile Level 3.0 video, up to 640 x 480 at 30 fps. (The Baseline profile does not support B frames.)
  • MPEG-4 Part 2 video (Simple Profile)

If you use this class to play audio files, it displays a white screen with a QuickTime logo while the audio plays. For audio files, this class supports AAC-LC audio at up to 48 kHz, and MP3 (MPEG-1 Audio Layer 3) up to 48 kHz, stereo audio.

对比了下两个视频编码,左边的是IOS的右边的是Android的,H.264是视频编码,AAC和AMR是音频编码,想想估计是IOS这边不支持这种音频编码的格式,然后Android那边改成AAC的就好了。当然这里是我遇到这种问题的解决办法,可能还会有其他原因导致这种问题。