ShadowRoot: pictureInPictureElement プロパティ
利用可能性は限定的
この機能はベースラインではありません。最も広く使用されているブラウザーの一部で動作しません。
もっと多くのブラウザーがこの機能に対応してほしいですか? 理由を教えてください。
pictureInPictureElement は ShadowRoot インターフェイスの読み取り専用プロパティで、このシャドウツリー内で現在、ピクチャインピクチャモードで表示されている要素 (Element) を返します。現在、ピクチャインピクチャモードが使用されていない場合は null を返します。
値
現在ピクチャインピクチャモードになっている Element オブジェクトへの参照です。
ピクチャインピクチャモードにおいて、シャドウツリーに関連付けられた要素がない場合は、null を返します。例えば、ピクチャインピクチャ要素が存在しない場合や、その要素がシャドウツリーに含まれていない場合などが該当します。
例
js
let customElem = document.querySelector("my-shadow-dom-element");
let shadow = customElem.shadowRoot;
let pipElem = shadow.pictureInPictureElement;
仕様書
| 仕様書 |
|---|
| Picture-in-Picture> # dom-pictureinpictureevent-pictureinpicturewindow> |