Document: pictureInPictureElement プロパティ

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

pictureInPictureElementDocument インターフェイスの読み取り専用プロパティで、 この文書内のピクチャインピクチャモードで現在表示されている Element を返します。ピクチャインピクチャモードが現在使用されていない場合は null を返します。

このプロパティは読み取り専用ですが、(厳格モードであっても)変更されても例外は発生しません。セッターは何もせず、無視されます。

現在ピクチャインピクチャモードになっている Element オブジェクトへの参照です。現在この document でピクチャインピクチャモードが使用されていない場合、返される値は null です。

この例では pictureInPictureElement が返す値を検査する関数 exitPictureInPicture() を表示しています。現在の文書がピクチャインピクチャモードでない(pictureInPictureElementnull である)場合、 Document.exitPictureInPicture() を実行してピクチャインピクチャモードを終了します。

js
function exitPictureInPicture() {
  if (document.pictureInPictureElement) {
    document.exitPictureInPicture();
  }
}

仕様書

Specification
Picture-in-Picture
# ref-for-dom-documentorshadowroot-pictureinpictureelement①⑤

ブラウザーの互換性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
pictureInPictureElement

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support
See implementation notes.

関連情報