-
Notifications
You must be signed in to change notification settings - Fork 121
Open
Description
use diy controls bugs, Create after destroying the player,There will be an increase of dom every time.
const pipControl = {
el: document.createElement('div'),
id: 'pip',
pipIcon: publicIcons.pipIcon,
tooltip: '画中画' as any,
handlePip() {},
init(player, _: any, tooltip) {
this.el.id = 'pip';
const pipDom = document.createElement('div');
pipDom.className = 'nplayer_icon';
pipDom.innerHTML = `${this.pipIcon}`;
this.tooltip = tooltip;
this.tooltip.html = '画中画';
this.el.append(pipDom);
this.handlePip = () => {
if (!player.loaded) return;
if ((document as any).pictureInPictureElement !== player.video) {
(player.video as any).requestPictureInPicture();
} else {
(document as any).exitPictureInPicture();
}
};
this.el.addEventListener('click', this.handlePip);
},
dispose() {
this.el.removeEventListener('click', this.handlePip);
this.el?.remove();
},
};
Metadata
Metadata
Assignees
Labels
No labels