0
暫停和恢復視頻我「米使用下面的代碼。但它不是從離開的地方重新開始。誰能幫助我?SeektoTime工作不正常
-(void)appEnteredBackground:(NSNotification*)notification {
[playerViewController.player pause];
currentTime = [playerViewController.player currentTime];
}
-(void)appEnteredForeground:(NSNotification*)notification {
if(playerViewController.player.status == AVPlayerStatusReadyToPlay &&
self.playerViewController.player.currentItem.status == AVPlayerItemStatusReadyToPlay) {
total_duration = self.playerViewController.player.currentItem.duration;
[self.playerViewController.player.currentItem seekToTime:CMTimeMakeWithSeconds(CMTimeGetSeconds(currentTime),60000)];
[playerViewController.player play];
}
}