gpt4 book ai didi

ios - MPMoviePlayerViewController 不播放视频 mp4

转载 作者:行者123 更新时间:2023-11-29 01:57:58 24 4
gpt4 key购买 nike

https://dl.dropboxusercontent.com/u/52719649/69090d547c8d47dd27b6d271649c59ae.mp4

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *path = [documentsDirectory stringByAppendingPathComponent:@"SampleVideo.mp4"];
NSURL *url = [NSURL fileURLWithPath:path];
self.controller = [[MPMoviePlayerViewController alloc] initWithContentURL:url];
[self.controller.moviePlayer setControlStyle:MPMovieControlStyleDefault];
[self presentMoviePlayerViewControllerAnimated:self.controller];
[self.controller.moviePlayer play];

最佳答案

您需要重新压缩视频,因为当前压缩不正确:

  • H.264 Main Profile Level 4.0 视频

这是 Apple 的指导表格:

  • 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)

音频可能需要根据以下内容进行更改:

(...) this class supports AAC-LC audio at up to 48 kHz, and MP3 (MPEG-1 Audio Layer 3) up to 48 kHz, stereo audio.

MPMoviePlayerController(Apple 文档中的 Class Reference)。

关于ios - MPMoviePlayerViewController 不播放视频 mp4,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30644927/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com