mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-20 12:11:20 -08:00
fix(iframe): [PKG-IFRAME-05] checkpoint player and editor integration
This commit is contained in:
1 parent
047e2df945
commit
b35183c7af
15 files changed
+2547
-14
No files matched your search
@@ -15,6 +15,11 @@ const iframe = new ArtplayerToolIframe({
|
||||
url: '/iframe.html',
|
||||
})
|
||||
|
||||
window.addEventListener('artplayer:example:cleanup', () => {
|
||||
iframe.destroy()
|
||||
$iframe.remove()
|
||||
}, { once: true })
|
||||
|
||||
iframe.message(({ type, data }) => {
|
||||
switch (type) {
|
||||
case 'fullscreenWeb':
|
||||
@@ -44,4 +49,7 @@ iframe.commit(() => {
|
||||
data: state,
|
||||
})
|
||||
})
|
||||
}).catch((error) => {
|
||||
if (!iframe.destroyed)
|
||||
console.error(error)
|
||||
})
|
||||
@@ -205,8 +205,9 @@
|
||||
}
|
||||
|
||||
function runCode() {
|
||||
window.dispatchEvent(new Event('artplayer:example:cleanup'))
|
||||
// Destroy all existing instances
|
||||
Artplayer.instances.forEach((art) => art.destroy(true))
|
||||
Artplayer.instances.slice().forEach((art) => art.destroy(true))
|
||||
|
||||
const value = editor.getValue()
|
||||
eval(value)
|
||||
|
||||
Reference in new issue
Block a user