mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-09 03:46:16 -08:00
- Implemented the core functionality of the Document Picture-in-Picture plugin. - Created main plugin file `artplayer-plugin-document-pip.js` with support for opening and closing the PIP window. - Added legacy support in `artplayer-plugin-document-pip.legacy.js`. - Defined plugin options in `package.json` and included necessary metadata. - Developed the main logic in `src/index.js`, including style copying and event handling. - Created TypeScript definitions in `types/artplayer-plugin-document-pip.d.ts` for better type safety.
20 lines
491 B
JavaScript
20 lines
491 B
JavaScript
// npm i artplayer-plugin-document-pip
|
|
// import artplayerPluginDocumentPip from 'artplayer-plugin-document-pip';
|
|
|
|
let art = new Artplayer({
|
|
container: '.artplayer-app',
|
|
url: '/assets/sample/video.mp4',
|
|
plugins: [
|
|
artplayerPluginDocumentPip({
|
|
width: 480,
|
|
height: 270,
|
|
fallbackToVideoPiP: true,
|
|
placeholder: `Playing in Document Picture-in-Picture`,
|
|
}),
|
|
],
|
|
})
|
|
|
|
art.on('document-pip', (state) => {
|
|
console.log('Document Picture-in-Picture', state)
|
|
})
|