MCPcopy Create free account
hub / github.com/Vishal-raj-1/Awesome-JavaScript-Projects / togglePip

Function togglePip

assets/js/video.js:219–232  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

217
218// togglePip toggles Picture-in-Picture mode on the video
219async function togglePip() {
220 try {
221 if (video !== document.pictureInPictureElement) {
222 pipButton.disabled = true;
223 await video.requestPictureInPicture();
224 } else {
225 await document.exitPictureInPicture();
226 }
227 } catch (error) {
228 console.error(error);
229 } finally {
230 pipButton.disabled = false;
231 }
232}
233
234// hideControls hides the video controls when not in use
235// if the video is paused, the controls must remain visible

Callers 1

keyboardShortcutsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected