1

AVPlayerレイヤーとしてビューにUIViewController設定します。レートを 0 に設定してビデオを一時停止すると、レートを 1 に戻してビューに表示されます。

また、同じことを行う通知がUIApplicationWillEnterForegroundNotificationありUIApplicationDidEnterBackgroundNotificationます(バックグラウンドで一時停止、フォアグラウンドで再生)...

VC を提示して戻ってくると、ビデオの再生を続けることができませんが、バックグラウンドに戻って戻ってくると、問題なく再生されます..

何が足りないのかわからない..

これが私がプレーヤーをセットアップする方法です

self.player = [[AVPlayer alloc]initWithURL:videoUrl];
    self.player.allowsExternalPlayback = NO;

    self.playerLayer = [AVPlayerLayer playerLayerWithPlayer:self.player];
    self.playerLayer.frame = CGRectMake(0,0,self.view.frame.size.width, self.view.frame.size.height);
    self.playerLayer.videoGravity = AVLayerVideoGravityResizeAspectFill;
    self.playerLayer.player.muted = YES;
    [self.view.layer insertSublayer:self.playerLayer atIndex:0];
4

0 に答える 0