DocumentPictureInPicture: window 屬性
DocumentPictureInPicture 介面的只讀屬性 window 返回一個 Window 例項,該例項代表畫中畫視窗內部的瀏覽上下文。
值
如果已使用 DocumentPictureInPicture.requestWindow() 打開了畫中畫視窗,則返回一個 Window 物件例項,否則返回 null。
示例
js
const videoPlayer = document.getElementById("player");
// …
await window.documentPictureInPicture.requestWindow({
width: videoPlayer.clientWidth,
height: videoPlayer.clientHeight,
});
// …
const pipWindow = window.documentPictureInPicture.window;
if (pipWindow) {
// Mute video playing in the Picture-in-Picture window.
const pipVideo = pipWindow.document.querySelector("#video");
pipVideo.muted = true;
}
規範
| 規範 |
|---|
| 文件畫中畫規範 # dom-documentpictureinpicture-window |
瀏覽器相容性
載入中…