0
AVPlayer視頻無法從其離開的位置恢復,而是視頻從頭開始。這是我的代碼。任何人都可以幫助我?AVPlayer視頻在應用變爲活動狀態後無法恢復
-(void)appEnteredForeground:(NSNotification*)notification {
if(playerViewController.player.status == AVPlayerStatusReadyToPlay &&
playerViewController.player.currentItem.status == AVPlayerItemStatusReadyToPlay) {
total_duration = self.playerViewController.player.currentItem.duration;
[self.playerViewController.player seekToTime:currentTime];
[_playerViewController.player play];
}
}
-(void)appEnteredBackground:(NSNotification*)notification {
[playerViewController.player pause];
currentTime = [playerViewController.player currentTime];
[playerViewController.player seekToTime:currentTime];
}
它正在處理其他應用程序,但在此應用程序中無法正常工作。 – Bharathi
您是否有任何其他地方操作該播放器? – ronan
一些視頻正在恢復,很少沒有恢復。 – Bharathi