Web API Picture-in-Picture Methods

  • HTMLVideoElement.requestPictureInPicture(): Method used to request that a video element on a web page enters Picture-in-Picture (PiP) mode.
  • Document.exitPictureInPicture(): It is used to exit the Picture-in-Picture (PiP) mode and return the video or media element to its regular display mode.

Web API Picture-in-Picture

Web API Picture-in-Picture feature enables websites to display a video in a floating window that stays on top of windows. This allows users to keep watching videos while interacting with content or applications, on their device.

Similar Reads

Concepts and usage

Multitasking: PiP allows users to watch a video while simultaneously interacting with other content or applications on the same screen. This is particularly useful for productivity and multitasking scenarios. Customized Video Playback: Developers can provide users with the ability to control the size and position of the PiP video window, ensuring it doesn’t obstruct important content. Accessibility: PiP can improve accessibility by allowing users to move the video to a more convenient location on the screen or by enabling screen readers to focus on video content while users browse other webpage elements. User Engagement: Websites can use PiP to keep users engaged by allowing them to continue watching videos while navigating through different sections of the site or performing other tasks. User Control: PiP gives users more control over their viewing experience. They can resize, move, or close the PiP window as needed, providing a customizable and user-friendly interface....

Web API Picture-in-Picture Interfaces

PictureInPictureWindow: The interface represents the floating video window; also contains width and height properties, and an “onresize” event handler property....

Web API Picture-in-Picture Methods

HTMLVideoElement.requestPictureInPicture(): Method used to request that a video element on a web page enters Picture-in-Picture (PiP) mode. Document.exitPictureInPicture(): It is used to exit the Picture-in-Picture (PiP) mode and return the video or media element to its regular display mode....

Web API Picture-in-Picture Properties

HTMLVideoElement.disablePictureInPicture: this property is used to tell the web browser not to suggest or automatically enable the Picture-in-Picture (PiP) feature for a video. Document.pictureInPictureEnabled: This property tells us whether we can use PIP mode are not. This is false if picture-in-picture mode is not available for any reason. Document.pictureInPictureElement: The pictureInPictureElement property tells you which Element is currently being displayed in the floating window. it is null if no element is in pip mode....

Web API Picture-in-Picture Events

The Picture-in-Picture API defines three events, which can be used to detect when picture-in-picture mode is toggled and when the floating video window is resized...

Browser support for PIP mode

...

Contact Us