UNPKG

vidstack

Version:

Build awesome media experiences on the web.

38 lines (35 loc) 907 B
import { listenEvent } from 'maverick.js/std'; import { _ as canUsePictureInPicture } from '../../media-core.js'; class VideoPictureInPicture { constructor(_video, _media) { this.qa = _video; this.j = _media; listenEvent(this.qa, "enterpictureinpicture", this.Fh.bind(this)); listenEvent(this.qa, "leavepictureinpicture", this.Gh.bind(this)); } get active() { return document.pictureInPictureElement === this.qa; } get supported() { return canUsePictureInPicture(this.qa); } async enter() { return this.qa.requestPictureInPicture(); } exit() { return document.exitPictureInPicture(); } Fh(event) { this.Hc(true, event); } Gh(event) { this.Hc(false, event); } Hc = (active, event) => { this.j.delegate.p("picture-in-picture-change", { detail: active, trigger: event }); }; } export { VideoPictureInPicture as V };