MPMoviePlayerPlaybackDidFinishNotification is called immediately

后端 未结 3 1338
孤独总比滥情好
孤独总比滥情好 2020-12-22 08:45

I\'m trying to play video with the following code:

UIGraphicsBeginImageContext(CGSizeMake(1,1));

self.player = [[MPMoviePlayerViewController alloc] initWith         


        
3条回答
  •  佛祖请我去吃肉
    2020-12-22 09:22

    If the video plays on your desktop machine, but not iOS (either in-app or in Safari), it's most likely because the HTTP server does not support byte-range requests. If the HTTP server does not support byte-range requests, iOS will not play the video. This differs from Safari on OS X, which plays the video regardless.

    From the Safari Web Content Documentation:

    HTTP servers hosting media files for iOS must support byte-range requests, which iOS uses to perform random access in media playback. (Byte-range support is also known as content-range or partial-range support.) Most, but not all, HTTP 1.1 servers already support byte-range requests.

    Also, the HTTP server must provide a valid Content-Type header (the URL above also enumerates the valid MIME types). iOS will not play the video if the MIME type is invalid or missing.

提交回复
热议问题