DocumentPictureInPicture: window property
Khả dụng hạn chế
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
Thuộc tính chỉ đọc window của giao diện
DocumentPictureInPicture trả về phiên bản Window đại diện cho ngữ cảnh duyệt web bên trong cửa sổ Picture-in-Picture.
Giá trị
Phiên bản đối tượng Window nếu cửa sổ Picture-in-Picture đã được mở bằng DocumentPictureInPicture.requestWindow(), hoặc null nếu chưa.
Ví dụ
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;
}
Thông số kỹ thuật
| Thông số kỹ thuật |
|---|
| Document Picture-in-Picture Specification> # dom-documentpictureinpicture-window> |