feat: introduce ArtplayerToolIframe for iframe control

- Removed the old ArtplayerPluginIframe implementation.
- Added ArtplayerToolIframe class with methods for iframe communication.
- Implemented postMessage and onMessage methods for message handling.
- Created a new TypeScript definition file for ArtplayerToolIframe.
- Updated documentation links to point to the new iframe tool.
- Added npm ignore file and README for the new package.
- Included compiled and uncompiled versions of the new iframe tool.
- Updated package.json with relevant metadata and exports.
This commit is contained in:
Harvey Zhao committed 2026-03-07 20:58:02 +08:00
1 parent 78e9cc74f8
commit 1c75731ca9
58 files changed
+331 -178

No files matched your search

+4 -4
View File
@@ -1,5 +1,5 @@
// npm i artplayer-plugin-iframe
// import ArtplayerPluginIframe from 'artplayer-plugin-iframe';
// npm i artplayer-tool-iframe
// import ArtplayerToolIframe from 'artplayer-tool-iframe';
const $iframe = document.createElement('iframe')
$iframe.allowFullscreen = true
@@ -10,7 +10,7 @@ const $container = document.querySelector('.artplayer-app')
$container.innerHTML = ''
$container.appendChild($iframe)
const iframe = new ArtplayerPluginIframe({
const iframe = new ArtplayerToolIframe({
iframe: $iframe,
url: '/iframe.html',
})
@@ -39,7 +39,7 @@ iframe.commit(() => {
})
art.on('fullscreenWeb', (state) => {
ArtplayerPluginIframe.postMessage({
ArtplayerToolIframe.postMessage({
type: 'fullscreenWeb',
data: state,
})
+1 -1
View File
@@ -63,7 +63,6 @@
'./assets/ts/artplayer-plugin-dash-control.d.ts',
'./assets/ts/artplayer-plugin-document-pip.d.ts',
'./assets/ts/artplayer-plugin-hls-control.d.ts',
'./assets/ts/artplayer-plugin-iframe.d.ts',
'./assets/ts/artplayer-plugin-jassub.d.ts',
'./assets/ts/artplayer-plugin-multiple-subtitles.d.ts',
'./assets/ts/artplayer-plugin-vast.d.ts',
@@ -71,6 +70,7 @@
'./assets/ts/artplayer-plugin-websr.d.ts',
'./assets/ts/artplayer-proxy-canvas.d.ts',
'./assets/ts/artplayer-proxy-mediabunny.d.ts',
'./assets/ts/artplayer-tool-iframe.d.ts',
'./assets/ts/artplayer.d.ts',
]
@@ -4,7 +4,7 @@ interface Message {
id?: number
}
declare class ArtplayerPluginIframe {
declare class ArtplayerToolIframe {
constructor(option: { iframe: HTMLIFrameElement, url: string })
static iframe: boolean
@@ -26,7 +26,7 @@ declare class ArtplayerPluginIframe {
destroy(): void
}
export default ArtplayerPluginIframe
export default ArtplayerToolIframe
export = artplayerPluginIframe
export as namespace artplayerPluginIframe;
export = artplayerToolIframe
export as namespace artplayerToolIframe;