0

ドキュメントによると、willStop および didStop デリゲート メソッドは、restoreUserInterfaceForPictureInPictureStopWithCompletionHandler と共に、AVPictureInPictureController がどのように閉じられたかに関係なく、閉じるときに呼び出されます。コントローラーが「X」ボタンまたはその他のボタンで閉じられて通常の再生に戻るかどうかを確認するにはどうすればよいですか?

4

1 に答える 1

1

X ボタンと復元ボタンの違いは次のとおりです。

[PiP の復元] ボタンをタップするとトリガーされます

"pictureInPictureController(_:restoreUserInterfaceForPictureInPictureStopWithCompl etionHandler:)"
"pictureInPictureControllerWillStopPictureInPicture"
"pictureInPictureControllerDidStopPictureInPicture"

閉じるボタンをタップすると、restoreUserInterface コールバックがスキップされ、直接移動します。

"pictureInPictureControllerWillStopPictureInPicture"
"pictureInPictureControllerDidStopPictureInPicture"

したがって、Bool フラグを使用して、restoreUserInterface を呼び出したかどうかを willStop/DidStop でチェックできます。

pictureInPictureSuspendedAVPictureInPictureViewController にもプロパティがありますが、値をチェックしてみましたが、どちらの場合も常に false を返すことがわかったので、上記のトリックを使用して、ユーザーが復元または閉じるボタンをタップしたかどうかを確認する必要があります。

于 2016-05-16T15:51:58.703 に答える