Document: pictureInPictureElement プロパティ
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
pictureInPictureElement は Document インターフェイスの読み取り専用プロパティで、 この文書内のピクチャインピクチャモードで現在表示されている Element を返します。ピクチャインピクチャモードが現在使用されていない場合は null を返します。
このプロパティは読み取り専用ですが、(厳格モードであっても)変更されても例外は発生しません。セッターは何もせず、無視されます。
値
現在ピクチャインピクチャモードになっている Element オブジェクトへの参照です。現在この document でピクチャインピクチャモードが使用されていない場合、返される値は null です。
例
この例では pictureInPictureElement が返す値を検査する関数 exitPictureInPicture() を表示しています。現在の文書がピクチャインピクチャモードでない(pictureInPictureElement が null である)場合、 Document.exitPictureInPicture() を実行してピクチャインピクチャモードを終了します。
js
function exitPictureInPicture() {
if (document.pictureInPictureElement) {
document.exitPictureInPicture();
}
}
仕様書
| Specification |
|---|
| Picture-in-Picture> # dom-documentorshadowroot-pictureinpictureelement> |
ブラウザーの互換性
Loading…