我正在使用MPMovieController播放视频,我正在设置开始和结束播放时间。它以前工作过,但自从更新到ios 9后,代码不再起作用了。我使用以下代码:
self.player.initialPlaybackTime = self.startPlaybackTime;
self.player.endPlaybackTime = self.endPlaybackTime;
self.player.currentPlaybackTime = self.startPlaybackTime;
我在调用[self.player prepareToPlay]
之前尝试使用此代码,并且使用以下代码将playbackState更改为MPMoviePlaybackStatePlaying:
-(void)MPMoviePlayerPlaybackStateDidChange:(NSNotification*)notification
{
if (self.player.playbackState == MPMoviePlaybackStatePlaying)
{
if (!self.playbackDurationSet)
{
self.player.initialPlaybackTime = self.startPlaybackTime;
self.player.endPlaybackTime = self.endPlaybackTime;
self.player.currentPlaybackTime = self.startPlaybackTime;
self.playbackDurationSet = YES;
}
}
}
在第一个选项中,initialPlabackTime / currentPlaybackTime也不起作用。在第二个选项中,电影不应该结束。我该如何解决这个问题?