gpt4 book ai didi

ios - MPMoviePlayerViewController 重复计数

转载 作者:行者123 更新时间:2023-11-29 10:56:08 26 4
gpt4 key购买 nike

我正在使用 MPMoviePlayerViewController 播放视频。

我将重复模式设置为 MPMovieRepeatModeOne,以便视频可以循环播放。

有什么方法可以用来获取播放视频的重复次数。

最佳答案

您可以添加通知:

[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(introMovieFinished:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:self.moviePlayerController];

然后使用此通知来检测视频何时结束循环:

- (void)introMovieFinished:(NSNotification *)notification
{
if (notification.object == self.moviePlayerController) {
NSInteger reason = [[notification.userInfo objectForKey:MPMoviePlayerPlaybackDidFinishReasonUserInfoKey] integerValue];
if (reason == MPMovieFinishReasonPlaybackEnded)
{
NSLog(@"Video has looped!");
}
}
}

关于ios - MPMoviePlayerViewController 重复计数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18350121/

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