在播放实时视频时,SeekToTime 方法在 iOS 9 中不起作用。即使在寻找之后,视频也不会从寻找的位置播放。在以前的 iOS 版本中,它可以正常工作。以下是代码...
-(无效)加载视频{
[player pause];
player = nil;
asset = [AVAsset assetWithURL:[NSURL URLWithString:@"http://playertest.longtailvideo.com/adaptive/wowzaid3/playlist.m3u8"]];
playerItem = [AVPlayerItem playerItemWithAsset:asset];
player = [AVPlayer playerWithPlayerItem:playerItem];
AVPlayerLayer *playerLayer = [AVPlayerLayer playerLayerWithPlayer:player];
playerLayer.frame = CGRectMake(20, 0, 600, 400);
[self.view.layer addSublayer:playerLayer];
[player play];
[self addPlayerTimeObserver];
}
-(IBAction)SeekToTimeInVideo:(id)sender{ [播放器暂停];
[self.player seekToTime:CMTimeMakeWithSeconds(10.0, 25.0) toleranceBefore:kCMTimeZero toleranceAfter:kCMTimeZero completionHandler:^(BOOL finished)
{
[player play];
}];
}
任何想法 ??这是iOS 9中的错误吗?