gpt4 book ai didi

ios9 - 在 iOS9 中弃用 mpmovieplayercontroller 后继续前进的方式

转载 作者:行者123 更新时间:2023-12-01 01:14:25 27 4
gpt4 key购买 nike

我有一个代码可以:

    self.video = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL URLWithString:url]];
self.video.movieSourceType = MPMovieSourceTypeStreaming;
[[self.video view] setFrame:[[self view] bounds]];
[self.view addSubview:self.video.view];
[self.video play];

它基本上是加载一个 url 并开始播放。随着 MPMoviePlayerController 的弃用,用于执行上述功能的框架是什么。

最佳答案

使用苹果提供的以下方式。主要使用AVFoundation框架,同时支持画中画功能以支持最新的iOS 9多任务处理功能。

Apple 文档

The AVKit framework provides the AVPlayerViewController class, which automatically displays a PiP button for your users.

If you support PiP using AVKit but want to opt out of PiP for a particular video, assign a value of NO to the player view controller’s allowsPictureInPicturePlayback property.

AVKit also provides the AVPictureInPictureController class, which you can use with the AVPlayerLayer class from AV Foundation. Use this approach if you’d like to provide your own view controller and custom user interface for video playback.

关于ios9 - 在 iOS9 中弃用 mpmovieplayercontroller 后继续前进的方式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30953342/

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