From c655f073ae2c7c273d27559d1cabc1a027879f17 Mon Sep 17 00:00:00 2001 From: Harvey Zhao Date: Sun, 4 Jan 2026 15:59:52 +0800 Subject: [PATCH] feat: add danmuku plugin documentation and i18n setup guide - Created a new documentation file for the danmuku plugin with code examples. - Added comprehensive language settings documentation, including default languages, import instructions, and examples for adding and modifying languages. - Updated the i18n documentation to reflect changes in language handling and provide clear examples for users. --- CHANGELOG.md | 1 + README.md | 1 - docs/assets/example/libass.js | 44 - docs/assets/js/common.js | 1 - docs/compiled/artplayer-plugin-libass.js | 8 - .../artplayer-plugin-libass.legacy.js | 8 - docs/compiled/artplayer-plugin-libass.mjs | 8 - docs/document/404.html | 2 +- docs/document/advanced/built-in.html | 4 +- docs/document/advanced/class.html | 4 +- docs/document/advanced/event.html | 4 +- docs/document/advanced/global.html | 4 +- docs/document/advanced/plugin.html | 4 +- docs/document/advanced/property.html | 4 +- ...md.7shqBtga.js => en_index.md.BCuGsKe-.js} | 10 +- ...a.lean.js => en_index.md.BCuGsKe-.lean.js} | 0 ...6ZSUj7.js => en_start_i18n.md.Dn_-QNMz.js} | 2 +- ...n.js => en_start_i18n.md.Dn_-QNMz.lean.js} | 0 ...ex.md.Xug2h4MQ.js => index.md.DDqAV2TW.js} | 10 +- ...h4MQ.lean.js => index.md.DDqAV2TW.lean.js} | 0 ...aaMVM.js => plugin_danmuku.md.BbwsJDxp.js} | 2 +- ....js => plugin_danmuku.md.BbwsJDxp.lean.js} | 0 ....B-KNPVtu.js => start_i18n.md.D9C8Ka0e.js} | 2 +- ...lean.js => start_i18n.md.D9C8Ka0e.lean.js} | 0 docs/document/component/contextmenu.html | 4 +- docs/document/component/controls.html | 4 +- docs/document/component/layers.html | 4 +- docs/document/component/setting.html | 4 +- docs/document/en/advanced/built-in.html | 4 +- docs/document/en/advanced/class.html | 4 +- docs/document/en/advanced/event.html | 4 +- docs/document/en/advanced/global.html | 4 +- docs/document/en/advanced/plugin.html | 4 +- docs/document/en/advanced/property.html | 4 +- docs/document/en/component/contextmenu.html | 4 +- docs/document/en/component/controls.html | 4 +- docs/document/en/component/layers.html | 4 +- docs/document/en/component/setting.html | 4 +- docs/document/en/index.html | 14 +- docs/document/en/start/i18n.html | 8 +- docs/document/en/start/option.html | 4 +- docs/document/hashmap.json | 2 +- docs/document/index.html | 14 +- docs/document/plugin/danmuku.html | 6 +- docs/document/start/i18n.html | 8 +- docs/document/start/option.html | 4 +- docs/index.html | 4 - docs/llms.txt | 67 - .../artplayer-plugin-libass/index.js | 1921 ----------------- .../artplayer-plugin-libass/index.js.map | 1 - packages/artplayer-plugin-libass/.npmignore | 6 - packages/artplayer-plugin-libass/README.md | 11 - .../dist/artplayer-plugin-libass.js | 8 - .../dist/artplayer-plugin-libass.legacy.js | 8 - .../dist/artplayer-plugin-libass.mjs | 8 - packages/artplayer-plugin-libass/package.json | 43 - .../artplayer-plugin-libass/src/adapter.js | 226 -- packages/artplayer-plugin-libass/src/index.js | 21 - .../types/artplayer-plugin-libass.d.ts | 16 - .../docs/.vitepress/config.js | 2 - 60 files changed, 85 insertions(+), 2496 deletions(-) delete mode 100644 docs/assets/example/libass.js delete mode 100644 docs/compiled/artplayer-plugin-libass.js delete mode 100644 docs/compiled/artplayer-plugin-libass.legacy.js delete mode 100644 docs/compiled/artplayer-plugin-libass.mjs rename docs/document/assets/{en_index.md.7shqBtga.js => en_index.md.BCuGsKe-.js} (96%) rename docs/document/assets/{en_index.md.7shqBtga.lean.js => en_index.md.BCuGsKe-.lean.js} (100%) rename docs/document/assets/{en_start_i18n.md.Br6ZSUj7.js => en_start_i18n.md.Dn_-QNMz.js} (98%) rename docs/document/assets/{en_start_i18n.md.Br6ZSUj7.lean.js => en_start_i18n.md.Dn_-QNMz.lean.js} (100%) rename docs/document/assets/{index.md.Xug2h4MQ.js => index.md.DDqAV2TW.js} (96%) rename docs/document/assets/{index.md.Xug2h4MQ.lean.js => index.md.DDqAV2TW.lean.js} (100%) rename docs/document/assets/{plugin_danmuku.md.Dm8aaMVM.js => plugin_danmuku.md.BbwsJDxp.js} (99%) rename docs/document/assets/{plugin_danmuku.md.Dm8aaMVM.lean.js => plugin_danmuku.md.BbwsJDxp.lean.js} (100%) rename docs/document/assets/{start_i18n.md.B-KNPVtu.js => start_i18n.md.D9C8Ka0e.js} (98%) rename docs/document/assets/{start_i18n.md.B-KNPVtu.lean.js => start_i18n.md.D9C8Ka0e.lean.js} (100%) delete mode 100644 docs/uncompiled/artplayer-plugin-libass/index.js delete mode 100644 docs/uncompiled/artplayer-plugin-libass/index.js.map delete mode 100644 packages/artplayer-plugin-libass/.npmignore delete mode 100644 packages/artplayer-plugin-libass/README.md delete mode 100644 packages/artplayer-plugin-libass/dist/artplayer-plugin-libass.js delete mode 100644 packages/artplayer-plugin-libass/dist/artplayer-plugin-libass.legacy.js delete mode 100644 packages/artplayer-plugin-libass/dist/artplayer-plugin-libass.mjs delete mode 100644 packages/artplayer-plugin-libass/package.json delete mode 100644 packages/artplayer-plugin-libass/src/adapter.js delete mode 100644 packages/artplayer-plugin-libass/src/index.js delete mode 100644 packages/artplayer-plugin-libass/types/artplayer-plugin-libass.d.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index b9f7f22d0..427fda35c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - Add `artplayer-plugin-jassub` plugin - Add `artplayer-proxy-mediabunny` plugin - Add `artplayer-plugin-audio-track` plugin +- Deprecate `artplayer-plugin-libass` plugin ## [5.3.0] - 2025-09-06 diff --git a/README.md b/README.md index 7d7cec0a4..9c9234c3f 100644 --- a/README.md +++ b/README.md @@ -106,7 +106,6 @@ let art = new Artplayer({ - [artplayer-plugin-dash-control](https://artplayer.org/?libs=https://cdnjs.cloudflare.com/ajax/libs/dashjs/4.5.2/dash.all.min.js%0A./uncompiled/artplayer-plugin-dash-control/index.js&example=dash.control) - [artplayer-plugin-vtt-thumbnail](https://artplayer.org/?libs=./uncompiled/artplayer-plugin-vtt-thumbnail/index.js&example=vtt.thumbnail) - [artplayer-plugin-multiple-subtitles](https://artplayer.org/?libs=./uncompiled/artplayer-plugin-multiple-subtitles/index.js&example=multiple.subtitles) -- [artplayer-plugin-libass](https://artplayer.org/?libs=./uncompiled/artplayer-plugin-libass/index.js&example=libass) - [artplayer-plugin-chromecast](https://artplayer.org/?libs=./uncompiled/artplayer-plugin-chromecast/index.js&example=chromecast) - [artplayer-plugin-vast](https://artplayer.org/?libs=./uncompiled/artplayer-plugin-vast/index.js&example=vast) - [artplayer-plugin-chapter](https://artplayer.org/?libs=./uncompiled/artplayer-plugin-chapter/index.js&example=chapter) diff --git a/docs/assets/example/libass.js b/docs/assets/example/libass.js deleted file mode 100644 index 77aa1f981..000000000 --- a/docs/assets/example/libass.js +++ /dev/null @@ -1,44 +0,0 @@ -// npm i artplayer-plugin-libass -// import artplayerPluginLibass from 'artplayer-plugin-libass'; - -const art = new Artplayer({ - container: '.artplayer-app', - url: '/assets/sample/video.mp4', - fullscreenWeb: true, - subtitle: { - url: '/assets/sample/style-test.ass', - }, - plugins: [ - artplayerPluginLibass({ - // debug: true, - workerUrl: 'https://unpkg.com/libass-wasm@4.1.0/dist/js/subtitles-octopus-worker.js', - // wasmUrl: 'https://unpkg.com/libass-wasm@4.1.0/dist/js/subtitles-octopus-worker.wasm', - fallbackFont: '/assets/misc/SourceHanSansCN-Bold.woff2', - }), - ], -}) - -// init -art.on('artplayerPluginLibass:init', (adapter) => { - console.info('artplayerPluginLibass:init', adapter) -}) - -// subtitle switch -art.on('artplayerPluginLibass:switch', (url) => { - console.info('artplayerPluginLibass:switch', url) -}) - -// subtitle visible -art.on('artplayerPluginLibass:visible', (visible) => { - console.info('artplayerPluginLibass:visible', visible) -}) - -// subtitle timeOffset -art.on('artplayerPluginLibass:timeOffset', (timeOffset) => { - console.info('artplayerPluginLibass:timeOffset', timeOffset) -}) - -// destroy -art.on('artplayerPluginLibass:destroy', () => { - console.info('artplayerPluginLibass:destroy') -}) diff --git a/docs/assets/js/common.js b/docs/assets/js/common.js index 3f447ac77..6d8dd0d0d 100644 --- a/docs/assets/js/common.js +++ b/docs/assets/js/common.js @@ -58,7 +58,6 @@ './assets/ts/artplayer-plugin-dash-control.d.ts', './assets/ts/artplayer-plugin-hls-control.d.ts', './assets/ts/artplayer-plugin-iframe.d.ts', - './assets/ts/artplayer-plugin-libass.d.ts', './assets/ts/artplayer-plugin-multiple-subtitles.d.ts', './assets/ts/artplayer-plugin-vast.d.ts', './assets/ts/artplayer-plugin-vtt-thumbnail.d.ts', diff --git a/docs/compiled/artplayer-plugin-libass.js b/docs/compiled/artplayer-plugin-libass.js deleted file mode 100644 index 7606bb652..000000000 --- a/docs/compiled/artplayer-plugin-libass.js +++ /dev/null @@ -1,8 +0,0 @@ - -/*! - * artplayer-plugin-libass.js v1.0.0 - * Github: https://github.com/zhw2590582/ArtPlayer - * (c) 2017-2026 Harvey Zack - * Released under the MIT License. - */ -!function(e,t,r,s,n,a,i,o){var l="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},c="function"==typeof l[s]&&l[s],d=c.i||{},u=c.cache||{},v="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function f(t,r){if(!u[t]){if(!e[t]){if(n[t])return n[t];var a="function"==typeof l[s]&&l[s];if(!r&&a)return a(t,!0);if(c)return c(t,!0);if(v&&"string"==typeof t)return v(t);var i=Error("Cannot find module '"+t+"'");throw i.code="MODULE_NOT_FOUND",i}d.resolve=function(r){var s=e[t][1][r];return null!=s?s:r},d.cache={};var o=u[t]=new f.Module(t);e[t][0].call(o.exports,d,o,o.exports,l)}return u[t].exports;function d(e){var t=d.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var r={__esModule:!0};return t.forEach(function(e){var t=e[0],s=e[1],n=e[2]||e[0],a=f(s);"*"===t?Object.keys(a).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(r,e)||Object.defineProperty(r,e,{enumerable:!0,get:function(){return a[e]}})}):"*"===n?Object.defineProperty(r,t,{enumerable:!0,value:a}):Object.defineProperty(r,t,{enumerable:!0,get:function(){return"default"===n?a.__esModule?a.default:a:a[n]}})}),r}return f(t)}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.require=v,this.exports={}},f.modules=e,f.cache=u,f.parent=c,f.distDir=void 0,f.publicUrl=void 0,f.devServer=void 0,f.i=d,f.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(f,"root",{get:function(){return l[s]}}),l[s]=f;for(var h=0;htypeof module?module.exports=m:"function"==typeof define&&define.amd&&define(function(){return m})}}({"9G2Gn":[function(e,t,r,s){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r),n.export(r,"default",()=>o);var a=e("./adapter"),i=n.interopDefault(a);function o(e){return t=>{let r=new(0,i.default)(t,e);return{name:"artplayerPluginLibass",libass:r.libass,visible:r.visible,init:r.init.bind(r),switch:r.switch.bind(r),show:r.show.bind(r),hide:r.hide.bind(r),destroy:r.destroy.bind(r)}}}"u">typeof window&&(window.artplayerPluginLibass=o)},{"./adapter":"aO4ju","@parcel/transformer-js/src/esmodule-helpers.js":"6ykb1"}],aO4ju:[function(e,t,r,s){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r);var a=e("libass-wasm"),i=n.interopDefault(a);let o=`[Script Info] ScriptType: v4.00+`;r.default=class{constructor(e,t){const{constructor:r,template:s}=e;this.art=e,this.$video=s.$video,this.$webvtt=s.$subtitle,this.utils=r.utils,this.libass=null,e.once("ready",this.init.bind(this,t))}async init(e){this.#e(),await this.#t(e),this.#r(),this.art.emit("artplayerPluginLibass:init",this);let t=this.art?.option?.subtitle?.url;t&&"ass"===this.utils.getExt(t)&&this.switch(t)}switch(e){this.art.emit("artplayerPluginLibass:switch",e),e&&"ass"===this.utils.getExt(e)?(this.currentType="ass",this.libass.freeTrack(),this.libass.setTrackByUrl(this.#s(e)),this.visible=this.art.subtitle.show):(this.currentType="webvtt",this.hide(),this.libass.freeTrack())}setVisibility(e){this.visible=e}setOffset(e){this.timeOffset=e}get active(){return"ass"===this.currentType}get visible(){return!!this.libass&&"none"!==this.libass.canvasParent.style.display}set visible(e){this.art.emit("artplayerPluginLibass:visible",e),this.#n(!this.active),this.libass.canvasParent&&(this.libass.canvasParent.style.display=e?"block":"none",e&&this.libass.resize())}get timeOffset(){return this.libass.timeOffset}set timeOffset(e){this.art.emit("artplayerPluginLibass:timeOffset",e),this.libass.timeOffset=e}show(){this.visible=!0}hide(){this.visible=!1}destroy(){this.art.emit("artplayerPluginLibass:destroy"),this.#a(),this.libass.dispose(),URL.revokeObjectURL(this.workerScriptUrl),this.libass=null}async #t(e={}){if(!e.fallbackFont)return this.utils.errorHandle(e.fallbackFont,"artplayerPluginLibass: fallbackFont is required");e.workerUrl||(e.workerUrl="https://cdnjs.cloudflare.com/ajax/libs/libass-wasm/4.1.0/js/subtitles-octopus-worker.js"),e.availableFonts&&(e.availableFonts=Object.entries(e.availableFonts).reduce((e,[t,r])=>(e[t]=this.#s(r),e),{})),this.libass=new(0,i.default)({subContent:o,video:this.$video,...e,workerUrl:await this.#i(e),fallbackFont:this.#s(e.fallbackFont),fonts:e.fonts?.map(e=>this.#s(e))}),this.libass.canvasParent.className="artplayer-plugin-libass",this.libass.canvasParent.style.cssText=` position: absolute; top: 0; left: 0; width: 100%; height: 100%; user-select: none; pointer-events: none; z-index: 20;`}#r(){this.switchHandler=this.switch.bind(this),this.visibleHandler=this.setVisibility.bind(this),this.offsetHandler=this.setOffset.bind(this),this.art.on("subtitle",this.visibleHandler),this.art.on("subtitleLoad",this.switchHandler),this.art.on("subtitleOffset",this.offsetHandler),this.art.once("destroy",this.destroy.bind(this))}#a(){this.art.off("subtitle",this.visibleHandler),this.art.off("subtitleLoad",this.switchHandler),this.art.off("subtitleOffset",this.offsetHandler)}#n(e){this.$webvtt.style.visibility=e?"visible":"hidden"}#s(e){return this.#o(e)?e:new URL(e,document.baseURI).toString()}#o(e){return/^https?:\/\//.test(e)}#i({workerUrl:e,wasmUrl:t}){return new Promise(r=>{fetch(e).then(e=>e.text()).then(s=>{let n=s,a=new Blob([n=n.replace(/wasmBinaryFile\s*=\s*"(subtitles-octopus-worker\.wasm)"/g,(r,s)=>(t=t?this.#s(t):new URL(s,e).toString(),`wasmBinaryFile = "${t}"`))],{type:"text/javascript"});r(URL.createObjectURL(a))})})}#e(){let e=!1;try{if("object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate){let t=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));t instanceof WebAssembly.Module&&(e=new WebAssembly.Instance(t)instanceof WebAssembly.Instance)}}catch(t){console.error("WebAssembly is not supported in this browser.",t),e=!1}this.utils.errorHandle(e,"Browser does not support WebAssembly")}}},{"libass-wasm":"j2WPP","@parcel/transformer-js/src/esmodule-helpers.js":"6ykb1"}],j2WPP:[function(e,t,r,s){"use strict";"function"==typeof SubtitlesOctopusOnLoad&&SubtitlesOctopusOnLoad(),t.exports&&(t.exports=function(e){var t=!1;try{if("object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate){let e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));e instanceof WebAssembly.Module&&(t=new WebAssembly.Instance(e)instanceof WebAssembly.Instance)}}catch(e){}console.log("WebAssembly support detected: "+(t?"yes":"no"));var r=this;function s(){r.setCurrentTime(r.video.currentTime+r.timeOffset)}function n(){r.setIsPaused(!1,r.video.currentTime+r.timeOffset)}function a(){r.setIsPaused(!0,r.video.currentTime+r.timeOffset)}function i(){r.video.removeEventListener("timeupdate",s,!1)}function o(){r.video.addEventListener("timeupdate",s,!1);var e=r.video.currentTime+r.timeOffset;r.setCurrentTime(e)}function l(){r.setRate(r.video.playbackRate)}function c(){r.setIsPaused(!0,r.video.currentTime+r.timeOffset)}function d(e){e.target.removeEventListener(e.type,d,!1),r.resize()}function u(){var e=r.renderFramesData,t=performance.now();r.ctx.clearRect(0,0,r.canvas.width,r.canvas.height);for(var s=0;s=1?a[i]:1;var o=new ImageData(a,n.w,n.h);r.bufferCanvasCtx.putImageData(o,0,0),r.ctx.drawImage(r.bufferCanvas,n.x,n.y)}if(r.debug){var l=Math.round(performance.now()-t),c=e.blendTime;void 0!==c?console.log("render: "+Math.round(e.spentTime-c)+" ms, blend: "+Math.round(c)+" ms, draw: "+l+" ms; TOTAL="+Math.round(e.spentTime+l)+" ms"):console.log(Math.round(e.spentTime)+" ms (+ "+l+" ms draw)"),r.renderStart=performance.now()}}function v(){var e=r.renderFramesData,t=performance.now();r.ctx.clearRect(0,0,r.canvas.width,r.canvas.height);for(var s=0;stypeof ResizeObserver&&(r.ro=new ResizeObserver(r.resizeWithTimeout),r.ro.observe(r.video)),r.video.videoWidth>0?r.resize():r.video.addEventListener("loadedmetadata",d,!1))},r.getVideoPosition=function(){var e=r.video.videoWidth/r.video.videoHeight,t=r.video.offsetWidth,s=r.video.offsetHeight,n=t,a=s;t/s>e?n=Math.floor(s*e):a=Math.floor(t/e);var i=(t-n)/2,o=(s-a)/2;return{width:n,height:a,x:i,y:o}},r.setSubUrl=function(e){r.subUrl=e},r.renderFrameData=null,r.workerActive=!1,r.frameId=0,r.onWorkerMessage=function(e){!r.workerActive&&(r.workerActive=!0,r.onReadyEvent&&r.onReadyEvent());var t=e.data;switch(t.target){case"stdout":console.log(t.content);break;case"console-log":console.log.apply(console,JSON.parse(t.content));break;case"console-debug":console.debug.apply(console,JSON.parse(t.content));break;case"console-info":console.info.apply(console,JSON.parse(t.content));break;case"console-warn":console.warn.apply(console,JSON.parse(t.content));break;case"console-error":console.error.apply(console,JSON.parse(t.content));break;case"stderr":console.error(t.content);break;case"window":window[t.method]();break;case"canvas":switch(t.op){case"getContext":r.ctx=r.canvas.getContext(t.type,t.attributes);break;case"resize":r.resize(t.width,t.height);break;case"renderCanvas":r.lastRenderTime0&&a>r.maxRenderHeight&&(a=r.maxRenderHeight),e*=a/t,t=a}return{width:e,height:t}}((a=r.getVideoPosition()).width*r.pixelRatio,a.height*r.pixelRatio);e=i.width,t=i.height;var o=r.canvasParent.getBoundingClientRect().top-r.video.getBoundingClientRect().top;s=a.y-o,n=a.x}if(!e||!t){r.video||console.error("width or height is 0. You should specify width & height for resize.");return}(r.canvas.width!=e||r.canvas.height!=t||r.canvas.style.top!=s||r.canvas.style.left!=n)&&(r.canvas.width=e,r.canvas.height=t,null!=a&&(r.canvasParent.style.position="relative",r.canvas.style.display="block",r.canvas.style.position="absolute",r.canvas.style.width=a.width+"px",r.canvas.style.height=a.height+"px",r.canvas.style.top=s+"px",r.canvas.style.left=n+"px",r.canvas.style.pointerEvents="none"),r.worker.postMessage({target:"canvas",width:r.canvas.width,height:r.canvas.height}))},r.resizeWithTimeout=function(){r.resize(),setTimeout(r.resize,100)},r.runBenchmark=function(){r.worker.postMessage({target:"runBenchmark"})},r.customMessage=function(e,t){t=t||{},r.worker.postMessage({target:"custom",userData:e,preMain:t.preMain})},r.setCurrentTime=function(e){r.worker.postMessage({target:"video",currentTime:e})},r.setTrackByUrl=function(e){r.worker.postMessage({target:"set-track-by-url",url:e})},r.setTrack=function(e){r.worker.postMessage({target:"set-track",content:e})},r.freeTrack=function(e){r.worker.postMessage({target:"free-track"})},r.render=r.setCurrentTime,r.setIsPaused=function(e,t){r.worker.postMessage({target:"video",isPaused:e,currentTime:t})},r.setRate=function(e){r.worker.postMessage({target:"video",rate:e})},r.dispose=function(){r.worker.postMessage({target:"destroy"}),r.worker.terminate(),r.worker.removeEventListener("message",r.onWorkerMessage),r.worker.removeEventListener("error",r.workerError),r.workerActive=!1,r.worker=null,r.video&&(r.video.removeEventListener("timeupdate",s,!1),r.video.removeEventListener("playing",n,!1),r.video.removeEventListener("pause",a,!1),r.video.removeEventListener("seeking",i,!1),r.video.removeEventListener("seeked",o,!1),r.video.removeEventListener("ratechange",l,!1),r.video.removeEventListener("waiting",c,!1),r.video.removeEventListener("loadedmetadata",d,!1),document.removeEventListener("fullscreenchange",r.resizeWithTimeout,!1),document.removeEventListener("mozfullscreenchange",r.resizeWithTimeout,!1),document.removeEventListener("webkitfullscreenchange",r.resizeWithTimeout,!1),document.removeEventListener("msfullscreenchange",r.resizeWithTimeout,!1),window.removeEventListener("resize",r.resizeWithTimeout,!1),r.video.parentNode.removeChild(r.canvasParent),r.video=null),r.ro&&(r.ro.disconnect(),r.ro=null),r.onCustomMessage=null,r.onErrorEvent=null,r.onReadyEvent=null},r.fetchFromWorker=function(e,t,s){try{var n=e.target,a=setTimeout(function(){o(Error("Error: Timeout while try to fetch "+n))},5e3),i=function(e){e.data.target==n&&(t(e.data),r.worker.removeEventListener("message",i),r.worker.removeEventListener("error",o),clearTimeout(a))},o=function(e){s(e),r.worker.removeEventListener("message",i),r.worker.removeEventListener("error",o),clearTimeout(a)};r.worker.addEventListener("message",i),r.worker.addEventListener("error",o),r.worker.postMessage(e)}catch(e){s(e)}},r.createEvent=function(e){r.worker.postMessage({target:"create-event",event:e})},r.getEvents=function(e,t){r.fetchFromWorker({target:"get-events"},function(t){e(t.events)},t)},r.setEvent=function(e,t){r.worker.postMessage({target:"set-event",event:e,index:t})},r.removeEvent=function(e){r.worker.postMessage({target:"remove-event",index:e})},r.createStyle=function(e){r.worker.postMessage({target:"create-style",style:e})},r.getStyles=function(e,t){r.fetchFromWorker({target:"get-styles"},function(t){e(t.styles)},t)},r.setStyle=function(e,t){r.worker.postMessage({target:"set-style",style:e,index:t})},r.removeStyle=function(e){r.worker.postMessage({target:"remove-style",index:e})},r.init()})},{}],"6ykb1":[function(e,t,r,s){r.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},r.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.exportAll=function(e,t){return Object.keys(e).forEach(function(r){"default"===r||"__esModule"===r||Object.prototype.hasOwnProperty.call(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[r]}})}),t},r.export=function(e,t,r){Object.defineProperty(e,t,{enumerable:!0,get:r})}},{}]},["9G2Gn"],"9G2Gn","parcelRequire4dc0",{}); \ No newline at end of file diff --git a/docs/compiled/artplayer-plugin-libass.legacy.js b/docs/compiled/artplayer-plugin-libass.legacy.js deleted file mode 100644 index 9d4ec113f..000000000 --- a/docs/compiled/artplayer-plugin-libass.legacy.js +++ /dev/null @@ -1,8 +0,0 @@ - -/*! - * artplayer-plugin-libass.js v1.0.0 - * Github: https://github.com/zhw2590582/ArtPlayer - * (c) 2017-2026 Harvey Zack - * Released under the MIT License. - */ -!function(e,t,r,n,s,i,a,o){var c="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},l="function"==typeof c[n]&&c[n],u=l.i||{},d=l.cache||{},f="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function h(t,r){if(!d[t]){if(!e[t]){if(s[t])return s[t];var i="function"==typeof c[n]&&c[n];if(!r&&i)return i(t,!0);if(l)return l(t,!0);if(f&&"string"==typeof t)return f(t);var a=Error("Cannot find module '"+t+"'");throw a.code="MODULE_NOT_FOUND",a}u.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},u.cache={};var o=d[t]=new h.Module(t);e[t][0].call(o.exports,u,o,o.exports,c)}return d[t].exports;function u(e){var t=u.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var r={__esModule:!0};return t.forEach(function(e){var t=e[0],n=e[1],s=e[2]||e[0],i=h(n);"*"===t?Object.keys(i).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(r,e)||Object.defineProperty(r,e,{enumerable:!0,get:function(){return i[e]}})}):"*"===s?Object.defineProperty(r,t,{enumerable:!0,value:i}):Object.defineProperty(r,t,{enumerable:!0,get:function(){return"default"===s?i.__esModule?i.default:i:i[s]}})}),r}return h(t)}}h.isParcelRequire=!0,h.Module=function(e){this.id=e,this.bundle=h,this.require=f,this.exports={}},h.modules=e,h.cache=d,h.parent=l,h.distDir=void 0,h.publicUrl=void 0,h.devServer=void 0,h.i=u,h.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(h,"root",{get:function(){return c[n]}}),c[n]=h;for(var v=0;vtypeof module?module.exports=p:"function"==typeof define&&define.amd&&define(function(){return p})}}({"4kqKD":[function(e,t,r,n){var s=e("@parcel/transformer-js/src/esmodule-helpers.js");s.defineInteropFlag(r),s.export(r,"default",function(){return o});var i=e("./adapter"),a=s.interopDefault(i);function o(e){return function(t){var r=new(0,a.default)(t,e);return{name:"artplayerPluginLibass",libass:r.libass,visible:r.visible,init:r.init.bind(r),switch:r.switch.bind(r),show:r.show.bind(r),hide:r.hide.bind(r),destroy:r.destroy.bind(r)}}}"u">typeof window&&(window.artplayerPluginLibass=o)},{"./adapter":"jEGLL","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],jEGLL:[function(e,t,r,n){var s=e("@parcel/transformer-js/src/esmodule-helpers.js");s.defineInteropFlag(r),s.export(r,"default",function(){return L});var i=e("@swc/helpers/cjs/_async_to_generator.cjs"),a=e("@swc/helpers/cjs/_class_call_check.cjs"),o=e("@swc/helpers/cjs/_class_private_method_get.cjs"),c=e("@swc/helpers/cjs/_class_private_method_init.cjs"),l=e("@swc/helpers/cjs/_create_class.cjs"),u=e("@swc/helpers/cjs/_object_spread.cjs"),d=e("@swc/helpers/cjs/_object_spread_props.cjs"),f=e("@swc/helpers/cjs/_sliced_to_array.cjs"),h=e("@swc/helpers/cjs/_type_of.cjs"),v=e("@swc/helpers/cjs/_ts_generator.cjs"),p=e("libass-wasm"),b=s.interopDefault(p),m=new WeakSet,y=new WeakSet,w=new WeakSet,g=new WeakSet,k=new WeakSet,_=new WeakSet,j=new WeakSet,E=new WeakSet,L=function(){"use strict";function e(t,r){(0,a._)(this,e),(0,c._)(this,m),(0,c._)(this,y),(0,c._)(this,w),(0,c._)(this,g),(0,c._)(this,k),(0,c._)(this,_),(0,c._)(this,j),(0,c._)(this,E);var n=t.constructor,s=t.template;this.art=t,this.$video=s.$video,this.$webvtt=s.$subtitle,this.utils=n.utils,this.libass=null,t.once("ready",this.init.bind(this,r))}return(0,l._)(e,[{key:"init",value:function(e){return(0,i._)(function(){var t,r,n,s;return(0,v._)(this,function(i){switch(i.label){case 0:return(0,o._)(this,E,C).call(this),[4,(0,o._)(this,m,O).call(this,e)];case 1:return i.sent(),(0,o._)(this,y,M).call(this),this.art.emit("artplayerPluginLibass:init",this),(s=null==(n=this.art)||null==(r=n.option)||null==(t=r.subtitle)?void 0:t.url)&&"ass"===this.utils.getExt(s)&&this.switch(s),[2]}})}).call(this)}},{key:"switch",value:function(e){this.art.emit("artplayerPluginLibass:switch",e),e&&"ass"===this.utils.getExt(e)?(this.currentType="ass",this.libass.freeTrack(),this.libass.setTrackByUrl((0,o._)(this,k,P).call(this,e)),this.visible=this.art.subtitle.show):(this.currentType="webvtt",this.hide(),this.libass.freeTrack())}},{key:"setVisibility",value:function(e){this.visible=e}},{key:"setOffset",value:function(e){this.timeOffset=e}},{key:"active",get:function(){return"ass"===this.currentType}},{key:"visible",get:function(){return!!this.libass&&"none"!==this.libass.canvasParent.style.display},set:function(e){this.art.emit("artplayerPluginLibass:visible",e),(0,o._)(this,g,T).call(this,!this.active),this.libass.canvasParent&&(this.libass.canvasParent.style.display=e?"block":"none",e&&this.libass.resize())}},{key:"timeOffset",get:function(){return this.libass.timeOffset},set:function(e){this.art.emit("artplayerPluginLibass:timeOffset",e),this.libass.timeOffset=e}},{key:"show",value:function(){this.visible=!0}},{key:"hide",value:function(){this.visible=!1}},{key:"destroy",value:function(){this.art.emit("artplayerPluginLibass:destroy"),(0,o._)(this,w,x).call(this),this.libass.dispose(),URL.revokeObjectURL(this.workerScriptUrl),this.libass=null}}]),e}();function O(){return(0,i._)(function(){var e,t,r,n,s,i,a,c=arguments;return(0,v._)(this,function(l){switch(l.label){case 0:if(e=this,!(t=c.length>0&&void 0!==c[0]?c[0]:{}).fallbackFont)return[2,this.utils.errorHandle(t.fallbackFont,"artplayerPluginLibass: fallbackFont is required")];return t.workerUrl||(t.workerUrl="https://cdnjs.cloudflare.com/ajax/libs/libass-wasm/4.1.0/js/subtitles-octopus-worker.js"),t.availableFonts&&(t.availableFonts=Object.entries(t.availableFonts).reduce(function(t,r){var n=(0,f._)(r,2),s=n[0],i=n[1];return t[s]=(0,o._)(e,k,P).call(e,i),t},{})),n=this,s=b.default.bind,i=[(0,u._)({subContent:"[Script Info]\nScriptType: v4.00+",video:this.$video},t)],a={},[4,(0,o._)(this,j,W).call(this,t)];case 1:return n.libass=new(s.apply(b.default,[void 0,d._.apply(void 0,i.concat([(a.workerUrl=l.sent(),a.fallbackFont=(0,o._)(this,k,P).call(this,t.fallbackFont),a.fonts=null==(r=t.fonts)?void 0:r.map(function(t){return(0,o._)(e,k,P).call(e,t)}),a)]))])),this.libass.canvasParent.className="artplayer-plugin-libass",this.libass.canvasParent.style.cssText="\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n user-select: none;\n pointer-events: none;\n z-index: 20;",[2]}})}).apply(this,arguments)}function M(){this.switchHandler=this.switch.bind(this),this.visibleHandler=this.setVisibility.bind(this),this.offsetHandler=this.setOffset.bind(this),this.art.on("subtitle",this.visibleHandler),this.art.on("subtitleLoad",this.switchHandler),this.art.on("subtitleOffset",this.offsetHandler),this.art.once("destroy",this.destroy.bind(this))}function x(){this.art.off("subtitle",this.visibleHandler),this.art.off("subtitleLoad",this.switchHandler),this.art.off("subtitleOffset",this.offsetHandler)}function T(e){this.$webvtt.style.visibility=e?"visible":"hidden"}function P(e){return(0,o._)(this,_,A).call(this,e)?e:new URL(e,document.baseURI).toString()}function A(e){return/^https?:\/\//.test(e)}function W(e){var t=this,r=e.workerUrl,n=e.wasmUrl;return new Promise(function(e){fetch(r).then(function(e){return e.text()}).then(function(s){var i=s,a=new Blob([i=i.replace(/wasmBinaryFile\s*=\s*"(subtitles-octopus-worker\.wasm)"/g,function(e,s){return n=n?(0,o._)(t,k,P).call(t,n):new URL(s,r).toString(),'wasmBinaryFile = "'.concat(n,'"')})],{type:"text/javascript"});e(URL.createObjectURL(a))})})}function C(){var e=!1;try{if(("u"typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=s){var i=[],a=!0,o=!1;try{for(s=s.call(e);!(a=(r=s.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){o=!0,n=e}finally{try{a||null==s.return||s.return()}finally{if(o)throw n}}return i}}},{}],heYSj:[function(e,t,r,n){"use strict";r._=function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},{}],fh7mx:[function(e,t,r,n){"use strict";var s=e("3ee51b7dc02d0c44");r._=function(e,t){if(e){if("string"==typeof e)return s._(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return s._(e,t)}}},{"3ee51b7dc02d0c44":"1WOAB"}],"1WOAB":[function(e,t,r,n){"use strict";r._=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);rtypeof Symbol&&e.constructor===Symbol?"symbol":typeof e}},{}],eltGh:[function(e,t,r,n){"use strict";r._=function(e,t){var r,n,s,i={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),o=Object.defineProperty;return o(a,"next",{value:c(0)}),o(a,"throw",{value:c(1)}),o(a,"return",{value:c(2)}),"function"==typeof Symbol&&o(a,Symbol.iterator,{value:function(){return this}}),a;function c(o){return function(c){var l=[o,c];if(r)throw TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(i=0)),i;)try{if(r=1,n&&(s=2&l[0]?n.return:l[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,l[1])).done)return s;switch(n=0,s&&(l=[2&l[0],s.value]),l[0]){case 0:case 1:s=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,n=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(s=(s=i.trys).length>0&&s[s.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!s||l[1]>s[0]&&l[1]=1?i[a]:1;var o=new ImageData(i,s.w,s.h);n.bufferCanvasCtx.putImageData(o,0,0),n.ctx.drawImage(n.bufferCanvas,s.x,s.y)}if(n.debug){var c=Math.round(performance.now()-t),l=e.blendTime;void 0!==l?console.log("render: "+Math.round(e.spentTime-l)+" ms, blend: "+Math.round(l)+" ms, draw: "+c+" ms; TOTAL="+Math.round(e.spentTime+c)+" ms"):console.log(Math.round(e.spentTime)+" ms (+ "+c+" ms draw)"),n.renderStart=performance.now()}}function v(){var e=n.renderFramesData,t=performance.now();n.ctx.clearRect(0,0,n.canvas.width,n.canvas.height);for(var r=0;rtypeof ResizeObserver&&(n.ro=new ResizeObserver(n.resizeWithTimeout),n.ro.observe(n.video)),n.video.videoWidth>0?n.resize():n.video.addEventListener("loadedmetadata",f,!1))},n.getVideoPosition=function(){var e=n.video.videoWidth/n.video.videoHeight,t=n.video.offsetWidth,r=n.video.offsetHeight,s=t,i=r;t/r>e?s=Math.floor(r*e):i=Math.floor(t/e);var a=(t-s)/2,o=(r-i)/2;return{width:s,height:i,x:a,y:o}},n.setSubUrl=function(e){n.subUrl=e},n.renderFrameData=null,n.workerActive=!1,n.frameId=0,n.onWorkerMessage=function(e){!n.workerActive&&(n.workerActive=!0,n.onReadyEvent&&n.onReadyEvent());var t=e.data;switch(t.target){case"stdout":console.log(t.content);break;case"console-log":console.log.apply(console,JSON.parse(t.content));break;case"console-debug":console.debug.apply(console,JSON.parse(t.content));break;case"console-info":console.info.apply(console,JSON.parse(t.content));break;case"console-warn":console.warn.apply(console,JSON.parse(t.content));break;case"console-error":console.error.apply(console,JSON.parse(t.content));break;case"stderr":console.error(t.content);break;case"window":window[t.method]();break;case"canvas":switch(t.op){case"getContext":n.ctx=n.canvas.getContext(t.type,t.attributes);break;case"resize":n.resize(t.width,t.height);break;case"renderCanvas":n.lastRenderTime0&&i>n.maxRenderHeight&&(i=n.maxRenderHeight),e*=i/t,t=i}return{width:e,height:t}}((i=n.getVideoPosition()).width*n.pixelRatio,i.height*n.pixelRatio);e=a.width,t=a.height;var o=n.canvasParent.getBoundingClientRect().top-n.video.getBoundingClientRect().top;r=i.y-o,s=i.x}if(!e||!t){n.video||console.error("width or height is 0. You should specify width & height for resize.");return}(n.canvas.width!=e||n.canvas.height!=t||n.canvas.style.top!=r||n.canvas.style.left!=s)&&(n.canvas.width=e,n.canvas.height=t,null!=i&&(n.canvasParent.style.position="relative",n.canvas.style.display="block",n.canvas.style.position="absolute",n.canvas.style.width=i.width+"px",n.canvas.style.height=i.height+"px",n.canvas.style.top=r+"px",n.canvas.style.left=s+"px",n.canvas.style.pointerEvents="none"),n.worker.postMessage({target:"canvas",width:n.canvas.width,height:n.canvas.height}))},n.resizeWithTimeout=function(){n.resize(),setTimeout(n.resize,100)},n.runBenchmark=function(){n.worker.postMessage({target:"runBenchmark"})},n.customMessage=function(e,t){t=t||{},n.worker.postMessage({target:"custom",userData:e,preMain:t.preMain})},n.setCurrentTime=function(e){n.worker.postMessage({target:"video",currentTime:e})},n.setTrackByUrl=function(e){n.worker.postMessage({target:"set-track-by-url",url:e})},n.setTrack=function(e){n.worker.postMessage({target:"set-track",content:e})},n.freeTrack=function(e){n.worker.postMessage({target:"free-track"})},n.render=n.setCurrentTime,n.setIsPaused=function(e,t){n.worker.postMessage({target:"video",isPaused:e,currentTime:t})},n.setRate=function(e){n.worker.postMessage({target:"video",rate:e})},n.dispose=function(){n.worker.postMessage({target:"destroy"}),n.worker.terminate(),n.worker.removeEventListener("message",n.onWorkerMessage),n.worker.removeEventListener("error",n.workerError),n.workerActive=!1,n.worker=null,n.video&&(n.video.removeEventListener("timeupdate",i,!1),n.video.removeEventListener("playing",a,!1),n.video.removeEventListener("pause",o,!1),n.video.removeEventListener("seeking",c,!1),n.video.removeEventListener("seeked",l,!1),n.video.removeEventListener("ratechange",u,!1),n.video.removeEventListener("waiting",d,!1),n.video.removeEventListener("loadedmetadata",f,!1),document.removeEventListener("fullscreenchange",n.resizeWithTimeout,!1),document.removeEventListener("mozfullscreenchange",n.resizeWithTimeout,!1),document.removeEventListener("webkitfullscreenchange",n.resizeWithTimeout,!1),document.removeEventListener("msfullscreenchange",n.resizeWithTimeout,!1),window.removeEventListener("resize",n.resizeWithTimeout,!1),n.video.parentNode.removeChild(n.canvasParent),n.video=null),n.ro&&(n.ro.disconnect(),n.ro=null),n.onCustomMessage=null,n.onErrorEvent=null,n.onReadyEvent=null},n.fetchFromWorker=function(e,t,r){try{var s=e.target,i=setTimeout(function(){o(Error("Error: Timeout while try to fetch "+s))},5e3),a=function(e){e.data.target==s&&(t(e.data),n.worker.removeEventListener("message",a),n.worker.removeEventListener("error",o),clearTimeout(i))},o=function(e){r(e),n.worker.removeEventListener("message",a),n.worker.removeEventListener("error",o),clearTimeout(i)};n.worker.addEventListener("message",a),n.worker.addEventListener("error",o),n.worker.postMessage(e)}catch(e){r(e)}},n.createEvent=function(e){n.worker.postMessage({target:"create-event",event:e})},n.getEvents=function(e,t){n.fetchFromWorker({target:"get-events"},function(t){e(t.events)},t)},n.setEvent=function(e,t){n.worker.postMessage({target:"set-event",event:e,index:t})},n.removeEvent=function(e){n.worker.postMessage({target:"remove-event",index:e})},n.createStyle=function(e){n.worker.postMessage({target:"create-style",style:e})},n.getStyles=function(e,t){n.fetchFromWorker({target:"get-styles"},function(t){e(t.styles)},t)},n.setStyle=function(e,t){n.worker.postMessage({target:"set-style",style:e,index:t})},n.removeStyle=function(e){n.worker.postMessage({target:"remove-style",index:e})},n.init()})},{"@swc/helpers/cjs/_type_of.cjs":"iXhRw"}],qpMMf:[function(e,t,r,n){r.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},r.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.exportAll=function(e,t){return Object.keys(e).forEach(function(r){"default"===r||"__esModule"===r||Object.prototype.hasOwnProperty.call(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[r]}})}),t},r.export=function(e,t,r){Object.defineProperty(e,t,{enumerable:!0,get:r})}},{}]},["4kqKD"],"4kqKD","parcelRequire4dc0",{}); \ No newline at end of file diff --git a/docs/compiled/artplayer-plugin-libass.mjs b/docs/compiled/artplayer-plugin-libass.mjs deleted file mode 100644 index 87389404f..000000000 --- a/docs/compiled/artplayer-plugin-libass.mjs +++ /dev/null @@ -1,8 +0,0 @@ - -/*! - * artplayer-plugin-libass.js v1.0.0 - * Github: https://github.com/zhw2590582/ArtPlayer - * (c) 2017-2026 Harvey Zack - * Released under the MIT License. - */ -!function(e,t,r,s,a,i,n,o){var l="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},c="function"==typeof l[s]&&l[s],d=c.i||{},u=c.cache||{},v="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function f(t,r){if(!u[t]){if(!e[t]){if(a[t])return a[t];var i="function"==typeof l[s]&&l[s];if(!r&&i)return i(t,!0);if(c)return c(t,!0);if(v&&"string"==typeof t)return v(t);var n=Error("Cannot find module '"+t+"'");throw n.code="MODULE_NOT_FOUND",n}d.resolve=function(r){var s=e[t][1][r];return null!=s?s:r},d.cache={};var o=u[t]=new f.Module(t);e[t][0].call(o.exports,d,o,o.exports,l)}return u[t].exports;function d(e){var t=d.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var r={__esModule:!0};return t.forEach(function(e){var t=e[0],s=e[1],a=e[2]||e[0],i=f(s);"*"===t?Object.keys(i).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(r,e)||Object.defineProperty(r,e,{enumerable:!0,get:function(){return i[e]}})}):"*"===a?Object.defineProperty(r,t,{enumerable:!0,value:i}):Object.defineProperty(r,t,{enumerable:!0,get:function(){return"default"===a?i.__esModule?i.default:i:i[a]}})}),r}return f(t)}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.require=v,this.exports={}},f.modules=e,f.cache=u,f.parent=c,f.distDir=void 0,f.publicUrl=void 0,f.devServer=void 0,f.i=d,f.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(f,"root",{get:function(){return l[s]}}),l[s]=f;for(var h=0;htypeof module?module.exports=m:"function"==typeof define&&define.amd&&define(function(){return m})}}({hSedR:[function(e,t,r,s){var a=e("@parcel/transformer-js/src/esmodule-helpers.js");a.defineInteropFlag(r),a.export(r,"default",()=>o);var i=e("./adapter"),n=a.interopDefault(i);function o(e){return t=>{let r=new(0,n.default)(t,e);return{name:"artplayerPluginLibass",libass:r.libass,visible:r.visible,init:r.init.bind(r),switch:r.switch.bind(r),show:r.show.bind(r),hide:r.hide.bind(r),destroy:r.destroy.bind(r)}}}"u">typeof window&&(window.artplayerPluginLibass=o)},{"./adapter":"ba6AI","@parcel/transformer-js/src/esmodule-helpers.js":"loqXi"}],ba6AI:[function(e,t,r,s){var a=e("@parcel/transformer-js/src/esmodule-helpers.js");a.defineInteropFlag(r);var i=e("libass-wasm"),n=a.interopDefault(i);let o=`[Script Info] ScriptType: v4.00+`;r.default=class{constructor(e,t){let{constructor:r,template:s}=e;this.art=e,this.$video=s.$video,this.$webvtt=s.$subtitle,this.utils=r.utils,this.libass=null,e.once("ready",this.init.bind(this,t))}async init(e){this.#e(),await this.#t(e),this.#r(),this.art.emit("artplayerPluginLibass:init",this);let t=this.art?.option?.subtitle?.url;t&&"ass"===this.utils.getExt(t)&&this.switch(t)}switch(e){this.art.emit("artplayerPluginLibass:switch",e),e&&"ass"===this.utils.getExt(e)?(this.currentType="ass",this.libass.freeTrack(),this.libass.setTrackByUrl(this.#s(e)),this.visible=this.art.subtitle.show):(this.currentType="webvtt",this.hide(),this.libass.freeTrack())}setVisibility(e){this.visible=e}setOffset(e){this.timeOffset=e}get active(){return"ass"===this.currentType}get visible(){return!!this.libass&&"none"!==this.libass.canvasParent.style.display}set visible(e){this.art.emit("artplayerPluginLibass:visible",e),this.#a(!this.active),this.libass.canvasParent&&(this.libass.canvasParent.style.display=e?"block":"none",e&&this.libass.resize())}get timeOffset(){return this.libass.timeOffset}set timeOffset(e){this.art.emit("artplayerPluginLibass:timeOffset",e),this.libass.timeOffset=e}show(){this.visible=!0}hide(){this.visible=!1}destroy(){this.art.emit("artplayerPluginLibass:destroy"),this.#i(),this.libass.dispose(),URL.revokeObjectURL(this.workerScriptUrl),this.libass=null}async #t(e={}){if(!e.fallbackFont)return this.utils.errorHandle(e.fallbackFont,"artplayerPluginLibass: fallbackFont is required");e.workerUrl||(e.workerUrl="https://cdnjs.cloudflare.com/ajax/libs/libass-wasm/4.1.0/js/subtitles-octopus-worker.js"),e.availableFonts&&(e.availableFonts=Object.entries(e.availableFonts).reduce((e,[t,r])=>(e[t]=this.#s(r),e),{})),this.libass=new(0,n.default)({subContent:o,video:this.$video,...e,workerUrl:await this.#n(e),fallbackFont:this.#s(e.fallbackFont),fonts:e.fonts?.map(e=>this.#s(e))}),this.libass.canvasParent.className="artplayer-plugin-libass",this.libass.canvasParent.style.cssText=` position: absolute; top: 0; left: 0; width: 100%; height: 100%; user-select: none; pointer-events: none; z-index: 20;`}#r(){this.switchHandler=this.switch.bind(this),this.visibleHandler=this.setVisibility.bind(this),this.offsetHandler=this.setOffset.bind(this),this.art.on("subtitle",this.visibleHandler),this.art.on("subtitleLoad",this.switchHandler),this.art.on("subtitleOffset",this.offsetHandler),this.art.once("destroy",this.destroy.bind(this))}#i(){this.art.off("subtitle",this.visibleHandler),this.art.off("subtitleLoad",this.switchHandler),this.art.off("subtitleOffset",this.offsetHandler)}#a(e){this.$webvtt.style.visibility=e?"visible":"hidden"}#s(e){return this.#o(e)?e:new URL(e,document.baseURI).toString()}#o(e){return/^https?:\/\//.test(e)}#n({workerUrl:e,wasmUrl:t}){return new Promise(r=>{fetch(e).then(e=>e.text()).then(s=>{let a=s,i=new Blob([a=a.replace(/wasmBinaryFile\s*=\s*"(subtitles-octopus-worker\.wasm)"/g,(r,s)=>(t=t?this.#s(t):new URL(s,e).toString(),`wasmBinaryFile = "${t}"`))],{type:"text/javascript"});r(URL.createObjectURL(i))})})}#e(){let e=!1;try{if("object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate){let t=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));t instanceof WebAssembly.Module&&(e=new WebAssembly.Instance(t)instanceof WebAssembly.Instance)}}catch(t){console.error("WebAssembly is not supported in this browser.",t),e=!1}this.utils.errorHandle(e,"Browser does not support WebAssembly")}}},{"libass-wasm":"k2X1g","@parcel/transformer-js/src/esmodule-helpers.js":"loqXi"}],k2X1g:[function(e,t,r,s){"function"==typeof SubtitlesOctopusOnLoad&&SubtitlesOctopusOnLoad(),t.exports&&(t.exports=function(e){var t=!1;try{if("object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate){let e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));e instanceof WebAssembly.Module&&(t=new WebAssembly.Instance(e)instanceof WebAssembly.Instance)}}catch(e){}console.log("WebAssembly support detected: "+(t?"yes":"no"));var r=this;function s(){r.setCurrentTime(r.video.currentTime+r.timeOffset)}function a(){r.setIsPaused(!1,r.video.currentTime+r.timeOffset)}function i(){r.setIsPaused(!0,r.video.currentTime+r.timeOffset)}function n(){r.video.removeEventListener("timeupdate",s,!1)}function o(){r.video.addEventListener("timeupdate",s,!1);var e=r.video.currentTime+r.timeOffset;r.setCurrentTime(e)}function l(){r.setRate(r.video.playbackRate)}function c(){r.setIsPaused(!0,r.video.currentTime+r.timeOffset)}function d(e){e.target.removeEventListener(e.type,d,!1),r.resize()}function u(){var e=r.renderFramesData,t=performance.now();r.ctx.clearRect(0,0,r.canvas.width,r.canvas.height);for(var s=0;s=1?i[n]:1;var o=new ImageData(i,a.w,a.h);r.bufferCanvasCtx.putImageData(o,0,0),r.ctx.drawImage(r.bufferCanvas,a.x,a.y)}if(r.debug){var l=Math.round(performance.now()-t),c=e.blendTime;void 0!==c?console.log("render: "+Math.round(e.spentTime-c)+" ms, blend: "+Math.round(c)+" ms, draw: "+l+" ms; TOTAL="+Math.round(e.spentTime+l)+" ms"):console.log(Math.round(e.spentTime)+" ms (+ "+l+" ms draw)"),r.renderStart=performance.now()}}function v(){var e=r.renderFramesData,t=performance.now();r.ctx.clearRect(0,0,r.canvas.width,r.canvas.height);for(var s=0;stypeof ResizeObserver&&(r.ro=new ResizeObserver(r.resizeWithTimeout),r.ro.observe(r.video)),r.video.videoWidth>0?r.resize():r.video.addEventListener("loadedmetadata",d,!1))},r.getVideoPosition=function(){var e=r.video.videoWidth/r.video.videoHeight,t=r.video.offsetWidth,s=r.video.offsetHeight,a=t,i=s;t/s>e?a=Math.floor(s*e):i=Math.floor(t/e);var n=(t-a)/2,o=(s-i)/2;return{width:a,height:i,x:n,y:o}},r.setSubUrl=function(e){r.subUrl=e},r.renderFrameData=null,r.workerActive=!1,r.frameId=0,r.onWorkerMessage=function(e){!r.workerActive&&(r.workerActive=!0,r.onReadyEvent&&r.onReadyEvent());var t=e.data;switch(t.target){case"stdout":console.log(t.content);break;case"console-log":console.log.apply(console,JSON.parse(t.content));break;case"console-debug":console.debug.apply(console,JSON.parse(t.content));break;case"console-info":console.info.apply(console,JSON.parse(t.content));break;case"console-warn":console.warn.apply(console,JSON.parse(t.content));break;case"console-error":console.error.apply(console,JSON.parse(t.content));break;case"stderr":console.error(t.content);break;case"window":window[t.method]();break;case"canvas":switch(t.op){case"getContext":r.ctx=r.canvas.getContext(t.type,t.attributes);break;case"resize":r.resize(t.width,t.height);break;case"renderCanvas":r.lastRenderTime0&&i>r.maxRenderHeight&&(i=r.maxRenderHeight),e*=i/t,t=i}return{width:e,height:t}}((i=r.getVideoPosition()).width*r.pixelRatio,i.height*r.pixelRatio);e=n.width,t=n.height;var o=r.canvasParent.getBoundingClientRect().top-r.video.getBoundingClientRect().top;s=i.y-o,a=i.x}if(!e||!t){r.video||console.error("width or height is 0. You should specify width & height for resize.");return}(r.canvas.width!=e||r.canvas.height!=t||r.canvas.style.top!=s||r.canvas.style.left!=a)&&(r.canvas.width=e,r.canvas.height=t,null!=i&&(r.canvasParent.style.position="relative",r.canvas.style.display="block",r.canvas.style.position="absolute",r.canvas.style.width=i.width+"px",r.canvas.style.height=i.height+"px",r.canvas.style.top=s+"px",r.canvas.style.left=a+"px",r.canvas.style.pointerEvents="none"),r.worker.postMessage({target:"canvas",width:r.canvas.width,height:r.canvas.height}))},r.resizeWithTimeout=function(){r.resize(),setTimeout(r.resize,100)},r.runBenchmark=function(){r.worker.postMessage({target:"runBenchmark"})},r.customMessage=function(e,t){t=t||{},r.worker.postMessage({target:"custom",userData:e,preMain:t.preMain})},r.setCurrentTime=function(e){r.worker.postMessage({target:"video",currentTime:e})},r.setTrackByUrl=function(e){r.worker.postMessage({target:"set-track-by-url",url:e})},r.setTrack=function(e){r.worker.postMessage({target:"set-track",content:e})},r.freeTrack=function(e){r.worker.postMessage({target:"free-track"})},r.render=r.setCurrentTime,r.setIsPaused=function(e,t){r.worker.postMessage({target:"video",isPaused:e,currentTime:t})},r.setRate=function(e){r.worker.postMessage({target:"video",rate:e})},r.dispose=function(){r.worker.postMessage({target:"destroy"}),r.worker.terminate(),r.worker.removeEventListener("message",r.onWorkerMessage),r.worker.removeEventListener("error",r.workerError),r.workerActive=!1,r.worker=null,r.video&&(r.video.removeEventListener("timeupdate",s,!1),r.video.removeEventListener("playing",a,!1),r.video.removeEventListener("pause",i,!1),r.video.removeEventListener("seeking",n,!1),r.video.removeEventListener("seeked",o,!1),r.video.removeEventListener("ratechange",l,!1),r.video.removeEventListener("waiting",c,!1),r.video.removeEventListener("loadedmetadata",d,!1),document.removeEventListener("fullscreenchange",r.resizeWithTimeout,!1),document.removeEventListener("mozfullscreenchange",r.resizeWithTimeout,!1),document.removeEventListener("webkitfullscreenchange",r.resizeWithTimeout,!1),document.removeEventListener("msfullscreenchange",r.resizeWithTimeout,!1),window.removeEventListener("resize",r.resizeWithTimeout,!1),r.video.parentNode.removeChild(r.canvasParent),r.video=null),r.ro&&(r.ro.disconnect(),r.ro=null),r.onCustomMessage=null,r.onErrorEvent=null,r.onReadyEvent=null},r.fetchFromWorker=function(e,t,s){try{var a=e.target,i=setTimeout(function(){o(Error("Error: Timeout while try to fetch "+a))},5e3),n=function(e){e.data.target==a&&(t(e.data),r.worker.removeEventListener("message",n),r.worker.removeEventListener("error",o),clearTimeout(i))},o=function(e){s(e),r.worker.removeEventListener("message",n),r.worker.removeEventListener("error",o),clearTimeout(i)};r.worker.addEventListener("message",n),r.worker.addEventListener("error",o),r.worker.postMessage(e)}catch(e){s(e)}},r.createEvent=function(e){r.worker.postMessage({target:"create-event",event:e})},r.getEvents=function(e,t){r.fetchFromWorker({target:"get-events"},function(t){e(t.events)},t)},r.setEvent=function(e,t){r.worker.postMessage({target:"set-event",event:e,index:t})},r.removeEvent=function(e){r.worker.postMessage({target:"remove-event",index:e})},r.createStyle=function(e){r.worker.postMessage({target:"create-style",style:e})},r.getStyles=function(e,t){r.fetchFromWorker({target:"get-styles"},function(t){e(t.styles)},t)},r.setStyle=function(e,t){r.worker.postMessage({target:"set-style",style:e,index:t})},r.removeStyle=function(e){r.worker.postMessage({target:"remove-style",index:e})},r.init()})},{}],loqXi:[function(e,t,r,s){r.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},r.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.exportAll=function(e,t){return Object.keys(e).forEach(function(r){"default"===r||"__esModule"===r||Object.prototype.hasOwnProperty.call(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[r]}})}),t},r.export=function(e,t,r){Object.defineProperty(e,t,{enumerable:!0,get:r})}},{}]},["hSedR"],"hSedR","parcelRequire4dc0",{});let{default:e}=parcelRequire4dc0("hSedR");export{e as default}; \ No newline at end of file diff --git a/docs/document/404.html b/docs/document/404.html index a44818d33..a761e862d 100644 --- a/docs/document/404.html +++ b/docs/document/404.html @@ -21,7 +21,7 @@
- + \ No newline at end of file diff --git a/docs/document/advanced/built-in.html b/docs/document/advanced/built-in.html index cc5585bf0..9f90617b7 100644 --- a/docs/document/advanced/built-in.html +++ b/docs/document/advanced/built-in.html @@ -23,7 +23,7 @@ -
Skip to content

高级属性 ​

这里的 高级属性 是指挂载在 实例 的 二级属性,比较少用

option ​

播放器的选项

▶ Run Code
js
var art = new Artplayer({
+    
Skip to content

高级属性 ​

这里的 高级属性 是指挂载在 实例 的 二级属性,比较少用

option ​

播放器的选项

▶ Run Code
js
var art = new Artplayer({
     container: '.artplayer-app',
     url: '/assets/sample/video.mp4',
 });
@@ -217,7 +217,7 @@
 art.on('ready', () => {
     art.plugins.add(myPlugin);
 });
- + \ No newline at end of file diff --git a/docs/document/advanced/class.html b/docs/document/advanced/class.html index 2cd466da9..1d243f203 100644 --- a/docs/document/advanced/class.html +++ b/docs/document/advanced/class.html @@ -23,7 +23,7 @@ -
Skip to content

静态属性 ​

这里的 静态属性 是指挂载在 构造函数 的 一级属性,非常少使用

instances ​

返回全部播放器实例的数组,假如你想同时管理多个播放器的时候,可以用到该属性

▶ Run Code
js
console.info([...Artplayer.instances]);
+    
Skip to content

静态属性 ​

这里的 静态属性 是指挂载在 构造函数 的 一级属性,非常少使用

instances ​

返回全部播放器实例的数组,假如你想同时管理多个播放器的时候,可以用到该属性

▶ Run Code
js
console.info([...Artplayer.instances]);
 
 var art = new Artplayer({
     container: '.artplayer-app',
@@ -31,7 +31,7 @@
 });
 
 console.info([...Artplayer.instances]);

version ​

返回播放器的版本信息

▶ Run Code
js
console.info(Artplayer.version);

env ​

返回播放器的环境变量

▶ Run Code
js
console.info(Artplayer.env);

build ​

返回播放器的打包时间

▶ Run Code
js
console.info(Artplayer.build);

config ​

返回视频的默认配置

▶ Run Code
js
console.info(Artplayer.config);

utils ​

返回播放器的工具函数集合

▶ Run Code
js
console.info(Artplayer.utils);

全部工具函数请参考以下地址:

artplayer/types/utils.d.ts

scheme ​

返回播放器选项的校验方案

▶ Run Code
js
console.info(Artplayer.scheme);

Emitter ​

返回事件分发器的构造函数

▶ Run Code
js
console.info(Artplayer.Emitter);

validator ​

返回选项的校验函数

▶ Run Code
js
console.info(Artplayer.validator);

kindOf ​

返回类型检测的函数工具

▶ Run Code
js
console.info(Artplayer.kindOf);

html ​

返回播放器所需的 html 字符串

▶ Run Code
js
console.info(Artplayer.html);

option ​

返回播放器的默认选项

▶ Run Code
js
console.info(Artplayer.option);
- + \ No newline at end of file diff --git a/docs/document/advanced/event.html b/docs/document/advanced/event.html index 0c0fbce22..3a411d9b0 100644 --- a/docs/document/advanced/event.html +++ b/docs/document/advanced/event.html @@ -23,7 +23,7 @@ -
Skip to content

实例事件 ​

播放器的事件分为两种,一种视频的 原生事件 (前缀 video:),另外一种是 自定义事件

监听事件:

▶ Run Code
js
var art = new Artplayer({
+    
Skip to content

实例事件 ​

播放器的事件分为两种,一种视频的 原生事件 (前缀 video:),另外一种是 自定义事件

监听事件:

▶ Run Code
js
var art = new Artplayer({
     container: '.artplayer-app',
     url: '/assets/sample/video.mp4',
 });
@@ -385,7 +385,7 @@
 art.on('keydown', (event) => {
     console.log(event.code);
 });

video:canplay ​

浏览器可以播放媒体文件了,但估计没有足够的数据来支撑播放到结束,不必停下来进一步缓冲内容

video:canplaythrough ​

浏览器估计它可以在不停止内容缓冲的情况下播放媒体直到结束

video:complete ​

OfflineAudioContext 渲染完成

video:durationchange ​

duration 属性的值改变时触发

video:emptied ​

媒体内容变为空;例如,当这个 media 已经加载完成(或者部分加载完成),则发送此事件,并调用 load() 方法重新加载它

video:ended ​

视频停止播放,因为 media 已经到达结束点

video:error ​

获取媒体数据时出错,或者资源类型不是受支持的媒体格式

video:loadeddata ​

media 中的首帧已经完成加载

video:loadedmetadata ​

已加载元数据

video:pause ​

播放已暂停

video:play ​

播放已开始

video:playing ​

由于缺乏数据而暂停或延迟后,播放准备开始

video:progress ​

在浏览器加载资源时周期性触发

video:ratechange ​

播放速率发生变化

video:seeked ​

跳帧(seek)操作完成

video:seeking ​

跳帧(seek)操作开始

video:stalled ​

用户代理(user agent)正在尝试获取媒体数据,但数据意外未出现

video:suspend ​

媒体数据加载已暂停

video:timeupdate ​

currentTime 属性指定的时间发生变化

video:volumechange ​

音量发生变化

video:waiting ​

由于暂时缺少数据,播放已停止

- + \ No newline at end of file diff --git a/docs/document/advanced/global.html b/docs/document/advanced/global.html index 440446961..59af77be2 100644 --- a/docs/document/advanced/global.html +++ b/docs/document/advanced/global.html @@ -23,7 +23,7 @@ -
Skip to content

全局属性 ​

这里的 全局属性 也是指挂载在 构造函数 的 一级属性,属性名字全部都是大写的形式,未来容易发生变动,基本上用不到

DEBUG ​

是否开始 debug 模式,可以打印出视频全部的内置事件,默认关闭

▶ Run Code
js
Artplayer.DEBUG = true;
+    
Skip to content

全局属性 ​

这里的 全局属性 也是指挂载在 构造函数 的 一级属性,属性名字全部都是大写的形式,未来容易发生变动,基本上用不到

DEBUG ​

是否开始 debug 模式,可以打印出视频全部的内置事件,默认关闭

▶ Run Code
js
Artplayer.DEBUG = true;
 
 var art = new Artplayer({
     container: '.artplayer-app',
@@ -248,7 +248,7 @@
 
 // 只销毁界面,不主动清空 src
 art.destroy();
- + \ No newline at end of file diff --git a/docs/document/advanced/plugin.html b/docs/document/advanced/plugin.html index ccb1c1cd2..26242aeb2 100644 --- a/docs/document/advanced/plugin.html +++ b/docs/document/advanced/plugin.html @@ -23,7 +23,7 @@ -
Skip to content

编写插件 ​

但你已经知道播放器的属性, 方法和事件后,再编写插件是非常简单的事

可以在实例化的时候加载插件的函数

▶ Run Code
js
function myPlugin(art) {
+    
Skip to content

编写插件 ​

但你已经知道播放器的属性, 方法和事件后,再编写插件是非常简单的事

可以在实例化的时候加载插件的函数

▶ Run Code
js
function myPlugin(art) {
     console.info(art);
     return {
         name: 'myPlugin',
@@ -122,7 +122,7 @@
         })
     ],
 });
- + \ No newline at end of file diff --git a/docs/document/advanced/property.html b/docs/document/advanced/property.html index c012569bd..2d3415c7b 100644 --- a/docs/document/advanced/property.html +++ b/docs/document/advanced/property.html @@ -23,7 +23,7 @@ -
Skip to content

实例属性 ​

这里的 实例属性 是指挂载在 实例 的 一级属性,比较常用

play ​

  • Type: Function

播放视频

▶ Run Code
js
var art = new Artplayer({
+    
Skip to content

实例属性 ​

这里的 实例属性 是指挂载在 实例 的 一级属性,比较常用

play ​

  • Type: Function

播放视频

▶ Run Code
js
var art = new Artplayer({
     container: '.artplayer-app',
     url: '/assets/sample/video.mp4',
     muted: true,
@@ -457,7 +457,7 @@
 art.on('ready', () => {
     art.subtitleOffset = 1;
 });
- + \ No newline at end of file diff --git a/docs/document/assets/en_index.md.7shqBtga.js b/docs/document/assets/en_index.md.BCuGsKe-.js similarity index 96% rename from docs/document/assets/en_index.md.7shqBtga.js rename to docs/document/assets/en_index.md.BCuGsKe-.js index 6d1688894..8ee71ce1f 100644 --- a/docs/document/assets/en_index.md.7shqBtga.js +++ b/docs/document/assets/en_index.md.BCuGsKe-.js @@ -1,4 +1,4 @@ -import{_ as i,c as a,o as n,ak as l}from"./chunks/framework.xxfEszSJ.js";const g=JSON.parse('{"title":"Installation & Usage","description":"","frontmatter":{},"headers":[],"relativePath":"en/index.md","filePath":"en/index.md","lastUpdated":1767420511000}'),p={name:"en/index.md"};function t(e,s,h,k,r,E){return n(),a("div",null,s[0]||(s[0]=[l(`

Installation & Usage ​

Installation ​

bash
npm install artplayer
bash
yarn add artplayer
bash
pnpm add artplayer
html
<script src="path/to/artplayer.js"></script>

CDN ​

bash
https://cdn.jsdelivr.net/npm/artplayer/dist/artplayer.js
bash
https://unpkg.com/artplayer/dist/artplayer.js

Usage ​

html
<html>
+import{_ as i,c as a,o as n,ak as l}from"./chunks/framework.xxfEszSJ.js";const g=JSON.parse('{"title":"Installation & Usage","description":"","frontmatter":{},"headers":[],"relativePath":"en/index.md","filePath":"en/index.md","lastUpdated":1767420511000}'),p={name:"en/index.md"};function t(e,s,h,k,r,E){return n(),a("div",null,s[0]||(s[0]=[l(`

Installation & Usage ​

Installation ​

bash
npm install artplayer
bash
yarn add artplayer
bash
pnpm add artplayer
html
<script src="path/to/artplayer.js"></script>

CDN ​

bash
https://cdn.jsdelivr.net/npm/artplayer/dist/artplayer.js
bash
https://unpkg.com/artplayer/dist/artplayer.js

Usage ​

html
<html>
     <head>
         <title>ArtPlayer Demo</title>
         <meta charset="UTF-8" />
@@ -19,7 +19,7 @@ import{_ as i,c as a,o as n,ak as l}from"./chunks/framework.xxfEszSJ.js";const g
           });
         </script>
     </body>
-</html>

Note

The player's dimensions depend on the size of its container container, so your container must have defined dimensions.

See more usage examples at the following link:

/example

Vue.js ​

vue
<template>
+</html>

Note

The player's dimensions depend on the size of its container container, so your container must have defined dimensions.

See more usage examples at the following link:

/example

Vue.js ​

vue
<template>
   <div ref="$container" />
 </template>
 
@@ -51,7 +51,7 @@ import{_ as i,c as a,o as n,ak as l}from"./chunks/framework.xxfEszSJ.js";const g
   art.value.destroy(false)
 })
 </script>
vue
<template>
-  <Artplayer :option="option" :style="style" @get-instance="getInstance" />
+  <Artplayer :option="option" :style="style" @get-instance="getInstance" />
 </template>
 
 <script setup>
@@ -71,7 +71,7 @@ import{_ as i,c as a,o as n,ak as l}from"./chunks/framework.xxfEszSJ.js";const g
 function getInstance(art) {
   console.log(art)
 }
-</script>

Artplayer is not reactive:

Directly modifying option in Vue.js will not update the player.

React.js ​

jsx
import Artplayer from 'artplayer'
+</script>

Artplayer is not reactive:

Directly modifying option in Vue.js will not update the player.

React.js ​

jsx
import Artplayer from 'artplayer'
 import { useEffect, useRef } from 'react'
 
 export default function Player({ option, getInstance, ...rest }) {
@@ -154,7 +154,7 @@ import{_ as i,c as a,o as n,ak as l}from"./chunks/framework.xxfEszSJ.js";const g
 
 option.volume = 0.5;
 
-const art8 = new Artplayer(option);

Legacy Browsers ​

The production build artplayer.js only supports the latest major version of Chrome: last 1 Chrome version

For legacy browsers, you can use the artplayer.legacy.js file, which supports compatibility down to: IE 11

js
import Artplayer from 'artplayer/legacy'
bash
https://cdn.jsdelivr.net/npm/artplayer/dist/artplayer.legacy.js
bash
https://unpkg.com/artplayer/dist/artplayer.legacy.js

If you need to support even older browsers, modify the following configuration and build it yourself:

Build configuration: scripts/build.js

Reference documentation: browserslist

ECMAScript Module ​

Starting from 5.2.6, artplayer and all plugins also provide an ESM version mjs, such as:

  • artplayer/dist/artplayer.mjs
  • artplayer-plugin-danmuku/dist/artplayer-plugin-danmuku.mjs
html
<!DOCTYPE html>
+const art8 = new Artplayer(option);

Legacy Browsers ​

The production build artplayer.js only supports the latest major version of Chrome: last 1 Chrome version

For legacy browsers, you can use the artplayer.legacy.js file, which supports compatibility down to: IE 11

js
import Artplayer from 'artplayer/legacy'
bash
https://cdn.jsdelivr.net/npm/artplayer/dist/artplayer.legacy.js
bash
https://unpkg.com/artplayer/dist/artplayer.legacy.js

If you need to support even older browsers, modify the following configuration and build it yourself:

Build configuration: scripts/build.js

Reference documentation: browserslist

ECMAScript Module ​

Starting from 5.2.6, artplayer and all plugins also provide an ESM version mjs, such as:

  • artplayer/dist/artplayer.mjs
  • artplayer-plugin-danmuku/dist/artplayer-plugin-danmuku.mjs
html
<!DOCTYPE html>
 <html lang="en">
 
 <head>
diff --git a/docs/document/assets/en_index.md.7shqBtga.lean.js b/docs/document/assets/en_index.md.BCuGsKe-.lean.js
similarity index 100%
rename from docs/document/assets/en_index.md.7shqBtga.lean.js
rename to docs/document/assets/en_index.md.BCuGsKe-.lean.js
diff --git a/docs/document/assets/en_start_i18n.md.Br6ZSUj7.js b/docs/document/assets/en_start_i18n.md.Dn_-QNMz.js
similarity index 98%
rename from docs/document/assets/en_start_i18n.md.Br6ZSUj7.js
rename to docs/document/assets/en_start_i18n.md.Dn_-QNMz.js
index 687d193cb..908a230ef 100644
--- a/docs/document/assets/en_start_i18n.md.Br6ZSUj7.js
+++ b/docs/document/assets/en_start_i18n.md.Dn_-QNMz.js
@@ -2,7 +2,7 @@ import{_ as a,c as i,o as n,ak as l}from"./chunks/framework.xxfEszSJ.js";const g
     container: '.artplayer-app',
     url: '/assets/sample/video.mp4',
     lang: 'zh-cn', // or 'en'
-});

Importing Languages ​

Language files before bundling are located at: artplayer/src/i18n/*.js. Contributions to add your language are welcome.

Language files after bundling are located at: artplayer/dist/i18n/*.js

js
import id from 'artplayer/i18n/id';
+});

Importing Languages ​

Language files before bundling are located at: artplayer/src/i18n/*.js. Contributions to add your language are welcome.

Language files after bundling are located at: artplayer/dist/i18n/*.js

js
import id from 'artplayer/i18n/id';
 import zhTw from 'artplayer/i18n/zh-tw';
 
 var art = new Artplayer({
diff --git a/docs/document/assets/en_start_i18n.md.Br6ZSUj7.lean.js b/docs/document/assets/en_start_i18n.md.Dn_-QNMz.lean.js
similarity index 100%
rename from docs/document/assets/en_start_i18n.md.Br6ZSUj7.lean.js
rename to docs/document/assets/en_start_i18n.md.Dn_-QNMz.lean.js
diff --git a/docs/document/assets/index.md.Xug2h4MQ.js b/docs/document/assets/index.md.DDqAV2TW.js
similarity index 96%
rename from docs/document/assets/index.md.Xug2h4MQ.js
rename to docs/document/assets/index.md.DDqAV2TW.js
index a36531137..fb146648f 100644
--- a/docs/document/assets/index.md.Xug2h4MQ.js
+++ b/docs/document/assets/index.md.DDqAV2TW.js
@@ -1,4 +1,4 @@
-import{_ as i,c as a,o as n,ak as l}from"./chunks/framework.xxfEszSJ.js";const g=JSON.parse('{"title":"安装使用","description":"","frontmatter":{},"headers":[],"relativePath":"index.md","filePath":"index.md","lastUpdated":1767420511000}'),p={name:"index.md"};function t(e,s,h,k,r,E){return n(),a("div",null,s[0]||(s[0]=[l(`

安装使用 ​

安装 ​

bash
npm install artplayer
bash
yarn add artplayer
bash
pnpm add artplayer
html
<script src="path/to/artplayer.js"></script>

CDN ​

bash
https://cdn.jsdelivr.net/npm/artplayer/dist/artplayer.js
bash
https://unpkg.com/artplayer/dist/artplayer.js

使用 ​

html
<html>
+import{_ as i,c as a,o as n,ak as l}from"./chunks/framework.xxfEszSJ.js";const g=JSON.parse('{"title":"安装使用","description":"","frontmatter":{},"headers":[],"relativePath":"index.md","filePath":"index.md","lastUpdated":1767420511000}'),p={name:"index.md"};function t(e,s,h,k,r,E){return n(),a("div",null,s[0]||(s[0]=[l(`

安装使用 ​

安装 ​

bash
npm install artplayer
bash
yarn add artplayer
bash
pnpm add artplayer
html
<script src="path/to/artplayer.js"></script>

CDN ​

bash
https://cdn.jsdelivr.net/npm/artplayer/dist/artplayer.js
bash
https://unpkg.com/artplayer/dist/artplayer.js

使用 ​

html
<html>
     <head>
         <title>ArtPlayer Demo</title>
         <meta charset="UTF-8" />
@@ -19,7 +19,7 @@ import{_ as i,c as a,o as n,ak as l}from"./chunks/framework.xxfEszSJ.js";const g
           });
         </script>
     </body>
-</html>

提示

播放器的尺寸依赖于容器 container 的尺寸,所以你的容器 container 必须是有尺寸的

以下链接可以看到更多的使用例子

/example

Vue.js ​

vue
<template>
+</html>

提示

播放器的尺寸依赖于容器 container 的尺寸,所以你的容器 container 必须是有尺寸的

以下链接可以看到更多的使用例子

/example

Vue.js ​

vue
<template>
   <div ref="$container" />
 </template>
 
@@ -51,7 +51,7 @@ import{_ as i,c as a,o as n,ak as l}from"./chunks/framework.xxfEszSJ.js";const g
   art.value.destroy(false)
 })
 </script>
vue
<template>
-  <Artplayer :option="option" :style="style" @get-instance="getInstance" />
+  <Artplayer :option="option" :style="style" @get-instance="getInstance" />
 </template>
 
 <script setup>
@@ -71,7 +71,7 @@ import{_ as i,c as a,o as n,ak as l}from"./chunks/framework.xxfEszSJ.js";const g
 function getInstance(art) {
   console.log(art)
 }
-</script>

Artplayer 非响应式:

在 Vue.js 里直接修改 option 是不会改变播放器的

React.js ​

jsx
import Artplayer from 'artplayer'
+</script>

Artplayer 非响应式:

在 Vue.js 里直接修改 option 是不会改变播放器的

React.js ​

jsx
import Artplayer from 'artplayer'
 import { useEffect, useRef } from 'react'
 
 export default function Player({ option, getInstance, ...rest }) {
@@ -154,7 +154,7 @@ import{_ as i,c as a,o as n,ak as l}from"./chunks/framework.xxfEszSJ.js";const g
 
 option.volume = 0.5;
 
-const art8 = new Artplayer(option);

古老的浏览器 ​

生产构建的 artplayer.js 只兼容最新一个主版本的 Chrome:last 1 Chrome version

对于古老的浏览器,可以使用 artplayer.legacy.js 文件,可以兼容到:IE 11

js
import Artplayer from 'artplayer/legacy'
bash
https://cdn.jsdelivr.net/npm/artplayer/dist/artplayer.legacy.js
bash
https://unpkg.com/artplayer/dist/artplayer.legacy.js

假如你要兼容更古老的浏览器时,请修改以下配置然后自行构建:

构建配置:scripts/build.js

参考文档:browserslist

ECMAScript Module ​

从 5.2.6 开始,artplayer 和所有插件还会提供一个 ESM 版本的 mjs,如:

  • artplayer/dist/artplayer.mjs
  • artplayer-plugin-danmuku/dist/artplayer-plugin-danmuku.mjs
html
<!DOCTYPE html>
+const art8 = new Artplayer(option);

古老的浏览器 ​

生产构建的 artplayer.js 只兼容最新一个主版本的 Chrome:last 1 Chrome version

对于古老的浏览器,可以使用 artplayer.legacy.js 文件,可以兼容到:IE 11

js
import Artplayer from 'artplayer/legacy'
bash
https://cdn.jsdelivr.net/npm/artplayer/dist/artplayer.legacy.js
bash
https://unpkg.com/artplayer/dist/artplayer.legacy.js

假如你要兼容更古老的浏览器时,请修改以下配置然后自行构建:

构建配置:scripts/build.js

参考文档:browserslist

ECMAScript Module ​

从 5.2.6 开始,artplayer 和所有插件还会提供一个 ESM 版本的 mjs,如:

  • artplayer/dist/artplayer.mjs
  • artplayer-plugin-danmuku/dist/artplayer-plugin-danmuku.mjs
html
<!DOCTYPE html>
 <html lang="en">
 
 <head>
diff --git a/docs/document/assets/index.md.Xug2h4MQ.lean.js b/docs/document/assets/index.md.DDqAV2TW.lean.js
similarity index 100%
rename from docs/document/assets/index.md.Xug2h4MQ.lean.js
rename to docs/document/assets/index.md.DDqAV2TW.lean.js
diff --git a/docs/document/assets/plugin_danmuku.md.Dm8aaMVM.js b/docs/document/assets/plugin_danmuku.md.BbwsJDxp.js
similarity index 99%
rename from docs/document/assets/plugin_danmuku.md.Dm8aaMVM.js
rename to docs/document/assets/plugin_danmuku.md.BbwsJDxp.js
index 35f2378f9..6e3c5d779 100644
--- a/docs/document/assets/plugin_danmuku.md.Dm8aaMVM.js
+++ b/docs/document/assets/plugin_danmuku.md.BbwsJDxp.js
@@ -1,4 +1,4 @@
-import{_ as n,c as l,o as p,ak as s,j as i}from"./chunks/framework.xxfEszSJ.js";const y=JSON.parse('{"title":"弹幕库","description":"","frontmatter":{},"headers":[],"relativePath":"plugin/danmuku.md","filePath":"plugin/danmuku.md","lastUpdated":1734270991000}'),h={name:"plugin/danmuku.md"};function e(k,a,t,r,E,d){return p(),l("div",null,a[0]||(a[0]=[s(`

弹幕库 ​

演示 ​

👉 查看完整演示

安装 ​

bash
npm install artplayer-plugin-danmuku
bash
yarn add artplayer-plugin-danmuku
bash
pnpm add artplayer-plugin-danmuku
html
<script src="path/to/artplayer-plugin-danmuku.js"></script>

CDN ​

bash
https://cdn.jsdelivr.net/npm/artplayer-plugin-danmuku/dist/artplayer-plugin-danmuku.js
bash
https://unpkg.com/artplayer-plugin-danmuku/dist/artplayer-plugin-danmuku.js

弹幕结构 ​

每一个弹幕是一个对象,多个弹幕组成的数组就是弹幕库,通常只需要text就可以发送一个弹幕,其余都是非必要参数

js
{
+import{_ as n,c as l,o as p,ak as s,j as i}from"./chunks/framework.xxfEszSJ.js";const y=JSON.parse('{"title":"弹幕库","description":"","frontmatter":{},"headers":[],"relativePath":"plugin/danmuku.md","filePath":"plugin/danmuku.md","lastUpdated":1734270991000}'),h={name:"plugin/danmuku.md"};function e(k,a,t,r,E,d){return p(),l("div",null,a[0]||(a[0]=[s(`

弹幕库 ​

演示 ​

👉 查看完整演示

安装 ​

bash
npm install artplayer-plugin-danmuku
bash
yarn add artplayer-plugin-danmuku
bash
pnpm add artplayer-plugin-danmuku
html
<script src="path/to/artplayer-plugin-danmuku.js"></script>

CDN ​

bash
https://cdn.jsdelivr.net/npm/artplayer-plugin-danmuku/dist/artplayer-plugin-danmuku.js
bash
https://unpkg.com/artplayer-plugin-danmuku/dist/artplayer-plugin-danmuku.js

弹幕结构 ​

每一个弹幕是一个对象,多个弹幕组成的数组就是弹幕库,通常只需要text就可以发送一个弹幕,其余都是非必要参数

js
{
     text: '', // 弹幕文本
     time: 10, // 弹幕时间, 默认为当前播放器时间
     mode: 0, // 弹幕模式: 0: 滚动(默认),1: 顶部,2: 底部
diff --git a/docs/document/assets/plugin_danmuku.md.Dm8aaMVM.lean.js b/docs/document/assets/plugin_danmuku.md.BbwsJDxp.lean.js
similarity index 100%
rename from docs/document/assets/plugin_danmuku.md.Dm8aaMVM.lean.js
rename to docs/document/assets/plugin_danmuku.md.BbwsJDxp.lean.js
diff --git a/docs/document/assets/start_i18n.md.B-KNPVtu.js b/docs/document/assets/start_i18n.md.D9C8Ka0e.js
similarity index 98%
rename from docs/document/assets/start_i18n.md.B-KNPVtu.js
rename to docs/document/assets/start_i18n.md.D9C8Ka0e.js
index 1e1fdac88..4d3080ddb 100644
--- a/docs/document/assets/start_i18n.md.B-KNPVtu.js
+++ b/docs/document/assets/start_i18n.md.D9C8Ka0e.js
@@ -2,7 +2,7 @@ import{_ as a,c as i,o as n,ak as l}from"./chunks/framework.xxfEszSJ.js";const c
     container: '.artplayer-app',
     url: '/assets/sample/video.mp4',
     lang: 'zh-cn', // or 'en'
-});

导入语言 ​

打包前的语言文件存放于: artplayer/src/i18n/*.js, 欢迎来添加你的语言

打包后的语言文件存放于: artplayer/dist/i18n/*.js

js
import id from 'artplayer/i18n/id';
+});

导入语言 ​

打包前的语言文件存放于: artplayer/src/i18n/*.js, 欢迎来添加你的语言

打包后的语言文件存放于: artplayer/dist/i18n/*.js

js
import id from 'artplayer/i18n/id';
 import zhTw from 'artplayer/i18n/zh-tw';
 
 var art = new Artplayer({
diff --git a/docs/document/assets/start_i18n.md.B-KNPVtu.lean.js b/docs/document/assets/start_i18n.md.D9C8Ka0e.lean.js
similarity index 100%
rename from docs/document/assets/start_i18n.md.B-KNPVtu.lean.js
rename to docs/document/assets/start_i18n.md.D9C8Ka0e.lean.js
diff --git a/docs/document/component/contextmenu.html b/docs/document/component/contextmenu.html
index a34ea2dce..732100787 100644
--- a/docs/document/component/contextmenu.html
+++ b/docs/document/component/contextmenu.html
@@ -23,7 +23,7 @@
     
   
   
-    
Skip to content

右键菜单 ​

配置 ​

属性类型描述
disableBoolean是否禁用组件
nameString组件唯一名称,用于标记类名
indexNumber组件索引,用于显示的优先级
htmlString, Element组件的 DOM 元素
styleObject组件样式对象
clickFunction组件点击事件
mountedFunction组件挂载后触发
tooltipString组件的提示文本

创建 ​

▶ Run Code
js
var art = new Artplayer({
+    
Skip to content

右键菜单 ​

配置 ​

属性类型描述
disableBoolean是否禁用组件
nameString组件唯一名称,用于标记类名
indexNumber组件索引,用于显示的优先级
htmlString, Element组件的 DOM 元素
styleObject组件样式对象
clickFunction组件点击事件
mountedFunction组件挂载后触发
tooltipString组件的提示文本

创建 ​

▶ Run Code
js
var art = new Artplayer({
     container: '.artplayer-app',
     url: '/assets/sample/video.mp4',
     contextmenu: [
@@ -106,7 +106,7 @@
         })
     }, 3000);
 });
- + \ No newline at end of file diff --git a/docs/document/component/controls.html b/docs/document/component/controls.html index 91c0e5bd7..95ebd1f3a 100644 --- a/docs/document/component/controls.html +++ b/docs/document/component/controls.html @@ -23,7 +23,7 @@ -
Skip to content

控制器 ​

配置 ​

属性类型描述
disableBoolean是否禁用组件
nameString组件唯一名称,用于标记类名
indexNumber组件索引,用于显示的优先级
htmlString, Element组件的 DOM 元素
styleObject组件样式对象
clickFunction组件点击事件
mountedFunction组件挂载后触发
tooltipString组件的提示文本
positionStringleft 和 right 控制控制器出现的左右位置
selectorArray选择列表的对象数组
onSelectFunction选择列表的元素被点击时触发的函数

创建 ​

▶ Run Code
js
var art = new Artplayer({
+    
Skip to content

控制器 ​

配置 ​

属性类型描述
disableBoolean是否禁用组件
nameString组件唯一名称,用于标记类名
indexNumber组件索引,用于显示的优先级
htmlString, Element组件的 DOM 元素
styleObject组件样式对象
clickFunction组件点击事件
mountedFunction组件挂载后触发
tooltipString组件的提示文本
positionStringleft 和 right 控制控制器出现的左右位置
selectorArray选择列表的对象数组
onSelectFunction选择列表的元素被点击时触发的函数

创建 ​

▶ Run Code
js
var art = new Artplayer({
     container: '.artplayer-app',
     url: '/assets/sample/video.mp4',
     controls: [
@@ -153,7 +153,7 @@
         });
     }, 3000);
 });
- + \ No newline at end of file diff --git a/docs/document/component/layers.html b/docs/document/component/layers.html index 3f181bd9c..9e367480b 100644 --- a/docs/document/component/layers.html +++ b/docs/document/component/layers.html @@ -23,7 +23,7 @@ -
Skip to content

业务层 ​

配置 ​

属性类型描述
disableBoolean是否禁用组件
nameString组件唯一名称,用于标记类名
indexNumber组件索引,用于显示的优先级
htmlString, Element组件的 DOM 元素
styleObject组件样式对象
clickFunction组件点击事件
mountedFunction组件挂载后触发
tooltipString组件的提示文本

创建 ​

▶ Run Code
js
var img = '/assets/sample/layer.png';
+    
Skip to content

业务层 ​

配置 ​

属性类型描述
disableBoolean是否禁用组件
nameString组件唯一名称,用于标记类名
indexNumber组件索引,用于显示的优先级
htmlString, Element组件的 DOM 元素
styleObject组件样式对象
clickFunction组件点击事件
mountedFunction组件挂载后触发
tooltipString组件的提示文本

创建 ​

▶ Run Code
js
var img = '/assets/sample/layer.png';
 var art = new Artplayer({
     container: '.artplayer-app',
     url: '/assets/sample/video.mp4',
@@ -125,7 +125,7 @@
         });
     }, 3000);
 });
- + \ No newline at end of file diff --git a/docs/document/component/setting.html b/docs/document/component/setting.html index 1db05af6b..86783052c 100644 --- a/docs/document/component/setting.html +++ b/docs/document/component/setting.html @@ -23,7 +23,7 @@ -
Skip to content

设置面板 ​

内置 ​

须先打开设置面板,然后自带四个内置项:flip, playbackRate, aspectRatio, subtitleOffset

▶ Run Code
js
var art = new Artplayer({
+    
Skip to content

设置面板 ​

内置 ​

须先打开设置面板,然后自带四个内置项:flip, playbackRate, aspectRatio, subtitleOffset

▶ Run Code
js
var art = new Artplayer({
     container: '.artplayer-app',
     url: '/assets/sample/video.mp4',
 	setting: true,
@@ -245,7 +245,7 @@
         });
     }, 3000);
 });
- + \ No newline at end of file diff --git a/docs/document/en/advanced/built-in.html b/docs/document/en/advanced/built-in.html index 7d3ab56ba..2d6e40d87 100644 --- a/docs/document/en/advanced/built-in.html +++ b/docs/document/en/advanced/built-in.html @@ -23,7 +23,7 @@ -
Skip to content

Advanced Properties ​

The Advanced Properties here refer to the secondary properties attached to the instance, which are less commonly used.

option ​

The player's options.

▶ Run Code
js
var art = new Artplayer({
+    
Skip to content

Advanced Properties ​

The Advanced Properties here refer to the secondary properties attached to the instance, which are less commonly used.

option ​

The player's options.

▶ Run Code
js
var art = new Artplayer({
     container: '.artplayer-app',
     url: '/assets/sample/video.mp4',
 });
@@ -217,7 +217,7 @@
 art.on('ready', () => {
     art.plugins.add(myPlugin);
 });
- + \ No newline at end of file diff --git a/docs/document/en/advanced/class.html b/docs/document/en/advanced/class.html index 007ef9a66..c008bc9b3 100644 --- a/docs/document/en/advanced/class.html +++ b/docs/document/en/advanced/class.html @@ -23,7 +23,7 @@ -
Skip to content

Static Properties ​

Here, Static Properties refer to the top-level properties mounted on the constructor function, which are very rarely used.

instances ​

Returns an array of all player instances. This property can be useful when you need to manage multiple player instances simultaneously.

▶ Run Code
js
console.info([...Artplayer.instances]);
+    
Skip to content

Static Properties ​

Here, Static Properties refer to the top-level properties mounted on the constructor function, which are very rarely used.

instances ​

Returns an array of all player instances. This property can be useful when you need to manage multiple player instances simultaneously.

▶ Run Code
js
console.info([...Artplayer.instances]);
 
 var art = new Artplayer({
     container: '.artplayer-app',
@@ -31,7 +31,7 @@
 });
 
 console.info([...Artplayer.instances]);

version ​

Returns the version information of the player.

▶ Run Code
js
console.info(Artplayer.version);

env ​

Returns the environment variables of the player.

▶ Run Code
js
console.info(Artplayer.env);

build ​

Returns the build time of the player.

▶ Run Code
js
console.info(Artplayer.build);

config ​

Returns the default configuration for videos.

▶ Run Code
js
console.info(Artplayer.config);

utils ​

Returns the collection of utility functions for the player.

▶ Run Code
js
console.info(Artplayer.utils);

For all utility functions, please refer to the following address:

artplayer/types/utils.d.ts

scheme ​

Returns the validation schema for player options.

▶ Run Code
js
console.info(Artplayer.scheme);

Emitter ​

Returns the constructor function for the event emitter.

▶ Run Code
js
console.info(Artplayer.Emitter);

validator ​

Returns the validation function for options.

▶ Run Code
js
console.info(Artplayer.validator);

kindOf ​

Returns the utility function for type detection.

▶ Run Code
js
console.info(Artplayer.kindOf);

html ​

Returns the html string required by the player.

▶ Run Code
js
console.info(Artplayer.html);

option ​

Returns the default options for the player.

▶ Run Code
js
console.info(Artplayer.option);
- + \ No newline at end of file diff --git a/docs/document/en/advanced/event.html b/docs/document/en/advanced/event.html index fdab36cd1..541325661 100644 --- a/docs/document/en/advanced/event.html +++ b/docs/document/en/advanced/event.html @@ -23,7 +23,7 @@ -
Skip to content

Instance Events ​

Player events are divided into two types: native events (prefixed with video:) and custom events.

Listen to an event:

▶ Run Code
js
var art = new Artplayer({
+    
Skip to content

Instance Events ​

Player events are divided into two types: native events (prefixed with video:) and custom events.

Listen to an event:

▶ Run Code
js
var art = new Artplayer({
     container: '.artplayer-app',
     url: '/assets/sample/video.mp4',
 });
@@ -412,7 +412,7 @@
 art.on('keydown', (event) => {
     console.log(event.code);
 });

video:canplay ​

The browser can start playing the media, but estimates there isn't enough data to play through to the end without having to stop for further buffering

video:canplaythrough ​

The browser estimates it can play the media through to the end without stopping to buffer content

video:complete ​

OfflineAudioContext rendering is complete

video:durationchange ​

Triggered when the value of the duration property changes

video:emptied ​

The media has become empty; for example, this event is sent when the media has already been loaded (or partially loaded), and the load() method is called to reload it

video:ended ​

Playback has stopped because the media has reached its end point

video:error ​

An error occurred while fetching media data, or the resource type is not a supported media format

video:loadeddata ​

The first frame of the media has finished loading

video:loadedmetadata ​

Metadata has been loaded

video:pause ​

Playback has been paused

video:play ​

Playback has begun

video:playing ​

Playback is ready to start after having been paused or delayed due to lack of data

video:progress ​

Periodically triggered while the browser is loading the resource

video:ratechange ​

The playback rate has changed

video:seeked ​

A seek operation has completed

video:seeking ​

A seek operation has begun

video:stalled ​

The user agent is trying to fetch media data, but data is unexpectedly not forthcoming

video:suspend ​

Media data loading has been suspended

video:timeupdate ​

The time indicated by the currentTime attribute has been updated

video:volumechange ​

The volume has changed

video:waiting ​

Playback has stopped due to temporary lack of data

- + \ No newline at end of file diff --git a/docs/document/en/advanced/global.html b/docs/document/en/advanced/global.html index abae32ebb..63b645c94 100644 --- a/docs/document/en/advanced/global.html +++ b/docs/document/en/advanced/global.html @@ -23,7 +23,7 @@ -
Skip to content

Global Properties ​

These global properties refer to the top-level properties mounted on the constructor. The property names are all in uppercase. They are subject to change in the future and are generally not used.

DEBUG ​

Whether to enable debug mode, which can print all built-in events of the video. Default is off.

▶ Run Code
js
Artplayer.DEBUG = true;
+    
Skip to content

Global Properties ​

These global properties refer to the top-level properties mounted on the constructor. The property names are all in uppercase. They are subject to change in the future and are generally not used.

DEBUG ​

Whether to enable debug mode, which can print all built-in events of the video. Default is off.

▶ Run Code
js
Artplayer.DEBUG = true;
 
 var art = new Artplayer({
     container: '.artplayer-app',
@@ -266,7 +266,7 @@
 
 // Only destroys the UI, does not actively clear src
 art.destroy();
- + \ No newline at end of file diff --git a/docs/document/en/advanced/plugin.html b/docs/document/en/advanced/plugin.html index 700468e45..040095585 100644 --- a/docs/document/en/advanced/plugin.html +++ b/docs/document/en/advanced/plugin.html @@ -23,7 +23,7 @@ -
Skip to content

Writing Plugins ​

Once you are familiar with the player's properties, methods, and events, writing plugins becomes very straightforward.

You can load plugin functions during instantiation:

▶ Run Code
js
function myPlugin(art) {
+    
Skip to content

Writing Plugins ​

Once you are familiar with the player's properties, methods, and events, writing plugins becomes very straightforward.

You can load plugin functions during instantiation:

▶ Run Code
js
function myPlugin(art) {
     console.info(art);
     return {
         name: 'myPlugin',
@@ -122,7 +122,7 @@
         })
     ],
 });
- + \ No newline at end of file diff --git a/docs/document/en/advanced/property.html b/docs/document/en/advanced/property.html index e93278954..c232f2520 100644 --- a/docs/document/en/advanced/property.html +++ b/docs/document/en/advanced/property.html @@ -23,7 +23,7 @@ -
Skip to content

Instance Properties ​

Here, Instance Properties refer to the first-level properties mounted on the instance, which are commonly used.

play ​

  • Type: Function

Play the video.

▶ Run Code
js
var art = new Artplayer({
+    
Skip to content

Instance Properties ​

Here, Instance Properties refer to the first-level properties mounted on the instance, which are commonly used.

play ​

  • Type: Function

Play the video.

▶ Run Code
js
var art = new Artplayer({
     container: '.artplayer-app',
     url: '/assets/sample/video.mp4',
     muted: true,
@@ -487,7 +487,7 @@
 art.on('ready', () => {
     art.subtitleOffset = 1;
 });
- + \ No newline at end of file diff --git a/docs/document/en/component/contextmenu.html b/docs/document/en/component/contextmenu.html index 72bca6f98..bd8482ab1 100644 --- a/docs/document/en/component/contextmenu.html +++ b/docs/document/en/component/contextmenu.html @@ -23,7 +23,7 @@ -
Skip to content

Context Menu ​

Configuration ​

PropertyTypeDescription
disableBooleanWhether to disable the component
nameStringUnique component name for CSS class
indexNumberComponent index for display priority
htmlString, ElementComponent DOM element
styleObjectComponent style object
clickFunctionComponent click event
mountedFunctionTriggered after component mount
tooltipStringComponent tooltip text

Creation ​

▶ Run Code
js
var art = new Artplayer({
+    
Skip to content

Context Menu ​

Configuration ​

PropertyTypeDescription
disableBooleanWhether to disable the component
nameStringUnique component name for CSS class
indexNumberComponent index for display priority
htmlString, ElementComponent DOM element
styleObjectComponent style object
clickFunctionComponent click event
mountedFunctionTriggered after component mount
tooltipStringComponent tooltip text

Creation ​

▶ Run Code
js
var art = new Artplayer({
     container: '.artplayer-app',
     url: '/assets/sample/video.mp4',
     contextmenu: [
@@ -106,7 +106,7 @@
         })
     }, 3000);
 });
- + \ No newline at end of file diff --git a/docs/document/en/component/controls.html b/docs/document/en/component/controls.html index 9d407c0b8..8a833306d 100644 --- a/docs/document/en/component/controls.html +++ b/docs/document/en/component/controls.html @@ -23,7 +23,7 @@ -
Skip to content

Controls ​

Configuration ​

PropertyTypeDescription
disableBooleanWhether to disable the control
nameStringUnique control name for CSS class identification
indexNumberControl index for display priority
htmlString, ElementControl's DOM element
styleObjectControl style object
clickFunctionControl click event handler
mountedFunctionTriggered after control is mounted
tooltipStringControl tooltip text
positionStringleft or right - controls display position
selectorArrayArray of selector list objects
onSelectFunctionFunction triggered when selector item is clicked

Creation ​

▶ Run Code
js
var art = new Artplayer({
+    
Skip to content

Controls ​

Configuration ​

PropertyTypeDescription
disableBooleanWhether to disable the control
nameStringUnique control name for CSS class identification
indexNumberControl index for display priority
htmlString, ElementControl's DOM element
styleObjectControl style object
clickFunctionControl click event handler
mountedFunctionTriggered after control is mounted
tooltipStringControl tooltip text
positionStringleft or right - controls display position
selectorArrayArray of selector list objects
onSelectFunctionFunction triggered when selector item is clicked

Creation ​

▶ Run Code
js
var art = new Artplayer({
     container: '.artplayer-app',
     url: '/assets/sample/video.mp4',
     controls: [
@@ -153,7 +153,7 @@
         });
     }, 3000);
 });
- + \ No newline at end of file diff --git a/docs/document/en/component/layers.html b/docs/document/en/component/layers.html index 2f5acbbda..12c58d932 100644 --- a/docs/document/en/component/layers.html +++ b/docs/document/en/component/layers.html @@ -23,7 +23,7 @@ -
Skip to content

Layer ​

Configuration ​

PropertyTypeDescription
disableBooleanWhether to disable the component
nameStringUnique component name for CSS class
indexNumberComponent index for display priority
htmlString, ElementComponent DOM element
styleObjectComponent style object
clickFunctionComponent click event
mountedFunctionTriggered after component mount
tooltipStringComponent tooltip text

Creation ​

▶ Run Code
js
var img = '/assets/sample/layer.png';
+    
Skip to content

Layer ​

Configuration ​

PropertyTypeDescription
disableBooleanWhether to disable the component
nameStringUnique component name for CSS class
indexNumberComponent index for display priority
htmlString, ElementComponent DOM element
styleObjectComponent style object
clickFunctionComponent click event
mountedFunctionTriggered after component mount
tooltipStringComponent tooltip text

Creation ​

▶ Run Code
js
var img = '/assets/sample/layer.png';
 var art = new Artplayer({
     container: '.artplayer-app',
     url: '/assets/sample/video.mp4',
@@ -125,7 +125,7 @@
         });
     }, 3000);
 });
- + \ No newline at end of file diff --git a/docs/document/en/component/setting.html b/docs/document/en/component/setting.html index b528fca98..ce59b19b9 100644 --- a/docs/document/en/component/setting.html +++ b/docs/document/en/component/setting.html @@ -23,7 +23,7 @@ -
Skip to content

Settings Panel ​

Built-in ​

First, you need to open the settings panel. It comes with four built-in items: flip, playbackRate, aspectRatio, subtitleOffset

▶ Run Code
js
var art = new Artplayer({
+    
Skip to content

Settings Panel ​

Built-in ​

First, you need to open the settings panel. It comes with four built-in items: flip, playbackRate, aspectRatio, subtitleOffset

▶ Run Code
js
var art = new Artplayer({
     container: '.artplayer-app',
     url: '/assets/sample/video.mp4',
 	setting: true,
@@ -260,7 +260,7 @@
         });
     }, 3000);
 });
- + \ No newline at end of file diff --git a/docs/document/en/index.html b/docs/document/en/index.html index 43513fa99..27f4d85e3 100644 --- a/docs/document/en/index.html +++ b/docs/document/en/index.html @@ -13,7 +13,7 @@ - + @@ -23,7 +23,7 @@ -
Skip to content

Installation & Usage ​

Installation ​

bash
npm install artplayer
bash
yarn add artplayer
bash
pnpm add artplayer
html
<script src="path/to/artplayer.js"></script>

CDN ​

bash
https://cdn.jsdelivr.net/npm/artplayer/dist/artplayer.js
bash
https://unpkg.com/artplayer/dist/artplayer.js

Usage ​

html
<html>
+    
Skip to content

Installation & Usage ​

Installation ​

bash
npm install artplayer
bash
yarn add artplayer
bash
pnpm add artplayer
html
<script src="path/to/artplayer.js"></script>

CDN ​

bash
https://cdn.jsdelivr.net/npm/artplayer/dist/artplayer.js
bash
https://unpkg.com/artplayer/dist/artplayer.js

Usage ​

html
<html>
     <head>
         <title>ArtPlayer Demo</title>
         <meta charset="UTF-8" />
@@ -44,7 +44,7 @@
           });
         </script>
     </body>
-</html>

Note

The player's dimensions depend on the size of its container container, so your container must have defined dimensions.

See more usage examples at the following link:

/example

Vue.js ​

vue
<template>
+</html>

Note

The player's dimensions depend on the size of its container container, so your container must have defined dimensions.

See more usage examples at the following link:

/example

Vue.js ​

vue
<template>
   <div ref="$container" />
 </template>
 
@@ -76,7 +76,7 @@
   art.value.destroy(false)
 })
 </script>
vue
<template>
-  <Artplayer :option="option" :style="style" @get-instance="getInstance" />
+  <Artplayer :option="option" :style="style" @get-instance="getInstance" />
 </template>
 
 <script setup>
@@ -96,7 +96,7 @@
 function getInstance(art) {
   console.log(art)
 }
-</script>

Artplayer is not reactive:

Directly modifying option in Vue.js will not update the player.

React.js ​

jsx
import Artplayer from 'artplayer'
+</script>

Artplayer is not reactive:

Directly modifying option in Vue.js will not update the player.

React.js ​

jsx
import Artplayer from 'artplayer'
 import { useEffect, useRef } from 'react'
 
 export default function Player({ option, getInstance, ...rest }) {
@@ -179,7 +179,7 @@
 
 option.volume = 0.5;
 
-const art8 = new Artplayer(option);

Legacy Browsers ​

The production build artplayer.js only supports the latest major version of Chrome: last 1 Chrome version

For legacy browsers, you can use the artplayer.legacy.js file, which supports compatibility down to: IE 11

js
import Artplayer from 'artplayer/legacy'
bash
https://cdn.jsdelivr.net/npm/artplayer/dist/artplayer.legacy.js
bash
https://unpkg.com/artplayer/dist/artplayer.legacy.js

If you need to support even older browsers, modify the following configuration and build it yourself:

Build configuration: scripts/build.js

Reference documentation: browserslist

ECMAScript Module ​

Starting from 5.2.6, artplayer and all plugins also provide an ESM version mjs, such as:

  • artplayer/dist/artplayer.mjs
  • artplayer-plugin-danmuku/dist/artplayer-plugin-danmuku.mjs
html
<!DOCTYPE html>
+const art8 = new Artplayer(option);

Legacy Browsers ​

The production build artplayer.js only supports the latest major version of Chrome: last 1 Chrome version

For legacy browsers, you can use the artplayer.legacy.js file, which supports compatibility down to: IE 11

js
import Artplayer from 'artplayer/legacy'
bash
https://cdn.jsdelivr.net/npm/artplayer/dist/artplayer.legacy.js
bash
https://unpkg.com/artplayer/dist/artplayer.legacy.js

If you need to support even older browsers, modify the following configuration and build it yourself:

Build configuration: scripts/build.js

Reference documentation: browserslist

ECMAScript Module ​

Starting from 5.2.6, artplayer and all plugins also provide an ESM version mjs, such as:

  • artplayer/dist/artplayer.mjs
  • artplayer-plugin-danmuku/dist/artplayer-plugin-danmuku.mjs
html
<!DOCTYPE html>
 <html lang="en">
 
 <head>
@@ -237,7 +237,7 @@
         </script>
     </body>
 </html>

Note

You need to modify it before importing the Artplayer dependency for it to take effect.

- + \ No newline at end of file diff --git a/docs/document/en/start/i18n.html b/docs/document/en/start/i18n.html index 08bb29ba7..a4487d87c 100644 --- a/docs/document/en/start/i18n.html +++ b/docs/document/en/start/i18n.html @@ -13,7 +13,7 @@ - + @@ -23,11 +23,11 @@ -
Skip to content

Language Settings ​

DANGER

Due to the increasing number of bundled multilingual resources, starting from version 5.1.0, the core artplayer.js code will only include Simplified Chinese and English. Other languages are no longer bundled by default and must be imported manually as needed.

WARNING

When a language cannot be matched, English will be displayed by default. For i18n implementation reference, see: artplayer/types/i18n.d.ts

Default Languages ​

The default languages are: en, zh-cn. No manual import is required.

js
var art = new Artplayer({
+    
Skip to content

Language Settings ​

DANGER

Due to the increasing number of bundled multilingual resources, starting from version 5.1.0, the core artplayer.js code will only include Simplified Chinese and English. Other languages are no longer bundled by default and must be imported manually as needed.

WARNING

When a language cannot be matched, English will be displayed by default. For i18n implementation reference, see: artplayer/types/i18n.d.ts

Default Languages ​

The default languages are: en, zh-cn. No manual import is required.

js
var art = new Artplayer({
     container: '.artplayer-app',
     url: '/assets/sample/video.mp4',
     lang: 'zh-cn', // or 'en'
-});

Importing Languages ​

Language files before bundling are located at: artplayer/src/i18n/*.js. Contributions to add your language are welcome.

Language files after bundling are located at: artplayer/dist/i18n/*.js

js
import id from 'artplayer/i18n/id';
+});

Importing Languages ​

Language files before bundling are located at: artplayer/src/i18n/*.js. Contributions to add your language are welcome.

Language files after bundling are located at: artplayer/dist/i18n/*.js

js
import id from 'artplayer/i18n/id';
 import zhTw from 'artplayer/i18n/zh-tw';
 
 var art = new Artplayer({
@@ -75,7 +75,7 @@
         },
     },
 });
- + \ No newline at end of file diff --git a/docs/document/en/start/option.html b/docs/document/en/start/option.html index 44e406482..aa8962e37 100644 --- a/docs/document/en/start/option.html +++ b/docs/document/en/start/option.html @@ -23,7 +23,7 @@ -
Skip to content

Basic Options ​

container ​

  • Type: String, Element
  • Default: #artplayer

The DOM container where the player is mounted.

▶ Run Code
js
var art = new Artplayer({
+    
Skip to content

Basic Options ​

container ​

  • Type: String, Element
  • Default: #artplayer

The DOM container where the player is mounted.

▶ Run Code
js
var art = new Artplayer({
     container: '.artplayer-app', 
     // container: document.querySelector('.artplayer-app'),
     url: '/assets/sample/video.mp4',
@@ -475,7 +475,7 @@
     url: '/assets/sample/video.mp4',
     proxy: () => document.createElement('video')
 });
- + \ No newline at end of file diff --git a/docs/document/hashmap.json b/docs/document/hashmap.json index bf338b6fa..4523be225 100644 --- a/docs/document/hashmap.json +++ b/docs/document/hashmap.json @@ -1 +1 @@ -{"advanced_built-in.md":"DiyRIcIA","advanced_class.md":"Da3aE0pP","advanced_event.md":"mrsB0MsK","advanced_global.md":"Bdw3azKs","advanced_plugin.md":"B3Pobmcq","advanced_property.md":"CA7GaeI3","component_contextmenu.md":"ClKmcIKr","component_controls.md":"Cl62yW1F","component_layers.md":"Cys52VMi","component_setting.md":"BP5674ir","en_advanced_built-in.md":"XdT81JC0","en_advanced_class.md":"BLyA7rxa","en_advanced_event.md":"CtQl1IYg","en_advanced_global.md":"D5Nz8wyo","en_advanced_plugin.md":"BOuMu80J","en_advanced_property.md":"urRMaqHe","en_component_contextmenu.md":"COLfX45a","en_component_controls.md":"BbQsn0wJ","en_component_layers.md":"CX93a7QS","en_component_setting.md":"C6o2AWtX","en_index.md":"7shqBtga","en_start_i18n.md":"Br6ZSUj7","en_start_option.md":"Bk4YXvof","index.md":"Xug2h4MQ","plugin_danmuku.md":"Dm8aaMVM","start_i18n.md":"B-KNPVtu","start_option.md":"D52S8Ynf"} +{"advanced_built-in.md":"DiyRIcIA","advanced_class.md":"Da3aE0pP","advanced_event.md":"mrsB0MsK","advanced_global.md":"Bdw3azKs","advanced_plugin.md":"B3Pobmcq","advanced_property.md":"CA7GaeI3","component_contextmenu.md":"ClKmcIKr","component_controls.md":"Cl62yW1F","component_layers.md":"Cys52VMi","component_setting.md":"BP5674ir","en_advanced_built-in.md":"XdT81JC0","en_advanced_class.md":"BLyA7rxa","en_advanced_event.md":"CtQl1IYg","en_advanced_global.md":"D5Nz8wyo","en_advanced_plugin.md":"BOuMu80J","en_advanced_property.md":"urRMaqHe","en_component_contextmenu.md":"COLfX45a","en_component_controls.md":"BbQsn0wJ","en_component_layers.md":"CX93a7QS","en_component_setting.md":"C6o2AWtX","en_index.md":"BCuGsKe-","en_start_i18n.md":"Dn_-QNMz","en_start_option.md":"Bk4YXvof","index.md":"DDqAV2TW","plugin_danmuku.md":"BbwsJDxp","start_i18n.md":"D9C8Ka0e","start_option.md":"D52S8Ynf"} diff --git a/docs/document/index.html b/docs/document/index.html index f134e2967..061ff9600 100644 --- a/docs/document/index.html +++ b/docs/document/index.html @@ -13,7 +13,7 @@ - + @@ -23,7 +23,7 @@ -
Skip to content

安装使用 ​

安装 ​

bash
npm install artplayer
bash
yarn add artplayer
bash
pnpm add artplayer
html
<script src="path/to/artplayer.js"></script>

CDN ​

bash
https://cdn.jsdelivr.net/npm/artplayer/dist/artplayer.js
bash
https://unpkg.com/artplayer/dist/artplayer.js

使用 ​

html
<html>
+    
Skip to content

安装使用 ​

安装 ​

bash
npm install artplayer
bash
yarn add artplayer
bash
pnpm add artplayer
html
<script src="path/to/artplayer.js"></script>

CDN ​

bash
https://cdn.jsdelivr.net/npm/artplayer/dist/artplayer.js
bash
https://unpkg.com/artplayer/dist/artplayer.js

使用 ​

html
<html>
     <head>
         <title>ArtPlayer Demo</title>
         <meta charset="UTF-8" />
@@ -44,7 +44,7 @@
           });
         </script>
     </body>
-</html>

提示

播放器的尺寸依赖于容器 container 的尺寸,所以你的容器 container 必须是有尺寸的

以下链接可以看到更多的使用例子

/example

Vue.js ​

vue
<template>
+</html>

提示

播放器的尺寸依赖于容器 container 的尺寸,所以你的容器 container 必须是有尺寸的

以下链接可以看到更多的使用例子

/example

Vue.js ​

vue
<template>
   <div ref="$container" />
 </template>
 
@@ -76,7 +76,7 @@
   art.value.destroy(false)
 })
 </script>
vue
<template>
-  <Artplayer :option="option" :style="style" @get-instance="getInstance" />
+  <Artplayer :option="option" :style="style" @get-instance="getInstance" />
 </template>
 
 <script setup>
@@ -96,7 +96,7 @@
 function getInstance(art) {
   console.log(art)
 }
-</script>

Artplayer 非响应式:

在 Vue.js 里直接修改 option 是不会改变播放器的

React.js ​

jsx
import Artplayer from 'artplayer'
+</script>

Artplayer 非响应式:

在 Vue.js 里直接修改 option 是不会改变播放器的

React.js ​

jsx
import Artplayer from 'artplayer'
 import { useEffect, useRef } from 'react'
 
 export default function Player({ option, getInstance, ...rest }) {
@@ -179,7 +179,7 @@
 
 option.volume = 0.5;
 
-const art8 = new Artplayer(option);

古老的浏览器 ​

生产构建的 artplayer.js 只兼容最新一个主版本的 Chrome:last 1 Chrome version

对于古老的浏览器,可以使用 artplayer.legacy.js 文件,可以兼容到:IE 11

js
import Artplayer from 'artplayer/legacy'
bash
https://cdn.jsdelivr.net/npm/artplayer/dist/artplayer.legacy.js
bash
https://unpkg.com/artplayer/dist/artplayer.legacy.js

假如你要兼容更古老的浏览器时,请修改以下配置然后自行构建:

构建配置:scripts/build.js

参考文档:browserslist

ECMAScript Module ​

从 5.2.6 开始,artplayer 和所有插件还会提供一个 ESM 版本的 mjs,如:

  • artplayer/dist/artplayer.mjs
  • artplayer-plugin-danmuku/dist/artplayer-plugin-danmuku.mjs
html
<!DOCTYPE html>
+const art8 = new Artplayer(option);

古老的浏览器 ​

生产构建的 artplayer.js 只兼容最新一个主版本的 Chrome:last 1 Chrome version

对于古老的浏览器,可以使用 artplayer.legacy.js 文件,可以兼容到:IE 11

js
import Artplayer from 'artplayer/legacy'
bash
https://cdn.jsdelivr.net/npm/artplayer/dist/artplayer.legacy.js
bash
https://unpkg.com/artplayer/dist/artplayer.legacy.js

假如你要兼容更古老的浏览器时,请修改以下配置然后自行构建:

构建配置:scripts/build.js

参考文档:browserslist

ECMAScript Module ​

从 5.2.6 开始,artplayer 和所有插件还会提供一个 ESM 版本的 mjs,如:

  • artplayer/dist/artplayer.mjs
  • artplayer-plugin-danmuku/dist/artplayer-plugin-danmuku.mjs
html
<!DOCTYPE html>
 <html lang="en">
 
 <head>
@@ -237,7 +237,7 @@
         </script>
     </body>
 </html>

提示

你需要在引入 Artplayer 依赖前来修改它才会生效

- + \ No newline at end of file diff --git a/docs/document/plugin/danmuku.html b/docs/document/plugin/danmuku.html index f3e4aed50..cb362f27b 100644 --- a/docs/document/plugin/danmuku.html +++ b/docs/document/plugin/danmuku.html @@ -13,7 +13,7 @@ - + @@ -23,7 +23,7 @@ -
Skip to content

弹幕库 ​

演示 ​

👉 查看完整演示

安装 ​

bash
npm install artplayer-plugin-danmuku
bash
yarn add artplayer-plugin-danmuku
bash
pnpm add artplayer-plugin-danmuku
html
<script src="path/to/artplayer-plugin-danmuku.js"></script>

CDN ​

bash
https://cdn.jsdelivr.net/npm/artplayer-plugin-danmuku/dist/artplayer-plugin-danmuku.js
bash
https://unpkg.com/artplayer-plugin-danmuku/dist/artplayer-plugin-danmuku.js

弹幕结构 ​

每一个弹幕是一个对象,多个弹幕组成的数组就是弹幕库,通常只需要text就可以发送一个弹幕,其余都是非必要参数

js
{
+    
Skip to content

弹幕库 ​

演示 ​

👉 查看完整演示

安装 ​

bash
npm install artplayer-plugin-danmuku
bash
yarn add artplayer-plugin-danmuku
bash
pnpm add artplayer-plugin-danmuku
html
<script src="path/to/artplayer-plugin-danmuku.js"></script>

CDN ​

bash
https://cdn.jsdelivr.net/npm/artplayer-plugin-danmuku/dist/artplayer-plugin-danmuku.js
bash
https://unpkg.com/artplayer-plugin-danmuku/dist/artplayer-plugin-danmuku.js

弹幕结构 ​

每一个弹幕是一个对象,多个弹幕组成的数组就是弹幕库,通常只需要text就可以发送一个弹幕,其余都是非必要参数

js
{
     text: '', // 弹幕文本
     time: 10, // 弹幕时间, 默认为当前播放器时间
     mode: 0, // 弹幕模式: 0: 滚动(默认),1: 顶部,2: 底部
@@ -367,7 +367,7 @@
 art.on('artplayerPluginDanmuku:destroy', () => {
     console.info('弹幕销毁');
 });
- + \ No newline at end of file diff --git a/docs/document/start/i18n.html b/docs/document/start/i18n.html index d3bcbb8e0..8eedd7beb 100644 --- a/docs/document/start/i18n.html +++ b/docs/document/start/i18n.html @@ -13,7 +13,7 @@ - + @@ -23,11 +23,11 @@ -
Skip to content

语言设置 ​

DANGER

鉴于捆绑的多国语言越来越多, 从 5.1.0 版本开始, artplayer.js 核心代码除了包含 简体中文 和 英文 外, 不再捆绑其它多国语言, 需要自行导入需要的语言。

WARNING

当无法匹配到语言时, 会默认显示英文, i18n 写法参考: artplayer/types/i18n.d.ts

默认语言 ​

默认语言有: en, zh-cn, 无需手动导入

js
var art = new Artplayer({
+    
Skip to content

语言设置 ​

DANGER

鉴于捆绑的多国语言越来越多, 从 5.1.0 版本开始, artplayer.js 核心代码除了包含 简体中文 和 英文 外, 不再捆绑其它多国语言, 需要自行导入需要的语言。

WARNING

当无法匹配到语言时, 会默认显示英文, i18n 写法参考: artplayer/types/i18n.d.ts

默认语言 ​

默认语言有: en, zh-cn, 无需手动导入

js
var art = new Artplayer({
     container: '.artplayer-app',
     url: '/assets/sample/video.mp4',
     lang: 'zh-cn', // or 'en'
-});

导入语言 ​

打包前的语言文件存放于: artplayer/src/i18n/*.js, 欢迎来添加你的语言

打包后的语言文件存放于: artplayer/dist/i18n/*.js

js
import id from 'artplayer/i18n/id';
+});

导入语言 ​

打包前的语言文件存放于: artplayer/src/i18n/*.js, 欢迎来添加你的语言

打包后的语言文件存放于: artplayer/dist/i18n/*.js

js
import id from 'artplayer/i18n/id';
 import zhTw from 'artplayer/i18n/zh-tw';
 
 var art = new Artplayer({
@@ -75,7 +75,7 @@
         },
     },
 });
- + \ No newline at end of file diff --git a/docs/document/start/option.html b/docs/document/start/option.html index 94da21054..6199ab369 100644 --- a/docs/document/start/option.html +++ b/docs/document/start/option.html @@ -23,7 +23,7 @@ -
Skip to content

基础选项 ​

container ​

  • Type: String, Element
  • Default: #artplayer

播放器挂载的 DOM 容器

▶ Run Code
js
var art = new Artplayer({
+    
Skip to content

基础选项 ​

container ​

  • Type: String, Element
  • Default: #artplayer

播放器挂载的 DOM 容器

▶ Run Code
js
var art = new Artplayer({
     container: '.artplayer-app', 
     // container: document.querySelector('.artplayer-app'),
     url: '/assets/sample/video.mp4',
@@ -415,7 +415,7 @@
     url: '/assets/sample/video.mp4',
     proxy: () => document.createElement('video')
 });
- + \ No newline at end of file diff --git a/docs/index.html b/docs/index.html index a75474db8..82b7fc1f4 100644 --- a/docs/index.html +++ b/docs/index.html @@ -85,10 +85,6 @@ artplayer-plugin-multiple-subtitles -
  • - artplayer-plugin-libass -
  • artplayer-plugin-chromecast diff --git a/docs/llms.txt b/docs/llms.txt index 0592e6605..5c93582a2 100644 --- a/docs/llms.txt +++ b/docs/llms.txt @@ -5421,24 +5421,6 @@ export default ArtplayerPluginIframe export = artplayerPluginIframe export as namespace artplayerPluginIframe; -===== artplayer-plugin-libass.d.ts ===== - -// ASS subtitle rendering plugin using libass -declare const artplayerPluginAss: (options: Options) => (art: Artplayer) => { - name: 'artplayerPluginLibass' - libass: SubtitlesOctopus // Underlying libass instance - visible: boolean // Subtitle visibility state - init: () => void // Initialize subtitle renderer - switch: (url: string) => void // Switch to different subtitle file - show: () => void // Show subtitles - hide: () => void // Hide subtitles - destroy: () => void // Cleanup resources -} - -export default artplayerPluginAss -export = artplayerPluginLibass -export as namespace artplayerPluginLibass; - ===== artplayer-plugin-multiple-subtitles.d.ts ===== // Plugin for managing multiple subtitle tracks @@ -7755,55 +7737,6 @@ var art = new Artplayer({ // This example demonstrates a comprehensive ArtPlayer configuration with multiple features including custom settings, context menu, layers, quality switching, thumbnails, subtitles, highlights, and custom controls. -===== libass.js ===== - -// npm i artplayer-plugin-libass -// import artplayerPluginLibass from 'artplayer-plugin-libass'; - -const art = new Artplayer({ - container: '.artplayer-app', - url: '/assets/sample/video.mp4', - fullscreenWeb: true, - subtitle: { - url: '/assets/sample/style-test.ass', - }, - plugins: [ - artplayerPluginLibass({ - // debug: true, - workerUrl: 'https://unpkg.com/libass-wasm@4.1.0/dist/js/subtitles-octopus-worker.js', - // wasmUrl: 'https://unpkg.com/libass-wasm@4.1.0/dist/js/subtitles-octopus-worker.wasm', - fallbackFont: '/assets/misc/SourceHanSansCN-Bold.woff2', - }), - ], -}) - -// init -art.on('artplayerPluginLibass:init', (adapter) => { - console.info('artplayerPluginLibass:init', adapter) -}) - -// subtitle switch -art.on('artplayerPluginLibass:switch', (url) => { - console.info('artplayerPluginLibass:switch', url) -}) - -// subtitle visible -art.on('artplayerPluginLibass:visible', (visible) => { - console.info('artplayerPluginLibass:visible', visible) -}) - -// subtitle timeOffset -art.on('artplayerPluginLibass:timeOffset', (timeOffset) => { - console.info('artplayerPluginLibass:timeOffset', timeOffset) -}) - -// destroy -art.on('artplayerPluginLibass:destroy', () => { - console.info('artplayerPluginLibass:destroy') -}) - -// This example shows how to integrate the libass plugin for advanced ASS subtitle support with WebAssembly rendering and event handling for subtitle operations. - ===== mobile.js ===== var art = new Artplayer({ diff --git a/docs/uncompiled/artplayer-plugin-libass/index.js b/docs/uncompiled/artplayer-plugin-libass/index.js deleted file mode 100644 index 6e4e823d3..000000000 --- a/docs/uncompiled/artplayer-plugin-libass/index.js +++ /dev/null @@ -1,1921 +0,0 @@ -// modules are defined as an array -// [ module function, map of requires ] -// -// map of requires is short require name -> numeric require -// -// anything defined in a previous bundle is accessed via the -// orig method which is the require for previous bundles - -(function ( - modules, - entry, - mainEntry, - parcelRequireName, - externals, - distDir, - publicUrl, - devServer -) { - /* eslint-disable no-undef */ - var globalObject = - typeof globalThis !== 'undefined' - ? globalThis - : typeof self !== 'undefined' - ? self - : typeof window !== 'undefined' - ? window - : typeof global !== 'undefined' - ? global - : {}; - /* eslint-enable no-undef */ - - // Save the require from previous bundle to this closure if any - var previousRequire = - typeof globalObject[parcelRequireName] === 'function' && - globalObject[parcelRequireName]; - - var importMap = previousRequire.i || {}; - var cache = previousRequire.cache || {}; - // Do not use `require` to prevent Webpack from trying to bundle this call - var nodeRequire = - typeof module !== 'undefined' && - typeof module.require === 'function' && - module.require.bind(module); - - function newRequire(name, jumped) { - if (!cache[name]) { - if (!modules[name]) { - if (externals[name]) { - return externals[name]; - } - // if we cannot find the module within our internal map or - // cache jump to the current global require ie. the last bundle - // that was added to the page. - var currentRequire = - typeof globalObject[parcelRequireName] === 'function' && - globalObject[parcelRequireName]; - if (!jumped && currentRequire) { - return currentRequire(name, true); - } - - // If there are other bundles on this page the require from the - // previous one is saved to 'previousRequire'. Repeat this as - // many times as there are bundles until the module is found or - // we exhaust the require chain. - if (previousRequire) { - return previousRequire(name, true); - } - - // Try the node require function if it exists. - if (nodeRequire && typeof name === 'string') { - return nodeRequire(name); - } - - var err = new Error("Cannot find module '" + name + "'"); - err.code = 'MODULE_NOT_FOUND'; - throw err; - } - - localRequire.resolve = resolve; - localRequire.cache = {}; - - var module = (cache[name] = new newRequire.Module(name)); - - modules[name][0].call( - module.exports, - localRequire, - module, - module.exports, - globalObject - ); - } - - return cache[name].exports; - - function localRequire(x) { - var res = localRequire.resolve(x); - return res === false ? {} : newRequire(res); - } - - function resolve(x) { - var id = modules[name][1][x]; - return id != null ? id : x; - } - } - - function Module(moduleName) { - this.id = moduleName; - this.bundle = newRequire; - this.require = nodeRequire; - this.exports = {}; - } - - newRequire.isParcelRequire = true; - newRequire.Module = Module; - newRequire.modules = modules; - newRequire.cache = cache; - newRequire.parent = previousRequire; - newRequire.distDir = distDir; - newRequire.publicUrl = publicUrl; - newRequire.devServer = devServer; - newRequire.i = importMap; - newRequire.register = function (id, exports) { - modules[id] = [ - function (require, module) { - module.exports = exports; - }, - {}, - ]; - }; - - // Only insert newRequire.load when it is actually used. - // The code in this file is linted against ES5, so dynamic import is not allowed. - // INSERT_LOAD_HERE - - Object.defineProperty(newRequire, 'root', { - get: function () { - return globalObject[parcelRequireName]; - }, - }); - - globalObject[parcelRequireName] = newRequire; - - for (var i = 0; i < entry.length; i++) { - newRequire(entry[i]); - } - - if (mainEntry) { - // Expose entry point to Node, AMD or browser globals - // Based on https://github.com/ForbesLindesay/umd/blob/master/template.js - var mainExports = newRequire(mainEntry); - - // CommonJS - if (typeof exports === 'object' && typeof module !== 'undefined') { - module.exports = mainExports; - - // RequireJS - } else if (typeof define === 'function' && define.amd) { - define(function () { - return mainExports; - }); - } - } -})({"hVOIc":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>artplayerPluginLibass); -var _adapter = require("./adapter"); -var _adapterDefault = parcelHelpers.interopDefault(_adapter); -function artplayerPluginLibass(option) { - return (art)=>{ - const adapter = new (0, _adapterDefault.default)(art, option); - return { - name: 'artplayerPluginLibass', - libass: adapter.libass, - visible: adapter.visible, - init: adapter.init.bind(adapter), - switch: adapter.switch.bind(adapter), - show: adapter.show.bind(adapter), - hide: adapter.hide.bind(adapter), - destroy: adapter.destroy.bind(adapter) - }; - }; -} -if (typeof window !== 'undefined') window.artplayerPluginLibass = artplayerPluginLibass; - -},{"./adapter":"h5Lfw","@parcel/transformer-js/src/esmodule-helpers.js":"8oCsH"}],"h5Lfw":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _libassWasm = require("libass-wasm"); -var _libassWasmDefault = parcelHelpers.interopDefault(_libassWasm); -const defaultAssSubtitle = `[Script Info]\nScriptType: v4.00+`; -class LibassAdapter { - constructor(art, option){ - const { constructor, template } = art; - this.art = art; - this.$video = template.$video; - this.$webvtt = template.$subtitle; - this.utils = constructor.utils; - this.libass = null; - art.once('ready', this.init.bind(this, option)); - } - async init(option) { - this.#checkWebAssemblySupport(); - await this.#createLibass(option); - this.#addEventListeners(); - this.art.emit('artplayerPluginLibass:init', this); - // set initial subtitle - const initialSubtitle = this.art?.option?.subtitle?.url; - if (initialSubtitle && this.utils.getExt(initialSubtitle) === 'ass') this.switch(initialSubtitle); - } - switch(url) { - this.art.emit('artplayerPluginLibass:switch', url); - if (url && this.utils.getExt(url) === 'ass') { - this.currentType = 'ass'; - this.libass.freeTrack(); - this.libass.setTrackByUrl(this.#toAbsoluteUrl(url)); - this.visible = this.art.subtitle.show; - } else { - this.currentType = 'webvtt'; - this.hide(); - this.libass.freeTrack(); - } - } - setVisibility(visible) { - this.visible = visible; - } - setOffset(offset) { - this.timeOffset = offset; - } - get active() { - return this.currentType === 'ass'; - } - get visible() { - if (!this.libass) return false; - return this.libass.canvasParent.style.display !== 'none'; - } - set visible(visible) { - this.art.emit('artplayerPluginLibass:visible', visible); - this.#setVttVisible(!this.active); - if (this.libass.canvasParent) { - this.libass.canvasParent.style.display = visible ? 'block' : 'none'; - if (visible) this.libass.resize(); - } - } - get timeOffset() { - return this.libass.timeOffset; - } - set timeOffset(offset) { - this.art.emit('artplayerPluginLibass:timeOffset', offset); - this.libass.timeOffset = offset; - } - show() { - this.visible = true; - } - hide() { - this.visible = false; - } - destroy() { - this.art.emit('artplayerPluginLibass:destroy'); - this.#removeEventListeners(); - this.libass.dispose(); - URL.revokeObjectURL(this.workerScriptUrl); - this.libass = null; - } - async #createLibass(option = {}) { - if (!option.fallbackFont) return this.utils.errorHandle(option.fallbackFont, 'artplayerPluginLibass: fallbackFont is required'); - if (!option.workerUrl) option.workerUrl = 'https://cdnjs.cloudflare.com/ajax/libs/libass-wasm/4.1.0/js/subtitles-octopus-worker.js'; - if (option.availableFonts) option.availableFonts = Object.entries(option.availableFonts).reduce((acc, [key, value])=>{ - acc[key] = this.#toAbsoluteUrl(value); - return acc; - }, {}); - this.libass = new (0, _libassWasmDefault.default)({ - subContent: defaultAssSubtitle, - video: this.$video, - ...option, - workerUrl: await this.#loadWorker(option), - fallbackFont: this.#toAbsoluteUrl(option.fallbackFont), - fonts: option.fonts?.map((font)=>this.#toAbsoluteUrl(font)) - }); - this.libass.canvasParent.className = 'artplayer-plugin-libass'; - this.libass.canvasParent.style.cssText = ` - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; - user-select: none; - pointer-events: none; - z-index: 20;`; - } - #addEventListeners() { - this.switchHandler = this.switch.bind(this); - this.visibleHandler = this.setVisibility.bind(this); - this.offsetHandler = this.setOffset.bind(this); - this.art.on('subtitle', this.visibleHandler); - this.art.on('subtitleLoad', this.switchHandler); - this.art.on('subtitleOffset', this.offsetHandler); - this.art.once('destroy', this.destroy.bind(this)); - } - #removeEventListeners() { - this.art.off('subtitle', this.visibleHandler); - this.art.off('subtitleLoad', this.switchHandler); - this.art.off('subtitleOffset', this.offsetHandler); - } - #setVttVisible(visible) { - this.$webvtt.style.visibility = visible ? 'visible' : 'hidden'; - } - #toAbsoluteUrl(url) { - if (this.#isAbsoluteUrl(url)) return url; - // handle absolute URL when the `Worker` of `BLOB` type loading network resources - return new URL(url, document.baseURI).toString(); - } - #isAbsoluteUrl(url) { - return /^https?:\/\//.test(url); - } - #loadWorker({ workerUrl, wasmUrl }) { - return new Promise((resolve)=>{ - fetch(workerUrl).then((res)=>res.text()).then((text)=>{ - let workerScriptContent = text; - workerScriptContent = workerScriptContent.replace(/wasmBinaryFile\s*=\s*"(subtitles-octopus-worker\.wasm)"/g, (_match, wasm)=>{ - if (!wasmUrl) wasmUrl = new URL(wasm, workerUrl).toString(); - else wasmUrl = this.#toAbsoluteUrl(wasmUrl); - return `wasmBinaryFile = "${wasmUrl}"`; - }); - const workerBlob = new Blob([ - workerScriptContent - ], { - type: 'text/javascript' - }); - resolve(URL.createObjectURL(workerBlob)); - }); - }); - } - #checkWebAssemblySupport() { - let supportsWebAssembly = false; - try { - if (typeof WebAssembly === 'object' && typeof WebAssembly.instantiate === 'function') { - const module = new WebAssembly.Module(Uint8Array.of(0x0, 0x61, 0x73, 0x6D, 0x01, 0x00, 0x00, 0x00)); - if (module instanceof WebAssembly.Module) supportsWebAssembly = new WebAssembly.Instance(module) instanceof WebAssembly.Instance; - } - } catch (error) { - console.error('WebAssembly is not supported in this browser.', error); - supportsWebAssembly = false; - } - this.utils.errorHandle(supportsWebAssembly, 'Browser does not support WebAssembly'); - } -} -exports.default = LibassAdapter; - -},{"libass-wasm":"h8iej","@parcel/transformer-js/src/esmodule-helpers.js":"8oCsH"}],"h8iej":[function(require,module,exports,__globalThis) { -// # The following lists all copyright notices and licenses for the -// # work contained in JavascriptSubtitlesOctopus per project. -// -// # Project: subtitlesoctopus -// License: Expat -// Copyright: 2017-2021 JavascriptSubtitlesOctopus contributors -// -// # Project: brotli -// License: Expat -// Copyright: 2014 Google Inc. -// 2015 The Chromium Authors. -// 2016 Google Inc. -// 2017 Google Inc. -// 2018 Google Inc. -// 2015 Google Inc. -// 2013 Google Inc. -// 2009, 2010, 2013-2016 by the Brotli Authors -// 2010 Google Inc. -// -// # Project: expat -// License: Expat -// Copyright: 2019 Zhongyuan Zhou -// 2017-2022 Rhodri James -// 2020 Joe Orton -// 2016-2019 Sebastian Pipping -// 2021 Dong-hee Na -// 2017 Joe Orton -// 2002 Fred L. Drake, Jr. -// 2004-2006 Fred L. Drake, Jr. -// 2017 Sebastian Pipping -// 2004-2006 Karl Waclawek -// 2006 Karl Waclawek -// 2003-2006 Karl Waclawek -// 2001-2003 Fred L. Drake, Jr. -// 2000-2004 Fred L. Drake, Jr. -// 2017 Franek Korta -// 2001-2004 Fred L. Drake, Jr. -// 2006-2012 Karl Waclawek -// 2017 Benbuck Nason -// 2019 David Loffredo -// 2021 Tim Bray -// 2018 Benjamin Peterson -// 2017 Rhodri James -// 2002-2005 Karl Waclawek -// 2016-2020 Sebastian Pipping -// 2016-2018 Sebastian Pipping -// 2016 Gilles Espinasse -// 2007 Karl Waclawek -// 2002-2016 Karl Waclawek -// 2001-2006 Fred L. Drake, Jr. -// 2016 Don Lewis -// 2000-2017 Expat development team -// 2002-2004 Fred L. Drake, Jr. -// 2000 Clark Cooper -// 2002 Greg Stein -// 2018 Marco Maggi -// 2005-2012 Karl Waclawek -// 2020 Boris Kolpackov -// 2022 Thijs Schreijer -// 2017-2019 Sebastian Pipping -// 2016 Cristian Rodr\x{00c3}\x{00ad}guez -// 2005 Karl Waclawek -// 1999-2000 Thai Open Source Software Center Ltd -// 2000-2017 Expat development team / 1997-2000 Thai Open Source Software Center Ltd -// 2005-2007 Steven Solie -// 2016-2021 Sebastian Pipping -// 2005 Fred L. Drake, Jr. -// 2018 Anton Maklakov -// 2017 Alexander Bluhm -// 2016-2022 Sebastian Pipping -// 1997-2000 Thai Open Source Software Center Ltd -// 2017-2021 Sebastian Pipping -// 2002-2009 Karl Waclawek -// 2002 Karl Waclawek -// 2004-2009 Karl Waclawek -// 2020 Tim Gates -// 2016 Pascal Cuoq -// 2017 Jos\x{00c3}\x{00a9} Guti\x{00c3}\x{00a9}rrez de la Concha -// 2001-2002 Fred L. Drake, Jr. -// 2002-2006 Karl Waclawek -// 2000-2005 Fred L. Drake, Jr. -// 2005-2009 Steven Solie -// 2018 Yury Gribov -// 2022 Martin Ettl -// 2003 Greg Stein -// 2016-2017 Sebastian Pipping -// 2020 Kleber Tarc\x{00c3}\x{00ad}sio -// 2001-2002 Greg Stein -// 2002-2003 Fred L. Drake, Jr. -// 2005-2006 Karl Waclawek -// 2016 Thomas Beutlich -// -// # Project: freetype -// License: FTL -// Copyright: \x{00c5}\x{009d}\x{00c5}\x{00a5} \x{00c5}\x{009d}\x{00c5}\x{00a5}\x{00d1}\x{008f}\x{00c3}\x{00af}\x{00ef}\x{00ac}\x{00af}\x{00c4}\x{009f}") -// 2009-2013 Adobe Systems Incorporated. -// 2016-2022 David Turner, Robert Wilhelm, and Werner Lemberg. -// 2013 Adobe Systems Incorporated. -// 2004-2022 David Turner, Robert Wilhelm, Werner Lemberg, and George Williams. -// 2013-2022 Google, Inc. -// 2018-2022 Armin Hasitzka, David Turner, Robert Wilhelm, and Werner Lemberg. -// 2007-2014 Adobe Systems Incorporated. -// 2008-2022 David Turner, Robert Wilhelm, and Werner Lemberg. -// 2005-2022 Werner Lemberg and Detlef W\x{00fc}rkner. -// 2006-2022 David Turner, Robert Wilhelm, and Werner Lemberg. -// 2007-2022 David Turner, Robert Wilhelm, and Werner Lemberg. -// 1996-2022 David Turner, Robert Wilhelm, Werner Lemberg and Detlef W\x{00fc}rkner. -// 2004-2022 Masatake YAMATO, Redhat K.K, -// 1996-2022 David Turner, Robert Wilhelm, Werner Lemberg, and Detlef Wuerkner. -// 1996-2022 David Turner, Robert Wilhelm, and Werner Lemberg -// 1995-2016 Jean-loup Gailly, Mark Adler -// 2021-2022 David Turner, Robert Wilhelm, and Werner Lemberg. -// \x{00c5}\x{009d}\x{00c5}\x{00a5} \x{00c5}\x{009d}\x{00c5}\x{00a5}\x{00d1}\x{008f}\x{00c3}\x{00af}\x{00ef}\x{00ac}\x{00af}\x{00c4}\x{009f}")); -// 2004-2022 David Turner, Robert Wilhelm, Werner Lemberg and George Williams. -// 2009-2022 Oran Agra and Mickey Gabel. -// 2010-2022 David Turner, Robert Wilhelm, and Werner Lemberg. -// 1995-2017 Jean-loup Gailly -// 2003 Huw D M Davies for Codeweavers -// 2013-2014 Adobe Systems Incorporated. -// 2005-2022 David Turner. -// 1995-2011, 2016 Mark Adler -// 2010-2022 Joel Klinghed. -// 2002-2022 Roberto Alameda. -// 1996-2022 David Turner, Robert Wilhelm, and Werner Lemberg. -// 2011-2013 Adobe Systems Incorporated. -// 2007 Dmitry Timoshkov for Codeweavers -// 2002-2022 David Turner, Robert Wilhelm, and Werner Lemberg -// 2013-2022 David Turner, Robert Wilhelm, and Werner Lemberg. -// 1996-2022 Just van Rossum, David Turner, Robert Wilhelm, and Werner Lemberg. -// 1995-2017 Mark Adler -// 2000-2022 David Turner, Robert Wilhelm, and Werner Lemberg. -// 2022 David Turner, Robert Wilhelm, Werner Lemberg, and Moazin Khatti. -// 2006-2013 Adobe Systems Incorporated. -// 1995-2003, 2010 Mark Adler -// 2012-2022 David Turner, Robert Wilhelm, and Werner Lemberg. -// 2007-2022 Rahul Bhalerao , . -// 2007-2022 David Turner. -// 2017-2022 David Turner, Robert Wilhelm, and Werner Lemberg. -// 2008-2022 David Turner, Robert Wilhelm, Werner Lemberg, and suzuki toshiya. -// 2018-2022 David Turner, Robert Wilhelm, and Werner Lemberg. -// 1995-2005, 2010 Mark Adler -// 2005-2022 suzuki toshiya, Masatake YAMATO, Red Hat K.K., -// 2020-2022 David Turner, Robert Wilhelm, and Werner Lemberg. -// 2007-2022 Derek Clegg and Michael Toftdal. -// \x{00e1}\x{00bb}\x{008b}...): %dn", "\x{00e1}\x{00ba}\x{0083}\x{00ce}\x{00ad}\x{00c5}\x{0082}\x{00c4}\x{00ba}", "all", 42); -// 2019-2022 Nikhil Ramakrishnan, David Turner, Robert Wilhelm, and Werner Lemberg. -// 2013 Google, Inc. -// 2004-2022 David Turner, Robert Wilhelm, and Werner Lemberg. -// 2009-2014 Adobe Systems Incorporated. -// 2004-2022 Albert Chin-A-Young. -// 2003-2022 Masatake YAMATO, Redhat K.K., -// 2002-2022 David Turner, Robert Wilhelm, and Werner Lemberg. -// 2007-2013 Adobe Systems Incorporated. -// 2007-2022 Dereg Clegg and Michael Toftdal. -// 2003-2022 David Turner, Robert Wilhelm, and Werner Lemberg. -// 2004-2022 Masatake YAMATO and Redhat K.K. -// 2004-2022 Masatake YAMATO, Red Hat K.K., -// 2001-2022 David Turner, Robert Wilhelm, and Werner Lemberg. -// 2001, 2012 David Turner, Robert Wilhelm, and Werner Lemberg. -// 1995-2022 Jean-loup Gailly, Mark Adler -// 1995-2022 Mark Adler -// 2004-2019 Mark Adler -// 1990, 1994, 1998 The Open Group -// 2005-2022 David Turner, Robert Wilhelm, and Werner Lemberg. -// 1995-2019 Mark Adler -// 2018-2022 David Turner, Robert Wilhelm, Dominik R\x{00c3}\x{00b6}ttsches, and Werner Lemberg. -// 2004-2022 suzuki toshiya, Masatake YAMATO, Red Hat K.K., -// -// License: public-domain -// Copyright: 2001 Alexander Peslyak and it is hereby released to the -// -// License: Zlib -// Copyright: 1995-2022 Jean-loup Gailly and Mark Adler -// -// License: Expat -// Copyright: 2000-2001, 2004 Francesco Zappa Nardelli -// 2001-2004 Francesco Zappa Nardelli -// 2003 Francesco Zappa Nardelli -// 2001-2015 Francesco Zappa Nardelli -// 2001-2004, 2011 Francesco Zappa Nardelli -// 2000-2002 Francesco Zappa Nardelli -// 2000 Computing Research Labs, New Mexico State University -// 2001-2014 Francesco Zappa Nardelli -// 2001-2002, 2012 Francesco Zappa Nardelli -// 2001-2002 Francesco Zappa Nardelli -// 2001-2008, 2011, 2013-2014 Francesco Zappa Nardelli -// 2000-2003, 2006, 2010 Francesco Zappa Nardelli -// 2000-2001, 2003 Francesco Zappa Nardelli -// 2000-2004, 2006-2011, 2013-2014 Francesco Zappa Nardelli -// 2000-2010, 2012-2014 Francesco Zappa Nardelli -// -// License: BSL-1.0 -// Copyright: 2019 nyorain -// -// # Project: fribidi -// License: LGPL-2.1+ -// Copyright: 1999-2000, 2017 Dov Grobgeld -// 1999-2000 Dov Grobgeld -// 2004 Behdad Esfahbod -// 2001-2002, 2004 Behdad Esfahbod -// 2009 Behdad Esfahbod -// 2017 Dov Grobgeld -// 2004-2005 Behdad Esfahbod -// 2004 Sharif FarsiWeb, Inc. -// 2015, 2017 Dov Grobgeld -// 2005 Behdad Esfahbod -// 2001 Behdad Esfahbod. -// 2001-2002 Behdad Esfahbod -// 2004 Sharif FarsiWeb, Inc -// -// # Project: fontconfig -// License: NTP~disclaimer -// Copyright: 2002 Keith Packard -// 2009 Roozbeh Pournader -// 2000 Tuomas J. Lukka -// 2006 Keith Packard -// 2008 Red Hat, Inc. -// 2000-2007 Keith Packard / 2005 Patrick Lam / 2009 Roozbeh Pournader / 2008,2009 Red Hat, Inc. / 2008 Danilo Šegan / 2012 Google, Inc. -// 2001 Keith Packard -// 2012 Google, Inc. -// 2012 Red Hat, Inc. -// 2013 Raimund Steger -// 2008,2009 Red Hat, Inc. -// 2000-2007 Keith Packard -// 2005 Patrick Lam -// 2003 Keith Packard -// 2020 Zoltan Vandrus -// \x{00e6}\x{0081}\x{00af} 2010 Behdad Esfahbod -// 2014 Red Hat, Inc. -// 2018 Akira TAGOH -// 2007 Keith Packard -// \x{00e6}\x{0081}\x{00af} 2006 Keith Packard -// 2008 Danilo Šegan -// 2015 Akira TAGOH -// 2016 Akira TAGOH -// 2008-2009 Red Hat, Inc. -// 2000 Keith Packard -// 2013 Akira TAGOH -// 2013 Google, Inc. -// 2010 Behdad Esfahbod -// -// License: MIT~old -// Copyright: 2009-2010 Red Hat, Inc. -// 2011-2013 Google, Inc. -// 2007 Chris Wilson -// -// License: public-domain -// Copyright: 2008,2009 Red Hat, Inc. -// 2009 Roozbeh Pournader -// 2012 Google, Inc. -// 2008 Danilo Šegan -// 2005 Patrick Lam -// 2000-2007 Keith Packard -// -// License: Expat -// Copyright: 2002-2003 Juliusz Chroboczek -// -// # Project: harfbuzz -// License: NTP~disclaimer -// Copyright: 2002 Keith Packard -// 2014 Google, Inc. -// -// License: MIT~old -// Copyright: 2012 Mozilla Foundation. -// 2004, 2007, 2009 Red Hat, Inc. -// 2009 Red Hat, Inc. -// 2015 Google, Inc. -// 2014 Google, Inc. -// 2018 Ebrahim Byagowi -// 2016 Igalia S.L. -// 2018 Ebrahim Byagowi. -// 2011 Martin Hosken -// 2019 Ebrahim Byagowi -// 1998-2004 David Turner and Werner Lemberg -// 2020 Ebrahim Byagowi -// 2013 Red Hat, Inc. -// 2011-2012 Google, Inc. -// 2011 SIL International -// 2018 Khaled Hosny -// 2018 Google, Inc. -// 2019-2020 Ebrahim Byagowi -// 2022 Google, Inc. -// 2012 Google, Inc. -// 2017 Google, Inc. -// 2007-2009 Red Hat, Inc. -// 2011 Codethink Limited -// 2013 Google, Inc. -// 2015-2019 Ebrahim Byagowi -// 2016 Google, Inc. -// 2011 Google, Inc. -// -// # Project: libass -// License: public-domain -// Copyright: 2006-2016 libass contributors -// -// License: NTP -// Copyright: 1994 Sun Microsystems, Inc. -// 2016 Oleg Oshmyan -// 1988-1993 The Regents of the University of California. -// -// License: ISC -// Copyright: 2015 Oleg Oshmyan -// 2011-2014 Yu Zhuohuang -// 2013 rcombs -// 2016 Vabishchevich Nikolay -// 2022 libass contributors -// 2015 Stephan Vedder -// 2015 Vabishchevich Nikolay -// interest in the -// 2006-2016 libass contributors -// 2021 libass contributors -// 2017 Vabishchevich Nikolay -// 2011 Grigori Goronzy -// 2010 Grigori Goronzy -// 2014 Vabishchevich Nikolay -// 2015 Grigori Goronzy -// 2013 Stefano Pigozzi -// 2006 Evgeniy Stepanov -// 2009 Grigori Goronzy -// -// # The following section contains the full license text or -// # where permitted a shorter notice for all works contained -// # in JavascriptSubtitlesOctopus listed above -// # -// # Note that the shortnames used here are identical to those used by Debian -// # and will in some cases differ from SPDX identifiers. See below. -// # -// # Debian-name | SPDX-name -// # ---------------+------------------- -// # MIT~old | MIT-Modern-Variant -// # Expat | MIT -// # NTP~disclaimer | (None; it is NTP with a more verbose warranty disclaimer) -// -// License: Expat -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// . -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// . -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// License: FTL -// Portions of this software are copyright © 2021 The FreeType -// Project (www.freetype.org). All rights reserved. -// A copy of the FreeType License can be obtained at -// https://gitlab.freedesktop.org/freetype/freetype/-/blob/master/docs/FTL.TXT -// -// License: ISC -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// . -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// License: MIT~old -// Permission is hereby granted, without written agreement and without -// license or royalty fees, to use, copy, modify, and distribute this -// software and its documentation for any purpose, provided that the -// above copyright notice and the following two paragraphs appear in -// all copies of this software. -// . -// IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR -// DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES -// ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN -// IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// . -// THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, -// BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND -// FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS -// ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO -// PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS -// -// License: NTP -// Permission to use, copy, modify, and distribute this -// software and its documentation for any purpose and without -// fee is hereby granted, provided that the above copyright -// notice appear in all copies. The University of California -// makes no representations about the suitability of this -// software for any purpose. It is provided "as is" without -// express or implied warranty. -// -// License: NTP~disclaimer -// Permission to use, copy, modify, distribute, and sell this software and its -// documentation for any purpose is hereby granted without fee, provided that -// the above copyright notice appear in all copies and that both that -// copyright notice and this permission notice appear in supporting -// documentation, and that the name of the author(s) not be used in -// advertising or publicity pertaining to distribution of the software without -// specific, written prior permission. The authors make no -// representations about the suitability of this software for any purpose. It -// is provided "as is" without express or implied warranty. -// . -// THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -// INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO -// EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR -// CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, -// DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER -// TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -// PERFORMANCE OF THIS SOFTWARE. -// -// License: Zlib -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// . -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// . -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would be -// appreciated but is not required. -// 2. Altered source versions must be plainly marked as such, and must not be -// misrepresented as being the original software. -// 3. This notice may not be removed or altered from any source distribution. -// -// License: BSL-1 -// Boost Software License - Version 1.0 - August 17th, 2003 -// . -// Permission is hereby granted, free of charge, to any person or organization -// obtaining a copy of the software and accompanying documentation covered by -// this license (the "Software") to use, reproduce, display, distribute, -// execute, and transmit the Software, and to prepare derivative works of the -// Software, and to permit third-parties to whom the Software is furnished to -// do so, all subject to the following: -// . -// The copyright notices in the Software and this entire statement, including -// the above license grant, this restriction and the following disclaimer, -// must be included in all copies of the Software, in whole or in part, and -// all derivative works of the Software, unless such copies or derivative -// works are solely in the form of machine-executable object code generated by -// a source language processor. -// . -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT -// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE -// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. -// -// License: LGPL-2.1 -// GNU LESSER GENERAL PUBLIC LICENSE -// Version 2.1, February 1999 -// . -// Copyright (C) 1991, 1999 Free Software Foundation, Inc. -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -// Everyone is permitted to copy and distribute verbatim copies -// of this license document, but changing it is not allowed. -// . -// [This is the first released version of the Lesser GPL. It also counts -// as the successor of the GNU Library Public License, version 2, hence -// the version number 2.1.] -// . -// Preamble -// . -// The licenses for most software are designed to take away your -// freedom to share and change it. By contrast, the GNU General Public -// Licenses are intended to guarantee your freedom to share and change -// free software--to make sure the software is free for all its users. -// . -// This license, the Lesser General Public License, applies to some -// specially designated software packages--typically libraries--of the -// Free Software Foundation and other authors who decide to use it. You -// can use it too, but we suggest you first think carefully about whether -// this license or the ordinary General Public License is the better -// strategy to use in any particular case, based on the explanations below. -// . -// When we speak of free software, we are referring to freedom of use, -// not price. Our General Public Licenses are designed to make sure that -// you have the freedom to distribute copies of free software (and charge -// for this service if you wish); that you receive source code or can get -// it if you want it; that you can change the software and use pieces of -// it in new free programs; and that you are informed that you can do -// these things. -// . -// To protect your rights, we need to make restrictions that forbid -// distributors to deny you these rights or to ask you to surrender these -// rights. These restrictions translate to certain responsibilities for -// you if you distribute copies of the library or if you modify it. -// . -// For example, if you distribute copies of the library, whether gratis -// or for a fee, you must give the recipients all the rights that we gave -// you. You must make sure that they, too, receive or can get the source -// code. If you link other code with the library, you must provide -// complete object files to the recipients, so that they can relink them -// with the library after making changes to the library and recompiling -// it. And you must show them these terms so they know their rights. -// . -// We protect your rights with a two-step method: (1) we copyright the -// library, and (2) we offer you this license, which gives you legal -// permission to copy, distribute and/or modify the library. -// . -// To protect each distributor, we want to make it very clear that -// there is no warranty for the free library. Also, if the library is -// modified by someone else and passed on, the recipients should know -// that what they have is not the original version, so that the original -// author's reputation will not be affected by problems that might be -// introduced by others. -// . -// Finally, software patents pose a constant threat to the existence of -// any free program. We wish to make sure that a company cannot -// effectively restrict the users of a free program by obtaining a -// restrictive license from a patent holder. Therefore, we insist that -// any patent license obtained for a version of the library must be -// consistent with the full freedom of use specified in this license. -// . -// Most GNU software, including some libraries, is covered by the -// ordinary GNU General Public License. This license, the GNU Lesser -// General Public License, applies to certain designated libraries, and -// is quite different from the ordinary General Public License. We use -// this license for certain libraries in order to permit linking those -// libraries into non-free programs. -// . -// When a program is linked with a library, whether statically or using -// a shared library, the combination of the two is legally speaking a -// combined work, a derivative of the original library. The ordinary -// General Public License therefore permits such linking only if the -// entire combination fits its criteria of freedom. The Lesser General -// Public License permits more lax criteria for linking other code with -// the library. -// . -// We call this license the "Lesser" General Public License because it -// does Less to protect the user's freedom than the ordinary General -// Public License. It also provides other free software developers Less -// of an advantage over competing non-free programs. These disadvantages -// are the reason we use the ordinary General Public License for many -// libraries. However, the Lesser license provides advantages in certain -// special circumstances. -// . -// For example, on rare occasions, there may be a special need to -// encourage the widest possible use of a certain library, so that it becomes -// a de-facto standard. To achieve this, non-free programs must be -// allowed to use the library. A more frequent case is that a free -// library does the same job as widely used non-free libraries. In this -// case, there is little to gain by limiting the free library to free -// software only, so we use the Lesser General Public License. -// . -// In other cases, permission to use a particular library in non-free -// programs enables a greater number of people to use a large body of -// free software. For example, permission to use the GNU C Library in -// non-free programs enables many more people to use the whole GNU -// operating system, as well as its variant, the GNU/Linux operating -// system. -// . -// Although the Lesser General Public License is Less protective of the -// users' freedom, it does ensure that the user of a program that is -// linked with the Library has the freedom and the wherewithal to run -// that program using a modified version of the Library. -// . -// The precise terms and conditions for copying, distribution and -// modification follow. Pay close attention to the difference between a -// "work based on the library" and a "work that uses the library". The -// former contains code derived from the library, whereas the latter must -// be combined with the library in order to run. -// . -// GNU LESSER GENERAL PUBLIC LICENSE -// TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION -// . -// 0. This License Agreement applies to any software library or other -// program which contains a notice placed by the copyright holder or -// other authorized party saying it may be distributed under the terms of -// this Lesser General Public License (also called "this License"). -// Each licensee is addressed as "you". -// . -// A "library" means a collection of software functions and/or data -// prepared so as to be conveniently linked with application programs -// (which use some of those functions and data) to form executables. -// . -// The "Library", below, refers to any such software library or work -// which has been distributed under these terms. A "work based on the -// Library" means either the Library or any derivative work under -// copyright law: that is to say, a work containing the Library or a -// portion of it, either verbatim or with modifications and/or translated -// straightforwardly into another language. (Hereinafter, translation is -// included without limitation in the term "modification".) -// . -// "Source code" for a work means the preferred form of the work for -// making modifications to it. For a library, complete source code means -// all the source code for all modules it contains, plus any associated -// interface definition files, plus the scripts used to control compilation -// and installation of the library. -// . -// Activities other than copying, distribution and modification are not -// covered by this License; they are outside its scope. The act of -// running a program using the Library is not restricted, and output from -// such a program is covered only if its contents constitute a work based -// on the Library (independent of the use of the Library in a tool for -// writing it). Whether that is true depends on what the Library does -// and what the program that uses the Library does. -// -// 1. You may copy and distribute verbatim copies of the Library's -// complete source code as you receive it, in any medium, provided that -// you conspicuously and appropriately publish on each copy an -// appropriate copyright notice and disclaimer of warranty; keep intact -// all the notices that refer to this License and to the absence of any -// warranty; and distribute a copy of this License along with the -// Library. -// . -// You may charge a fee for the physical act of transferring a copy, -// and you may at your option offer warranty protection in exchange for a -// fee. -// . -// 2. You may modify your copy or copies of the Library or any portion -// of it, thus forming a work based on the Library, and copy and -// distribute such modifications or work under the terms of Section 1 -// above, provided that you also meet all of these conditions: -// . -// a) The modified work must itself be a software library. -// . -// b) You must cause the files modified to carry prominent notices -// stating that you changed the files and the date of any change. -// . -// c) You must cause the whole of the work to be licensed at no -// charge to all third parties under the terms of this License. -// . -// d) If a facility in the modified Library refers to a function or a -// table of data to be supplied by an application program that uses -// the facility, other than as an argument passed when the facility -// is invoked, then you must make a good faith effort to ensure that, -// in the event an application does not supply such function or -// table, the facility still operates, and performs whatever part of -// its purpose remains meaningful. -// . -// (For example, a function in a library to compute square roots has -// a purpose that is entirely well-defined independent of the -// application. Therefore, Subsection 2d requires that any -// application-supplied function or table used by this function must -// be optional: if the application does not supply it, the square -// root function must still compute square roots.) -// . -// These requirements apply to the modified work as a whole. If -// identifiable sections of that work are not derived from the Library, -// and can be reasonably considered independent and separate works in -// themselves, then this License, and its terms, do not apply to those -// sections when you distribute them as separate works. But when you -// distribute the same sections as part of a whole which is a work based -// on the Library, the distribution of the whole must be on the terms of -// this License, whose permissions for other licensees extend to the -// entire whole, and thus to each and every part regardless of who wrote -// it. -// . -// Thus, it is not the intent of this section to claim rights or contest -// your rights to work written entirely by you; rather, the intent is to -// exercise the right to control the distribution of derivative or -// collective works based on the Library. -// . -// In addition, mere aggregation of another work not based on the Library -// with the Library (or with a work based on the Library) on a volume of -// a storage or distribution medium does not bring the other work under -// the scope of this License. -// . -// 3. You may opt to apply the terms of the ordinary GNU General Public -// License instead of this License to a given copy of the Library. To do -// this, you must alter all the notices that refer to this License, so -// that they refer to the ordinary GNU General Public License, version 2, -// instead of to this License. (If a newer version than version 2 of the -// ordinary GNU General Public License has appeared, then you can specify -// that version instead if you wish.) Do not make any other change in -// these notices. -// . -// Once this change is made in a given copy, it is irreversible for -// that copy, so the ordinary GNU General Public License applies to all -// subsequent copies and derivative works made from that copy. -// . -// This option is useful when you wish to copy part of the code of -// the Library into a program that is not a library. -// . -// 4. You may copy and distribute the Library (or a portion or -// derivative of it, under Section 2) in object code or executable form -// under the terms of Sections 1 and 2 above provided that you accompany -// it with the complete corresponding machine-readable source code, which -// must be distributed under the terms of Sections 1 and 2 above on a -// medium customarily used for software interchange. -// . -// If distribution of object code is made by offering access to copy -// from a designated place, then offering equivalent access to copy the -// source code from the same place satisfies the requirement to -// distribute the source code, even though third parties are not -// compelled to copy the source along with the object code. -// . -// 5. A program that contains no derivative of any portion of the -// Library, but is designed to work with the Library by being compiled or -// linked with it, is called a "work that uses the Library". Such a -// work, in isolation, is not a derivative work of the Library, and -// therefore falls outside the scope of this License. -// . -// However, linking a "work that uses the Library" with the Library -// creates an executable that is a derivative of the Library (because it -// contains portions of the Library), rather than a "work that uses the -// library". The executable is therefore covered by this License. -// Section 6 states terms for distribution of such executables. -// . -// When a "work that uses the Library" uses material from a header file -// that is part of the Library, the object code for the work may be a -// derivative work of the Library even though the source code is not. -// Whether this is true is especially significant if the work can be -// linked without the Library, or if the work is itself a library. The -// threshold for this to be true is not precisely defined by law. -// . -// If such an object file uses only numerical parameters, data -// structure layouts and accessors, and small macros and small inline -// functions (ten lines or less in length), then the use of the object -// file is unrestricted, regardless of whether it is legally a derivative -// work. (Executables containing this object code plus portions of the -// Library will still fall under Section 6.) -// . -// Otherwise, if the work is a derivative of the Library, you may -// distribute the object code for the work under the terms of Section 6. -// Any executables containing that work also fall under Section 6, -// whether or not they are linked directly with the Library itself. -// . -// 6. As an exception to the Sections above, you may also combine or -// link a "work that uses the Library" with the Library to produce a -// work containing portions of the Library, and distribute that work -// under terms of your choice, provided that the terms permit -// modification of the work for the customer's own use and reverse -// engineering for debugging such modifications. -// . -// You must give prominent notice with each copy of the work that the -// Library is used in it and that the Library and its use are covered by -// this License. You must supply a copy of this License. If the work -// during execution displays copyright notices, you must include the -// copyright notice for the Library among them, as well as a reference -// directing the user to the copy of this License. Also, you must do one -// of these things: -// . -// a) Accompany the work with the complete corresponding -// machine-readable source code for the Library including whatever -// changes were used in the work (which must be distributed under -// Sections 1 and 2 above); and, if the work is an executable linked -// with the Library, with the complete machine-readable "work that -// uses the Library", as object code and/or source code, so that the -// user can modify the Library and then relink to produce a modified -// executable containing the modified Library. (It is understood -// that the user who changes the contents of definitions files in the -// Library will not necessarily be able to recompile the application -// to use the modified definitions.) -// . -// b) Use a suitable shared library mechanism for linking with the -// Library. A suitable mechanism is one that (1) uses at run time a -// copy of the library already present on the user's computer system, -// rather than copying library functions into the executable, and (2) -// will operate properly with a modified version of the library, if -// the user installs one, as long as the modified version is -// interface-compatible with the version that the work was made with. -// . -// c) Accompany the work with a written offer, valid for at -// least three years, to give the same user the materials -// specified in Subsection 6a, above, for a charge no more -// than the cost of performing this distribution. -// . -// d) If distribution of the work is made by offering access to copy -// from a designated place, offer equivalent access to copy the above -// specified materials from the same place. -// . -// e) Verify that the user has already received a copy of these -// materials or that you have already sent this user a copy. -// . -// For an executable, the required form of the "work that uses the -// Library" must include any data and utility programs needed for -// reproducing the executable from it. However, as a special exception, -// the materials to be distributed need not include anything that is -// normally distributed (in either source or binary form) with the major -// components (compiler, kernel, and so on) of the operating system on -// which the executable runs, unless that component itself accompanies -// the executable. -// . -// It may happen that this requirement contradicts the license -// restrictions of other proprietary libraries that do not normally -// accompany the operating system. Such a contradiction means you cannot -// use both them and the Library together in an executable that you -// distribute. -// . -// 7. You may place library facilities that are a work based on the -// Library side-by-side in a single library together with other library -// facilities not covered by this License, and distribute such a combined -// library, provided that the separate distribution of the work based on -// the Library and of the other library facilities is otherwise -// permitted, and provided that you do these two things: -// . -// a) Accompany the combined library with a copy of the same work -// based on the Library, uncombined with any other library -// facilities. This must be distributed under the terms of the -// Sections above. -// . -// b) Give prominent notice with the combined library of the fact -// that part of it is a work based on the Library, and explaining -// where to find the accompanying uncombined form of the same work. -// . -// 8. You may not copy, modify, sublicense, link with, or distribute -// the Library except as expressly provided under this License. Any -// attempt otherwise to copy, modify, sublicense, link with, or -// distribute the Library is void, and will automatically terminate your -// rights under this License. However, parties who have received copies, -// or rights, from you under this License will not have their licenses -// terminated so long as such parties remain in full compliance. -// . -// 9. You are not required to accept this License, since you have not -// signed it. However, nothing else grants you permission to modify or -// distribute the Library or its derivative works. These actions are -// prohibited by law if you do not accept this License. Therefore, by -// modifying or distributing the Library (or any work based on the -// Library), you indicate your acceptance of this License to do so, and -// all its terms and conditions for copying, distributing or modifying -// the Library or works based on it. -// . -// 10. Each time you redistribute the Library (or any work based on the -// Library), the recipient automatically receives a license from the -// original licensor to copy, distribute, link with or modify the Library -// subject to these terms and conditions. You may not impose any further -// restrictions on the recipients' exercise of the rights granted herein. -// You are not responsible for enforcing compliance by third parties with -// this License. -// . -// 11. If, as a consequence of a court judgment or allegation of patent -// infringement or for any other reason (not limited to patent issues), -// conditions are imposed on you (whether by court order, agreement or -// otherwise) that contradict the conditions of this License, they do not -// excuse you from the conditions of this License. If you cannot -// distribute so as to satisfy simultaneously your obligations under this -// License and any other pertinent obligations, then as a consequence you -// may not distribute the Library at all. For example, if a patent -// license would not permit royalty-free redistribution of the Library by -// all those who receive copies directly or indirectly through you, then -// the only way you could satisfy both it and this License would be to -// refrain entirely from distribution of the Library. -// . -// If any portion of this section is held invalid or unenforceable under any -// particular circumstance, the balance of the section is intended to apply, -// and the section as a whole is intended to apply in other circumstances. -// . -// It is not the purpose of this section to induce you to infringe any -// patents or other property right claims or to contest validity of any -// such claims; this section has the sole purpose of protecting the -// integrity of the free software distribution system which is -// implemented by public license practices. Many people have made -// generous contributions to the wide range of software distributed -// through that system in reliance on consistent application of that -// system; it is up to the author/donor to decide if he or she is willing -// to distribute software through any other system and a licensee cannot -// impose that choice. -// . -// This section is intended to make thoroughly clear what is believed to -// be a consequence of the rest of this License. -// . -// 12. If the distribution and/or use of the Library is restricted in -// certain countries either by patents or by copyrighted interfaces, the -// original copyright holder who places the Library under this License may add -// an explicit geographical distribution limitation excluding those countries, -// so that distribution is permitted only in or among countries not thus -// excluded. In such case, this License incorporates the limitation as if -// written in the body of this License. -// . -// 13. The Free Software Foundation may publish revised and/or new -// versions of the Lesser General Public License from time to time. -// Such new versions will be similar in spirit to the present version, -// but may differ in detail to address new problems or concerns. -// . -// Each version is given a distinguishing version number. If the Library -// specifies a version number of this License which applies to it and -// "any later version", you have the option of following the terms and -// conditions either of that version or of any later version published by -// the Free Software Foundation. If the Library does not specify a -// license version number, you may choose any version ever published by -// the Free Software Foundation. -// . -// 14. If you wish to incorporate parts of the Library into other free -// programs whose distribution conditions are incompatible with these, -// write to the author to ask for permission. For software which is -// copyrighted by the Free Software Foundation, write to the Free -// Software Foundation; we sometimes make exceptions for this. Our -// decision will be guided by the two goals of preserving the free status -// of all derivatives of our free software and of promoting the sharing -// and reuse of software generally. -// . -// NO WARRANTY -// . -// 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -// WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -// EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -// OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -// LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -// THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. -// . -// 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -// WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -// AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -// FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -// CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -// LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -// RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -// FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -// SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGES. -// . -// END OF TERMS AND CONDITIONS -// . -// How to Apply These Terms to Your New Libraries -// . -// If you develop a new library, and you want it to be of the greatest -// possible use to the public, we recommend making it free software that -// everyone can redistribute and change. You can do so by permitting -// redistribution under these terms (or, alternatively, under the terms of the -// ordinary General Public License). -// . -// To apply these terms, attach the following notices to the library. It is -// safest to attach them to the start of each source file to most effectively -// convey the exclusion of warranty; and each file should have at least the -// "copyright" line and a pointer to where the full notice is found. -// . -// -// Copyright (C) -// . -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// . -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// . -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -// . -// Also add information on how to contact you by electronic and paper mail. -// . -// You should also get your employer (if you work as a programmer) or your -// school, if any, to sign a "copyright disclaimer" for the library, if -// necessary. Here is a sample; alter the names: -// . -// Yoyodyne, Inc., hereby disclaims all copyright interest in the -// library `Frob' (a library for tweaking knobs) written by James Random Hacker. -// . -// , 1 April 1990 -// Ty Coon, President of Vice -// . -// That's all there is to it! -"use strict"; -var SubtitlesOctopus = function(options) { - var supportsWebAssembly = false; - try { - if (typeof WebAssembly === "object" && typeof WebAssembly.instantiate === "function") { - const module1 = new WebAssembly.Module(Uint8Array.of(0x0, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00)); - if (module1 instanceof WebAssembly.Module) supportsWebAssembly = new WebAssembly.Instance(module1) instanceof WebAssembly.Instance; - } - } catch (e) {} - console.log("WebAssembly support detected: " + (supportsWebAssembly ? "yes" : "no")); - var self = this; - self.canvas = options.canvas; // HTML canvas element (optional if video specified) - self.renderMode = options.renderMode || (options.lossyRender ? 'lossy' : 'wasm-blend'); - self.libassMemoryLimit = options.libassMemoryLimit || 0; - self.libassGlyphLimit = options.libassGlyphLimit || 0; - self.targetFps = options.targetFps || 24; - self.prescaleFactor = options.prescaleFactor || 1.0; - self.prescaleHeightLimit = options.prescaleHeightLimit || 1080; - self.maxRenderHeight = options.maxRenderHeight || 0; // 0 - no limit - self.dropAllAnimations = options.dropAllAnimations || false; // attempt to remove all animations as a last ditch effort for displaying on weak hardware; may severly mangle subtitles if enabled - self.isOurCanvas = false; // (internal) we created canvas and manage it - self.video = options.video; // HTML video element (optional if canvas specified) - self.canvasParent = null; // (internal) HTML canvas parent element - self.fonts = options.fonts || []; // Array with links to fonts used in sub (optional) - self.availableFonts = options.availableFonts || []; // Object with all available fonts (optional). Key is font name in lower case, value is link: {"arial": "/font1.ttf"} - self.fallbackFont = options.fallbackFont || 'default.woff2'; // URL to override fallback font, for example, with a CJK one. Default fallback font is Liberation Sans (Optional) - self.lazyFileLoading = options.lazyFileLoading || false; // Load fonts in a lazy way. Requires Access-Control-Expose-Headers for Accept-Ranges, Content-Length, and Content-Encoding. If Content-Encoding is compressed, file will be fully fetched instead of just a HEAD request. - self.onReadyEvent = options.onReady; // Function called when SubtitlesOctopus is ready (optional) - if (supportsWebAssembly) self.workerUrl = options.workerUrl || 'subtitles-octopus-worker.js'; // Link to WebAssembly worker - else self.workerUrl = options.legacyWorkerUrl || 'subtitles-octopus-worker-legacy.js'; // Link to legacy worker - self.subUrl = options.subUrl; // Link to sub file (optional if subContent specified) - self.subContent = options.subContent || null; // Sub content (optional if subUrl specified) - self.onErrorEvent = options.onError; // Function called in case of critical error meaning sub wouldn't be shown and you should use alternative method (for instance it occurs if browser doesn't support web workers). - self.debug = options.debug || false; // When debug enabled, some performance info printed in console. - self.lastRenderTime = 0; // (internal) Last time we got some frame from worker - self.pixelRatio = window.devicePixelRatio || 1; // (internal) Device pixel ratio (for high dpi devices) - self.timeOffset = options.timeOffset || 0; // Time offset would be applied to currentTime from video (option) - self.hasAlphaBug = false; - (function() { - if (typeof ImageData.prototype.constructor === 'function') try { - // try actually calling ImageData, as on some browsers it's reported - // as existing but calling it errors out as "TypeError: Illegal constructor" - new window.ImageData(new Uint8ClampedArray([ - 0, - 0, - 0, - 0 - ]), 1, 1); - return; - } catch (e) { - console.log("detected that ImageData is not constructable despite browser saying so"); - } - var canvas = document.createElement('canvas'); - var ctx = canvas.getContext('2d'); - window.ImageData = function() { - var i = 0; - if (arguments[0] instanceof Uint8ClampedArray) var data = arguments[i++]; - var width = arguments[i++]; - var height = arguments[i]; - var imageData = ctx.createImageData(width, height); - if (data) imageData.data.set(data); - return imageData; - }; - })(); - self.workerError = function(error) { - console.error('Worker error: ', error); - if (self.onErrorEvent) self.onErrorEvent(error); - if (!self.debug) { - self.dispose(); - throw new Error('Worker error: ' + error); - } - }; - // Not tested for repeated usage yet - self.init = function() { - if (!window.Worker) { - self.workerError('worker not supported'); - return; - } - // Worker - if (!self.worker) { - self.worker = new Worker(self.workerUrl); - self.worker.addEventListener('message', self.onWorkerMessage); - self.worker.addEventListener('error', self.workerError); - } - self.workerActive = false; - self.createCanvas(); - self.setVideo(options.video); - self.setSubUrl(options.subUrl); - self.worker.postMessage({ - target: 'worker-init', - width: self.canvas.width, - height: self.canvas.height, - URL: document.URL, - currentScript: self.workerUrl, - preMain: true, - renderMode: self.renderMode, - subUrl: self.subUrl, - subContent: self.subContent, - fonts: self.fonts, - availableFonts: self.availableFonts, - fallbackFont: self.fallbackFont, - lazyFileLoading: self.lazyFileLoading, - debug: self.debug, - targetFps: self.targetFps, - libassMemoryLimit: self.libassMemoryLimit, - libassGlyphLimit: self.libassGlyphLimit, - dropAllAnimations: self.dropAllAnimations - }); - }; - self.createCanvas = function() { - if (!self.canvas) { - if (self.video) { - self.isOurCanvas = true; - self.canvas = document.createElement('canvas'); - self.canvas.className = 'libassjs-canvas'; - self.canvas.style.display = 'none'; - self.canvasParent = document.createElement('div'); - self.canvasParent.className = 'libassjs-canvas-parent'; - self.canvasParent.appendChild(self.canvas); - if (self.video.nextSibling) self.video.parentNode.insertBefore(self.canvasParent, self.video.nextSibling); - else self.video.parentNode.appendChild(self.canvasParent); - } else if (!self.canvas) self.workerError('Don\'t know where to render: you should give video or canvas in options.'); - } - self.ctx = self.canvas.getContext('2d'); - self.bufferCanvas = document.createElement('canvas'); - self.bufferCanvasCtx = self.bufferCanvas.getContext('2d'); - // test for alpha bug, where e.g. WebKit can render a transparent pixel - // (with alpha == 0) as non-black which then leads to visual artifacts - self.bufferCanvas.width = 1; - self.bufferCanvas.height = 1; - var testBuf = new Uint8ClampedArray([ - 0, - 255, - 0, - 0 - ]); - var testImage = new ImageData(testBuf, 1, 1); - self.bufferCanvasCtx.clearRect(0, 0, 1, 1); - self.ctx.clearRect(0, 0, 1, 1); - var prePut = self.ctx.getImageData(0, 0, 1, 1).data; - self.bufferCanvasCtx.putImageData(testImage, 0, 0); - self.ctx.drawImage(self.bufferCanvas, 0, 0); - var postPut = self.ctx.getImageData(0, 0, 1, 1).data; - self.hasAlphaBug = prePut[1] != postPut[1]; - if (self.hasAlphaBug) console.log("Detected a browser having issue with transparent pixels, applying workaround"); - }; - function onTimeUpdate() { - self.setCurrentTime(self.video.currentTime + self.timeOffset); - } - function onPlaying() { - self.setIsPaused(false, self.video.currentTime + self.timeOffset); - } - function onPause() { - self.setIsPaused(true, self.video.currentTime + self.timeOffset); - } - function onSeeking() { - self.video.removeEventListener('timeupdate', onTimeUpdate, false); - } - function onSeeked() { - self.video.addEventListener('timeupdate', onTimeUpdate, false); - var currentTime = self.video.currentTime + self.timeOffset; - self.setCurrentTime(currentTime); - } - function onRateChange() { - self.setRate(self.video.playbackRate); - } - function onWaiting() { - self.setIsPaused(true, self.video.currentTime + self.timeOffset); - } - function onLoadedMetadata(e) { - e.target.removeEventListener(e.type, onLoadedMetadata, false); - self.resize(); - } - self.setVideo = function(video) { - self.video = video; - if (self.video) { - self.video.addEventListener('timeupdate', onTimeUpdate, false); - self.video.addEventListener('playing', onPlaying, false); - self.video.addEventListener('pause', onPause, false); - self.video.addEventListener('seeking', onSeeking, false); - self.video.addEventListener('seeked', onSeeked, false); - self.video.addEventListener('ratechange', onRateChange, false); - self.video.addEventListener('waiting', onWaiting, false); - document.addEventListener("fullscreenchange", self.resizeWithTimeout, false); - document.addEventListener("mozfullscreenchange", self.resizeWithTimeout, false); - document.addEventListener("webkitfullscreenchange", self.resizeWithTimeout, false); - document.addEventListener("msfullscreenchange", self.resizeWithTimeout, false); - window.addEventListener("resize", self.resizeWithTimeout, false); - // Support Element Resize Observer - if (typeof ResizeObserver !== "undefined") { - self.ro = new ResizeObserver(self.resizeWithTimeout); - self.ro.observe(self.video); - } - if (self.video.videoWidth > 0) self.resize(); - else self.video.addEventListener('loadedmetadata', onLoadedMetadata, false); - } - }; - self.getVideoPosition = function() { - var videoRatio = self.video.videoWidth / self.video.videoHeight; - var width = self.video.offsetWidth, height = self.video.offsetHeight; - var elementRatio = width / height; - var realWidth = width, realHeight = height; - if (elementRatio > videoRatio) realWidth = Math.floor(height * videoRatio); - else realHeight = Math.floor(width / videoRatio); - var x = (width - realWidth) / 2; - var y = (height - realHeight) / 2; - return { - width: realWidth, - height: realHeight, - x: x, - y: y - }; - }; - self.setSubUrl = function(subUrl) { - self.subUrl = subUrl; - }; - self.renderFrameData = null; - function renderFrames() { - var data = self.renderFramesData; - var beforeDrawTime = performance.now(); - self.ctx.clearRect(0, 0, self.canvas.width, self.canvas.height); - for(var i = 0; i < data.canvases.length; i++){ - var image = data.canvases[i]; - self.bufferCanvas.width = image.w; - self.bufferCanvas.height = image.h; - var imageBuffer = new Uint8ClampedArray(image.buffer); - if (self.hasAlphaBug) for(var j = 3; j < imageBuffer.length; j = j + 4)imageBuffer[j] = imageBuffer[j] >= 1 ? imageBuffer[j] : 1; - var imageData = new ImageData(imageBuffer, image.w, image.h); - self.bufferCanvasCtx.putImageData(imageData, 0, 0); - self.ctx.drawImage(self.bufferCanvas, image.x, image.y); - } - if (self.debug) { - var drawTime = Math.round(performance.now() - beforeDrawTime); - var blendTime = data.blendTime; - if (typeof blendTime !== 'undefined') console.log('render: ' + Math.round(data.spentTime - blendTime) + ' ms, blend: ' + Math.round(blendTime) + ' ms, draw: ' + drawTime + ' ms; TOTAL=' + Math.round(data.spentTime + drawTime) + ' ms'); - else console.log(Math.round(data.spentTime) + ' ms (+ ' + drawTime + ' ms draw)'); - self.renderStart = performance.now(); - } - } - /** - * Lossy Render Mode - * - */ function renderFastFrames() { - var data = self.renderFramesData; - var beforeDrawTime = performance.now(); - self.ctx.clearRect(0, 0, self.canvas.width, self.canvas.height); - for(var i = 0; i < data.bitmaps.length; i++){ - var image = data.bitmaps[i]; - self.ctx.drawImage(image.bitmap, image.x, image.y); - } - if (self.debug) { - var drawTime = Math.round(performance.now() - beforeDrawTime); - console.log(data.bitmaps.length + ' bitmaps, libass: ' + Math.round(data.libassTime) + 'ms, decode: ' + Math.round(data.decodeTime) + 'ms, draw: ' + drawTime + 'ms'); - self.renderStart = performance.now(); - } - } - self.workerActive = false; - self.frameId = 0; - self.onWorkerMessage = function(event) { - //dump('\nclient got ' + JSON.stringify(event.data).substr(0, 150) + '\n'); - if (!self.workerActive) { - self.workerActive = true; - if (self.onReadyEvent) self.onReadyEvent(); - } - var data = event.data; - switch(data.target){ - case 'stdout': - console.log(data.content); - break; - case 'console-log': - console.log.apply(console, JSON.parse(data.content)); - break; - case 'console-debug': - console.debug.apply(console, JSON.parse(data.content)); - break; - case 'console-info': - console.info.apply(console, JSON.parse(data.content)); - break; - case 'console-warn': - console.warn.apply(console, JSON.parse(data.content)); - break; - case 'console-error': - console.error.apply(console, JSON.parse(data.content)); - break; - case 'stderr': - console.error(data.content); - break; - case 'window': - window[data.method](); - break; - case 'canvas': - switch(data.op){ - case 'getContext': - self.ctx = self.canvas.getContext(data.type, data.attributes); - break; - case 'resize': - self.resize(data.width, data.height); - break; - case 'renderCanvas': - if (self.lastRenderTime < data.time) { - self.lastRenderTime = data.time; - self.renderFramesData = data; - window.requestAnimationFrame(renderFrames); - } - break; - case 'renderFastCanvas': - if (self.lastRenderTime < data.time) { - self.lastRenderTime = data.time; - self.renderFramesData = data; - window.requestAnimationFrame(renderFastFrames); - } - break; - case 'setObjectProperty': - self.canvas[data.object][data.property] = data.value; - break; - default: - throw 'eh?'; - } - break; - case 'tick': - self.frameId = data.id; - self.worker.postMessage({ - target: 'tock', - id: self.frameId - }); - break; - case 'custom': - if (self['onCustomMessage']) self['onCustomMessage'](event); - else throw 'Custom message received but client onCustomMessage not implemented.'; - break; - case 'setimmediate': - self.worker.postMessage({ - target: 'setimmediate' - }); - break; - case 'get-events': - break; - case 'get-styles': - break; - case 'ready': - break; - default: - throw 'what? ' + data.target; - } - }; - function _computeCanvasSize(width, height) { - var scalefactor = self.prescaleFactor <= 0 ? 1.0 : self.prescaleFactor; - if (height <= 0 || width <= 0) { - width = 0; - height = 0; - } else { - var sgn = scalefactor < 1 ? -1 : 1; - var newH = height; - if (sgn * newH * scalefactor <= sgn * self.prescaleHeightLimit) newH *= scalefactor; - else if (sgn * newH < sgn * self.prescaleHeightLimit) newH = self.prescaleHeightLimit; - if (self.maxRenderHeight > 0 && newH > self.maxRenderHeight) newH = self.maxRenderHeight; - width *= newH / height; - height = newH; - } - return { - 'width': width, - 'height': height - }; - } - self.resize = function(width, height, top, left) { - var videoSize = null; - top = top || 0; - left = left || 0; - if ((!width || !height) && self.video) { - videoSize = self.getVideoPosition(); - var newSize = _computeCanvasSize(videoSize.width * self.pixelRatio, videoSize.height * self.pixelRatio); - width = newSize.width; - height = newSize.height; - var offset = self.canvasParent.getBoundingClientRect().top - self.video.getBoundingClientRect().top; - top = videoSize.y - offset; - left = videoSize.x; - } - if (!width || !height) { - if (!self.video) console.error('width or height is 0. You should specify width & height for resize.'); - return; - } - if (self.canvas.width != width || self.canvas.height != height || self.canvas.style.top != top || self.canvas.style.left != left) { - self.canvas.width = width; - self.canvas.height = height; - if (videoSize != null) { - self.canvasParent.style.position = 'relative'; - self.canvas.style.display = 'block'; - self.canvas.style.position = 'absolute'; - self.canvas.style.width = videoSize.width + 'px'; - self.canvas.style.height = videoSize.height + 'px'; - self.canvas.style.top = top + 'px'; - self.canvas.style.left = left + 'px'; - self.canvas.style.pointerEvents = 'none'; - } - self.worker.postMessage({ - target: 'canvas', - width: self.canvas.width, - height: self.canvas.height - }); - } - }; - self.resizeWithTimeout = function() { - self.resize(); - setTimeout(self.resize, 100); - }; - self.runBenchmark = function() { - self.worker.postMessage({ - target: 'runBenchmark' - }); - }; - self.customMessage = function(data, options) { - options = options || {}; - self.worker.postMessage({ - target: 'custom', - userData: data, - preMain: options.preMain - }); - }; - self.setCurrentTime = function(currentTime) { - self.worker.postMessage({ - target: 'video', - currentTime: currentTime - }); - }; - self.setTrackByUrl = function(url) { - self.worker.postMessage({ - target: 'set-track-by-url', - url: url - }); - }; - self.setTrack = function(content) { - self.worker.postMessage({ - target: 'set-track', - content: content - }); - }; - self.freeTrack = function(content) { - self.worker.postMessage({ - target: 'free-track' - }); - }; - self.render = self.setCurrentTime; - self.setIsPaused = function(isPaused, currentTime) { - self.worker.postMessage({ - target: 'video', - isPaused: isPaused, - currentTime: currentTime - }); - }; - self.setRate = function(rate) { - self.worker.postMessage({ - target: 'video', - rate: rate - }); - }; - self.dispose = function() { - self.worker.postMessage({ - target: 'destroy' - }); - self.worker.terminate(); - self.worker.removeEventListener('message', self.onWorkerMessage); - self.worker.removeEventListener('error', self.workerError); - self.workerActive = false; - self.worker = null; - // Remove the canvas element to remove residual subtitles rendered on player - if (self.video) { - self.video.removeEventListener('timeupdate', onTimeUpdate, false); - self.video.removeEventListener('playing', onPlaying, false); - self.video.removeEventListener('pause', onPause, false); - self.video.removeEventListener('seeking', onSeeking, false); - self.video.removeEventListener('seeked', onSeeked, false); - self.video.removeEventListener('ratechange', onRateChange, false); - self.video.removeEventListener('waiting', onWaiting, false); - self.video.removeEventListener('loadedmetadata', onLoadedMetadata, false); - document.removeEventListener('fullscreenchange', self.resizeWithTimeout, false); - document.removeEventListener('mozfullscreenchange', self.resizeWithTimeout, false); - document.removeEventListener('webkitfullscreenchange', self.resizeWithTimeout, false); - document.removeEventListener('msfullscreenchange', self.resizeWithTimeout, false); - window.removeEventListener('resize', self.resizeWithTimeout, false); - self.video.parentNode.removeChild(self.canvasParent); - self.video = null; - } - if (self.ro) { - self.ro.disconnect(); - self.ro = null; - } - self.onCustomMessage = null; - self.onErrorEvent = null; - self.onReadyEvent = null; - }; - self.fetchFromWorker = function(workerOptions, onSuccess, onError) { - try { - var target = workerOptions['target']; - var timeout = setTimeout(function() { - reject(Error('Error: Timeout while try to fetch ' + target)); - }, 5000); - var resolve = function(event) { - if (event.data.target == target) { - onSuccess(event.data); - self.worker.removeEventListener('message', resolve); - self.worker.removeEventListener('error', reject); - clearTimeout(timeout); - } - }; - var reject = function(event) { - onError(event); - self.worker.removeEventListener('message', resolve); - self.worker.removeEventListener('error', reject); - clearTimeout(timeout); - }; - self.worker.addEventListener('message', resolve); - self.worker.addEventListener('error', reject); - self.worker.postMessage(workerOptions); - } catch (error) { - onError(error); - } - }; - self.createEvent = function(event) { - self.worker.postMessage({ - target: 'create-event', - event: event - }); - }; - self.getEvents = function(onSuccess, onError) { - self.fetchFromWorker({ - target: 'get-events' - }, function(data) { - onSuccess(data.events); - }, onError); - }; - self.setEvent = function(event, index) { - self.worker.postMessage({ - target: 'set-event', - event: event, - index: index - }); - }; - self.removeEvent = function(index) { - self.worker.postMessage({ - target: 'remove-event', - index: index - }); - }; - self.createStyle = function(style) { - self.worker.postMessage({ - target: 'create-style', - style: style - }); - }; - self.getStyles = function(onSuccess, onError) { - self.fetchFromWorker({ - target: 'get-styles' - }, function(data) { - onSuccess(data.styles); - }, onError); - }; - self.setStyle = function(style, index) { - self.worker.postMessage({ - target: 'set-style', - style: style, - index: index - }); - }; - self.removeStyle = function(index) { - self.worker.postMessage({ - target: 'remove-style', - index: index - }); - }; - self.init(); -}; -if (typeof SubtitlesOctopusOnLoad == 'function') SubtitlesOctopusOnLoad(); -if (module.exports) exports = module.exports = SubtitlesOctopus; - -},{}],"8oCsH":[function(require,module,exports,__globalThis) { -exports.interopDefault = function(a) { - return a && a.__esModule ? a : { - default: a - }; -}; -exports.defineInteropFlag = function(a) { - Object.defineProperty(a, '__esModule', { - value: true - }); -}; -exports.exportAll = function(source, dest) { - Object.keys(source).forEach(function(key) { - if (key === 'default' || key === '__esModule' || Object.prototype.hasOwnProperty.call(dest, key)) return; - Object.defineProperty(dest, key, { - enumerable: true, - get: function() { - return source[key]; - } - }); - }); - return dest; -}; -exports.export = function(dest, destName, get) { - Object.defineProperty(dest, destName, { - enumerable: true, - get: get - }); -}; - -},{}]},["hVOIc"], "hVOIc", "parcelRequire4dc0", {}) - -//# sourceMappingURL=index.js.map diff --git a/docs/uncompiled/artplayer-plugin-libass/index.js.map b/docs/uncompiled/artplayer-plugin-libass/index.js.map deleted file mode 100644 index 61e7dc6cd..000000000 --- a/docs/uncompiled/artplayer-plugin-libass/index.js.map +++ /dev/null @@ -1 +0,0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AG;IAC5C,OAAO,cAAc,CAAC,MAAM,UAAU;QACpC,YAAY;QACZ,KAAK;IACP;AACF","sources":["packages/artplayer-plugin-libass/src/index.js","packages/artplayer-plugin-libass/src/adapter.js","node_modules/libass-wasm/dist/js/subtitles-octopus.js","node_modules/@parcel/transformer-js/src/esmodule-helpers.js"],"sourcesContent":["import LibassAdapter from './adapter'\n\nexport default function artplayerPluginLibass(option) {\n return (art) => {\n const adapter = new LibassAdapter(art, option)\n return {\n name: 'artplayerPluginLibass',\n libass: adapter.libass,\n visible: adapter.visible,\n init: adapter.init.bind(adapter),\n switch: adapter.switch.bind(adapter),\n show: adapter.show.bind(adapter),\n hide: adapter.hide.bind(adapter),\n destroy: adapter.destroy.bind(adapter),\n }\n }\n}\n\nif (typeof window !== 'undefined') {\n window.artplayerPluginLibass = artplayerPluginLibass\n}\n","import SubtitlesOctopus from 'libass-wasm'\n\nconst defaultAssSubtitle = `[Script Info]\\nScriptType: v4.00+`\n\nexport default class LibassAdapter {\n constructor(art, option) {\n const { constructor, template } = art\n\n this.art = art\n this.$video = template.$video\n this.$webvtt = template.$subtitle\n this.utils = constructor.utils\n\n this.libass = null\n\n art.once('ready', this.init.bind(this, option))\n }\n\n async init(option) {\n this.#checkWebAssemblySupport()\n\n await this.#createLibass(option)\n\n this.#addEventListeners()\n\n this.art.emit('artplayerPluginLibass:init', this)\n\n // set initial subtitle\n const initialSubtitle = this.art?.option?.subtitle?.url\n if (initialSubtitle && this.utils.getExt(initialSubtitle) === 'ass') {\n this.switch(initialSubtitle)\n }\n }\n\n switch(url) {\n this.art.emit('artplayerPluginLibass:switch', url)\n\n if (url && this.utils.getExt(url) === 'ass') {\n this.currentType = 'ass'\n this.libass.freeTrack()\n this.libass.setTrackByUrl(this.#toAbsoluteUrl(url))\n\n this.visible = this.art.subtitle.show\n }\n else {\n this.currentType = 'webvtt'\n this.hide()\n this.libass.freeTrack()\n }\n }\n\n setVisibility(visible) {\n this.visible = visible\n }\n\n setOffset(offset) {\n this.timeOffset = offset\n }\n\n get active() {\n return this.currentType === 'ass'\n }\n\n get visible() {\n if (!this.libass)\n return false\n\n return this.libass.canvasParent.style.display !== 'none'\n }\n\n set visible(visible) {\n this.art.emit('artplayerPluginLibass:visible', visible)\n\n this.#setVttVisible(!this.active)\n\n if (this.libass.canvasParent) {\n this.libass.canvasParent.style.display = visible ? 'block' : 'none'\n\n if (visible)\n this.libass.resize()\n }\n }\n\n get timeOffset() {\n return this.libass.timeOffset\n }\n\n set timeOffset(offset) {\n this.art.emit('artplayerPluginLibass:timeOffset', offset)\n this.libass.timeOffset = offset\n }\n\n show() {\n this.visible = true\n }\n\n hide() {\n this.visible = false\n }\n\n destroy() {\n this.art.emit('artplayerPluginLibass:destroy')\n\n this.#removeEventListeners()\n\n this.libass.dispose()\n URL.revokeObjectURL(this.workerScriptUrl)\n this.libass = null\n }\n\n async #createLibass(option = {}) {\n if (!option.fallbackFont) {\n return this.utils.errorHandle(option.fallbackFont, 'artplayerPluginLibass: fallbackFont is required')\n }\n\n if (!option.workerUrl) {\n option.workerUrl\n = 'https://cdnjs.cloudflare.com/ajax/libs/libass-wasm/4.1.0/js/subtitles-octopus-worker.js'\n }\n\n if (option.availableFonts) {\n option.availableFonts = Object.entries(option.availableFonts).reduce((acc, [key, value]) => {\n acc[key] = this.#toAbsoluteUrl(value)\n return acc\n }, {})\n }\n\n this.libass = new SubtitlesOctopus({\n subContent: defaultAssSubtitle,\n video: this.$video,\n ...option,\n workerUrl: await this.#loadWorker(option),\n fallbackFont: this.#toAbsoluteUrl(option.fallbackFont),\n fonts: option.fonts?.map(font => this.#toAbsoluteUrl(font)),\n })\n\n this.libass.canvasParent.className = 'artplayer-plugin-libass'\n this.libass.canvasParent.style.cssText = `\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n user-select: none;\n pointer-events: none;\n z-index: 20;`\n }\n\n #addEventListeners() {\n this.switchHandler = this.switch.bind(this)\n this.visibleHandler = this.setVisibility.bind(this)\n this.offsetHandler = this.setOffset.bind(this)\n\n this.art.on('subtitle', this.visibleHandler)\n this.art.on('subtitleLoad', this.switchHandler)\n this.art.on('subtitleOffset', this.offsetHandler)\n\n this.art.once('destroy', this.destroy.bind(this))\n }\n\n #removeEventListeners() {\n this.art.off('subtitle', this.visibleHandler)\n this.art.off('subtitleLoad', this.switchHandler)\n this.art.off('subtitleOffset', this.offsetHandler)\n }\n\n #setVttVisible(visible) {\n this.$webvtt.style.visibility = visible ? 'visible' : 'hidden'\n }\n\n #toAbsoluteUrl(url) {\n if (this.#isAbsoluteUrl(url))\n return url\n\n // handle absolute URL when the `Worker` of `BLOB` type loading network resources\n return new URL(url, document.baseURI).toString()\n }\n\n #isAbsoluteUrl(url) {\n return /^https?:\\/\\//.test(url)\n }\n\n #loadWorker({ workerUrl, wasmUrl }) {\n return new Promise((resolve) => {\n fetch(workerUrl)\n .then(res => res.text())\n .then((text) => {\n let workerScriptContent = text\n\n workerScriptContent = workerScriptContent.replace(\n /wasmBinaryFile\\s*=\\s*\"(subtitles-octopus-worker\\.wasm)\"/g,\n (_match, wasm) => {\n if (!wasmUrl) {\n wasmUrl = new URL(wasm, workerUrl).toString()\n }\n else {\n wasmUrl = this.#toAbsoluteUrl(wasmUrl)\n }\n\n return `wasmBinaryFile = \"${wasmUrl}\"`\n },\n )\n\n const workerBlob = new Blob([workerScriptContent], { type: 'text/javascript' })\n resolve(URL.createObjectURL(workerBlob))\n })\n })\n }\n\n #checkWebAssemblySupport() {\n let supportsWebAssembly = false\n try {\n if (typeof WebAssembly === 'object' && typeof WebAssembly.instantiate === 'function') {\n const module = new WebAssembly.Module(Uint8Array.of(0x0, 0x61, 0x73, 0x6D, 0x01, 0x00, 0x00, 0x00))\n if (module instanceof WebAssembly.Module)\n supportsWebAssembly = new WebAssembly.Instance(module) instanceof WebAssembly.Instance\n }\n }\n catch (error) {\n console.error('WebAssembly is not supported in this browser.', error)\n supportsWebAssembly = false\n }\n\n this.utils.errorHandle(supportsWebAssembly, 'Browser does not support WebAssembly')\n }\n}\n","// # The following lists all copyright notices and licenses for the\n// # work contained in JavascriptSubtitlesOctopus per project.\n// \n// # Project: subtitlesoctopus\n// License: Expat\n// Copyright: 2017-2021 JavascriptSubtitlesOctopus contributors\n// \n// # Project: brotli\n// License: Expat\n// Copyright: 2014 Google Inc.\n// 2015 The Chromium Authors.\n// 2016 Google Inc.\n// 2017 Google Inc.\n// 2018 Google Inc.\n// 2015 Google Inc.\n// 2013 Google Inc.\n// 2009, 2010, 2013-2016 by the Brotli Authors\n// 2010 Google Inc.\n// \n// # Project: expat\n// License: Expat\n// Copyright: 2019 Zhongyuan Zhou \n// 2017-2022 Rhodri James \n// 2020 Joe Orton \n// 2016-2019 Sebastian Pipping \n// 2021 Dong-hee Na \n// 2017 Joe Orton \n// 2002 Fred L. Drake, Jr. \n// 2004-2006 Fred L. Drake, Jr. \n// 2017 Sebastian Pipping \n// 2004-2006 Karl Waclawek \n// 2006 Karl Waclawek \n// 2003-2006 Karl Waclawek \n// 2001-2003 Fred L. Drake, Jr. \n// 2000-2004 Fred L. Drake, Jr. \n// 2017 Franek Korta \n// 2001-2004 Fred L. Drake, Jr. \n// 2006-2012 Karl Waclawek \n// 2017 Benbuck Nason \n// 2019 David Loffredo \n// 2021 Tim Bray \n// 2018 Benjamin Peterson \n// 2017 Rhodri James \n// 2002-2005 Karl Waclawek \n// 2016-2020 Sebastian Pipping \n// 2016-2018 Sebastian Pipping \n// 2016 Gilles Espinasse \n// 2007 Karl Waclawek \n// 2002-2016 Karl Waclawek \n// 2001-2006 Fred L. Drake, Jr. \n// 2016 Don Lewis \n// 2000-2017 Expat development team\n// 2002-2004 Fred L. Drake, Jr. \n// 2000 Clark Cooper \n// 2002 Greg Stein \n// 2018 Marco Maggi \n// 2005-2012 Karl Waclawek \n// 2020 Boris Kolpackov \n// 2022 Thijs Schreijer \n// 2017-2019 Sebastian Pipping \n// 2016 Cristian Rodr\\x{00c3}\\x{00ad}guez \n// 2005 Karl Waclawek \n// 1999-2000 Thai Open Source Software Center Ltd\n// 2000-2017 Expat development team / 1997-2000 Thai Open Source Software Center Ltd\n// 2005-2007 Steven Solie \n// 2016-2021 Sebastian Pipping \n// 2005 Fred L. Drake, Jr. \n// 2018 Anton Maklakov \n// 2017 Alexander Bluhm \n// 2016-2022 Sebastian Pipping \n// 1997-2000 Thai Open Source Software Center Ltd\n// 2017-2021 Sebastian Pipping \n// 2002-2009 Karl Waclawek \n// 2002 Karl Waclawek \n// 2004-2009 Karl Waclawek \n// 2020 Tim Gates \n// 2016 Pascal Cuoq \n// 2017 Jos\\x{00c3}\\x{00a9} Guti\\x{00c3}\\x{00a9}rrez de la Concha \n// 2001-2002 Fred L. Drake, Jr. \n// 2002-2006 Karl Waclawek \n// 2000-2005 Fred L. Drake, Jr. \n// 2005-2009 Steven Solie \n// 2018 Yury Gribov \n// 2022 Martin Ettl \n// 2003 Greg Stein \n// 2016-2017 Sebastian Pipping \n// 2020 Kleber Tarc\\x{00c3}\\x{00ad}sio \n// 2001-2002 Greg Stein \n// 2002-2003 Fred L. Drake, Jr. \n// 2005-2006 Karl Waclawek \n// 2016 Thomas Beutlich \n// \n// # Project: freetype\n// License: FTL\n// Copyright: \\x{00c5}\\x{009d}\\x{00c5}\\x{00a5} \\x{00c5}\\x{009d}\\x{00c5}\\x{00a5}\\x{00d1}\\x{008f}\\x{00c3}\\x{00af}\\x{00ef}\\x{00ac}\\x{00af}\\x{00c4}\\x{009f}\")\n// 2009-2013 Adobe Systems Incorporated.\n// 2016-2022 David Turner, Robert Wilhelm, and Werner Lemberg.\n// 2013 Adobe Systems Incorporated.\n// 2004-2022 David Turner, Robert Wilhelm, Werner Lemberg, and George Williams.\n// 2013-2022 Google, Inc.\n// 2018-2022 Armin Hasitzka, David Turner, Robert Wilhelm, and Werner Lemberg.\n// 2007-2014 Adobe Systems Incorporated.\n// 2008-2022 David Turner, Robert Wilhelm, and Werner Lemberg.\n// 2005-2022 Werner Lemberg and Detlef W\\x{00fc}rkner.\n// 2006-2022 David Turner, Robert Wilhelm, and Werner Lemberg.\n// 2007-2022 David Turner, Robert Wilhelm, and Werner Lemberg.\n// 1996-2022 David Turner, Robert Wilhelm, Werner Lemberg and Detlef W\\x{00fc}rkner.\n// 2004-2022 Masatake YAMATO, Redhat K.K,\n// 1996-2022 David Turner, Robert Wilhelm, Werner Lemberg, and Detlef Wuerkner.\n// 1996-2022 David Turner, Robert Wilhelm, and Werner Lemberg\n// 1995-2016 Jean-loup Gailly, Mark Adler\n// 2021-2022 David Turner, Robert Wilhelm, and Werner Lemberg.\n// \\x{00c5}\\x{009d}\\x{00c5}\\x{00a5} \\x{00c5}\\x{009d}\\x{00c5}\\x{00a5}\\x{00d1}\\x{008f}\\x{00c3}\\x{00af}\\x{00ef}\\x{00ac}\\x{00af}\\x{00c4}\\x{009f}\"));\n// 2004-2022 David Turner, Robert Wilhelm, Werner Lemberg and George Williams.\n// 2009-2022 Oran Agra and Mickey Gabel.\n// 2010-2022 David Turner, Robert Wilhelm, and Werner Lemberg.\n// 1995-2017 Jean-loup Gailly\n// 2003 Huw D M Davies for Codeweavers\n// 2013-2014 Adobe Systems Incorporated.\n// 2005-2022 David Turner.\n// 1995-2011, 2016 Mark Adler\n// 2010-2022 Joel Klinghed.\n// 2002-2022 Roberto Alameda.\n// 1996-2022 David Turner, Robert Wilhelm, and Werner Lemberg.\n// 2011-2013 Adobe Systems Incorporated.\n// 2007 Dmitry Timoshkov for Codeweavers\n// 2002-2022 David Turner, Robert Wilhelm, and Werner Lemberg\n// 2013-2022 David Turner, Robert Wilhelm, and Werner Lemberg.\n// 1996-2022 Just van Rossum, David Turner, Robert Wilhelm, and Werner Lemberg.\n// 1995-2017 Mark Adler\n// 2000-2022 David Turner, Robert Wilhelm, and Werner Lemberg.\n// 2022 David Turner, Robert Wilhelm, Werner Lemberg, and Moazin Khatti.\n// 2006-2013 Adobe Systems Incorporated.\n// 1995-2003, 2010 Mark Adler\n// 2012-2022 David Turner, Robert Wilhelm, and Werner Lemberg.\n// 2007-2022 Rahul Bhalerao , .\n// 2007-2022 David Turner.\n// 2017-2022 David Turner, Robert Wilhelm, and Werner Lemberg.\n// 2008-2022 David Turner, Robert Wilhelm, Werner Lemberg, and suzuki toshiya.\n// 2018-2022 David Turner, Robert Wilhelm, and Werner Lemberg.\n// 1995-2005, 2010 Mark Adler\n// 2005-2022 suzuki toshiya, Masatake YAMATO, Red Hat K.K.,\n// 2020-2022 David Turner, Robert Wilhelm, and Werner Lemberg.\n// 2007-2022 Derek Clegg and Michael Toftdal.\n// \\x{00e1}\\x{00bb}\\x{008b}...): %dn\", \"\\x{00e1}\\x{00ba}\\x{0083}\\x{00ce}\\x{00ad}\\x{00c5}\\x{0082}\\x{00c4}\\x{00ba}\", \"all\", 42);\n// 2019-2022 Nikhil Ramakrishnan, David Turner, Robert Wilhelm, and Werner Lemberg.\n// 2013 Google, Inc.\n// 2004-2022 David Turner, Robert Wilhelm, and Werner Lemberg.\n// 2009-2014 Adobe Systems Incorporated.\n// 2004-2022 Albert Chin-A-Young.\n// 2003-2022 Masatake YAMATO, Redhat K.K.,\n// 2002-2022 David Turner, Robert Wilhelm, and Werner Lemberg.\n// 2007-2013 Adobe Systems Incorporated.\n// 2007-2022 Dereg Clegg and Michael Toftdal.\n// 2003-2022 David Turner, Robert Wilhelm, and Werner Lemberg.\n// 2004-2022 Masatake YAMATO and Redhat K.K.\n// 2004-2022 Masatake YAMATO, Red Hat K.K.,\n// 2001-2022 David Turner, Robert Wilhelm, and Werner Lemberg.\n// 2001, 2012 David Turner, Robert Wilhelm, and Werner Lemberg.\n// 1995-2022 Jean-loup Gailly, Mark Adler\n// 1995-2022 Mark Adler\n// 2004-2019 Mark Adler\n// 1990, 1994, 1998 The Open Group\n// 2005-2022 David Turner, Robert Wilhelm, and Werner Lemberg.\n// 1995-2019 Mark Adler\n// 2018-2022 David Turner, Robert Wilhelm, Dominik R\\x{00c3}\\x{00b6}ttsches, and Werner Lemberg.\n// 2004-2022 suzuki toshiya, Masatake YAMATO, Red Hat K.K.,\n// \n// License: public-domain\n// Copyright: 2001 Alexander Peslyak and it is hereby released to the\n// \n// License: Zlib\n// Copyright: 1995-2022 Jean-loup Gailly and Mark Adler\n// \n// License: Expat\n// Copyright: 2000-2001, 2004 Francesco Zappa Nardelli\n// 2001-2004 Francesco Zappa Nardelli\n// 2003 Francesco Zappa Nardelli\n// 2001-2015 Francesco Zappa Nardelli\n// 2001-2004, 2011 Francesco Zappa Nardelli\n// 2000-2002 Francesco Zappa Nardelli\n// 2000 Computing Research Labs, New Mexico State University\n// 2001-2014 Francesco Zappa Nardelli\n// 2001-2002, 2012 Francesco Zappa Nardelli\n// 2001-2002 Francesco Zappa Nardelli\n// 2001-2008, 2011, 2013-2014 Francesco Zappa Nardelli\n// 2000-2003, 2006, 2010 Francesco Zappa Nardelli\n// 2000-2001, 2003 Francesco Zappa Nardelli\n// 2000-2004, 2006-2011, 2013-2014 Francesco Zappa Nardelli\n// 2000-2010, 2012-2014 Francesco Zappa Nardelli\n// \n// License: BSL-1.0\n// Copyright: 2019 nyorain\n// \n// # Project: fribidi\n// License: LGPL-2.1+\n// Copyright: 1999-2000, 2017 Dov Grobgeld\n// 1999-2000 Dov Grobgeld\n// 2004 Behdad Esfahbod\n// 2001-2002, 2004 Behdad Esfahbod\n// 2009 Behdad Esfahbod\n// 2017 Dov Grobgeld\n// 2004-2005 Behdad Esfahbod\n// 2004 Sharif FarsiWeb, Inc.\n// 2015, 2017 Dov Grobgeld\n// 2005 Behdad Esfahbod\n// 2001 Behdad Esfahbod.\n// 2001-2002 Behdad Esfahbod\n// 2004 Sharif FarsiWeb, Inc\n// \n// # Project: fontconfig\n// License: NTP~disclaimer\n// Copyright: 2002 Keith Packard\n// 2009 Roozbeh Pournader\n// 2000 Tuomas J. Lukka\n// 2006 Keith Packard\n// 2008 Red Hat, Inc.\n// 2000-2007 Keith Packard / 2005 Patrick Lam / 2009 Roozbeh Pournader / 2008,2009 Red Hat, Inc. / 2008 Danilo Šegan / 2012 Google, Inc.\n// 2001 Keith Packard\n// 2012 Google, Inc.\n// 2012 Red Hat, Inc.\n// 2013 Raimund Steger\n// 2008,2009 Red Hat, Inc.\n// 2000-2007 Keith Packard\n// 2005 Patrick Lam\n// 2003 Keith Packard\n// 2020 Zoltan Vandrus\n// \\x{00e6}\\x{0081}\\x{00af} 2010 Behdad Esfahbod\n// 2014 Red Hat, Inc.\n// 2018 Akira TAGOH\n// 2007 Keith Packard\n// \\x{00e6}\\x{0081}\\x{00af} 2006 Keith Packard\n// 2008 Danilo Šegan\n// 2015 Akira TAGOH\n// 2016 Akira TAGOH\n// 2008-2009 Red Hat, Inc.\n// 2000 Keith Packard\n// 2013 Akira TAGOH\n// 2013 Google, Inc.\n// 2010 Behdad Esfahbod\n// \n// License: MIT~old\n// Copyright: 2009-2010 Red Hat, Inc.\n// 2011-2013 Google, Inc.\n// 2007 Chris Wilson\n// \n// License: public-domain\n// Copyright: 2008,2009 Red Hat, Inc.\n// 2009 Roozbeh Pournader\n// 2012 Google, Inc.\n// 2008 Danilo Šegan\n// 2005 Patrick Lam\n// 2000-2007 Keith Packard\n// \n// License: Expat\n// Copyright: 2002-2003 Juliusz Chroboczek\n// \n// # Project: harfbuzz\n// License: NTP~disclaimer\n// Copyright: 2002 Keith Packard\n// 2014 Google, Inc.\n// \n// License: MIT~old\n// Copyright: 2012 Mozilla Foundation.\n// 2004, 2007, 2009 Red Hat, Inc.\n// 2009 Red Hat, Inc.\n// 2015 Google, Inc.\n// 2014 Google, Inc.\n// 2018 Ebrahim Byagowi\n// 2016 Igalia S.L.\n// 2018 Ebrahim Byagowi.\n// 2011 Martin Hosken\n// 2019 Ebrahim Byagowi\n// 1998-2004 David Turner and Werner Lemberg\n// 2020 Ebrahim Byagowi\n// 2013 Red Hat, Inc.\n// 2011-2012 Google, Inc.\n// 2011 SIL International\n// 2018 Khaled Hosny\n// 2018 Google, Inc.\n// 2019-2020 Ebrahim Byagowi\n// 2022 Google, Inc.\n// 2012 Google, Inc.\n// 2017 Google, Inc.\n// 2007-2009 Red Hat, Inc.\n// 2011 Codethink Limited\n// 2013 Google, Inc.\n// 2015-2019 Ebrahim Byagowi\n// 2016 Google, Inc.\n// 2011 Google, Inc.\n// \n// # Project: libass\n// License: public-domain\n// Copyright: 2006-2016 libass contributors\n// \n// License: NTP\n// Copyright: 1994 Sun Microsystems, Inc.\n// 2016 Oleg Oshmyan \n// 1988-1993 The Regents of the University of California.\n// \n// License: ISC\n// Copyright: 2015 Oleg Oshmyan \n// 2011-2014 Yu Zhuohuang \n// 2013 rcombs \n// 2016 Vabishchevich Nikolay \n// 2022 libass contributors\n// 2015 Stephan Vedder \n// 2015 Vabishchevich Nikolay \n// interest in the\n// 2006-2016 libass contributors\n// 2021 libass contributors\n// 2017 Vabishchevich Nikolay \n// 2011 Grigori Goronzy \n// 2010 Grigori Goronzy \n// 2014 Vabishchevich Nikolay \n// 2015 Grigori Goronzy \n// 2013 Stefano Pigozzi \n// 2006 Evgeniy Stepanov \n// 2009 Grigori Goronzy \n// \n// # The following section contains the full license text or\n// # where permitted a shorter notice for all works contained\n// # in JavascriptSubtitlesOctopus listed above\n// #\n// # Note that the shortnames used here are identical to those used by Debian\n// # and will in some cases differ from SPDX identifiers. See below.\n// #\n// # Debian-name | SPDX-name\n// # ---------------+-------------------\n// # MIT~old | MIT-Modern-Variant\n// # Expat | MIT\n// # NTP~disclaimer | (None; it is NTP with a more verbose warranty disclaimer)\n// \n// License: Expat\n// Permission is hereby granted, free of charge, to any person obtaining\n// a copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n// .\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n// .\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n// \n// License: FTL\n// Portions of this software are copyright © 2021 The FreeType\n// Project (www.freetype.org). All rights reserved.\n// A copy of the FreeType License can be obtained at\n// https://gitlab.freedesktop.org/freetype/freetype/-/blob/master/docs/FTL.TXT\n// \n// License: ISC\n// Permission to use, copy, modify, and/or distribute this software for any\n// purpose with or without fee is hereby granted, provided that the above\n// copyright notice and this permission notice appear in all copies.\n// .\n// THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n// \n// License: MIT~old\n// Permission is hereby granted, without written agreement and without\n// license or royalty fees, to use, copy, modify, and distribute this\n// software and its documentation for any purpose, provided that the\n// above copyright notice and the following two paragraphs appear in\n// all copies of this software.\n// .\n// IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR\n// DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES\n// ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN\n// IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH\n// DAMAGE.\n// .\n// THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,\n// BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND\n// FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS\n// ON AN \"AS IS\" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO\n// PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS\n// \n// License: NTP\n// Permission to use, copy, modify, and distribute this\n// software and its documentation for any purpose and without\n// fee is hereby granted, provided that the above copyright\n// notice appear in all copies. The University of California\n// makes no representations about the suitability of this\n// software for any purpose. It is provided \"as is\" without\n// express or implied warranty.\n// \n// License: NTP~disclaimer\n// Permission to use, copy, modify, distribute, and sell this software and its\n// documentation for any purpose is hereby granted without fee, provided that\n// the above copyright notice appear in all copies and that both that\n// copyright notice and this permission notice appear in supporting\n// documentation, and that the name of the author(s) not be used in\n// advertising or publicity pertaining to distribution of the software without\n// specific, written prior permission. The authors make no\n// representations about the suitability of this software for any purpose. It\n// is provided \"as is\" without express or implied warranty.\n// .\n// THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,\n// INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO\n// EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR\n// CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,\n// DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER\n// TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\n// PERFORMANCE OF THIS SOFTWARE.\n// \n// License: Zlib\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n// .\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n// .\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n// \n// License: BSL-1\n// Boost Software License - Version 1.0 - August 17th, 2003\n// .\n// Permission is hereby granted, free of charge, to any person or organization\n// obtaining a copy of the software and accompanying documentation covered by\n// this license (the \"Software\") to use, reproduce, display, distribute,\n// execute, and transmit the Software, and to prepare derivative works of the\n// Software, and to permit third-parties to whom the Software is furnished to\n// do so, all subject to the following:\n// .\n// The copyright notices in the Software and this entire statement, including\n// the above license grant, this restriction and the following disclaimer,\n// must be included in all copies of the Software, in whole or in part, and\n// all derivative works of the Software, unless such copies or derivative\n// works are solely in the form of machine-executable object code generated by\n// a source language processor.\n// .\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT\n// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE\n// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,\n// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n// DEALINGS IN THE SOFTWARE.\n// \n// License: LGPL-2.1\n// GNU LESSER GENERAL PUBLIC LICENSE\n// Version 2.1, February 1999\n// .\n// Copyright (C) 1991, 1999 Free Software Foundation, Inc.\n// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA\n// Everyone is permitted to copy and distribute verbatim copies\n// of this license document, but changing it is not allowed.\n// .\n// [This is the first released version of the Lesser GPL. It also counts\n// as the successor of the GNU Library Public License, version 2, hence\n// the version number 2.1.]\n// .\n// Preamble\n// .\n// The licenses for most software are designed to take away your\n// freedom to share and change it. By contrast, the GNU General Public\n// Licenses are intended to guarantee your freedom to share and change\n// free software--to make sure the software is free for all its users.\n// .\n// This license, the Lesser General Public License, applies to some\n// specially designated software packages--typically libraries--of the\n// Free Software Foundation and other authors who decide to use it. You\n// can use it too, but we suggest you first think carefully about whether\n// this license or the ordinary General Public License is the better\n// strategy to use in any particular case, based on the explanations below.\n// .\n// When we speak of free software, we are referring to freedom of use,\n// not price. Our General Public Licenses are designed to make sure that\n// you have the freedom to distribute copies of free software (and charge\n// for this service if you wish); that you receive source code or can get\n// it if you want it; that you can change the software and use pieces of\n// it in new free programs; and that you are informed that you can do\n// these things.\n// .\n// To protect your rights, we need to make restrictions that forbid\n// distributors to deny you these rights or to ask you to surrender these\n// rights. These restrictions translate to certain responsibilities for\n// you if you distribute copies of the library or if you modify it.\n// .\n// For example, if you distribute copies of the library, whether gratis\n// or for a fee, you must give the recipients all the rights that we gave\n// you. You must make sure that they, too, receive or can get the source\n// code. If you link other code with the library, you must provide\n// complete object files to the recipients, so that they can relink them\n// with the library after making changes to the library and recompiling\n// it. And you must show them these terms so they know their rights.\n// .\n// We protect your rights with a two-step method: (1) we copyright the\n// library, and (2) we offer you this license, which gives you legal\n// permission to copy, distribute and/or modify the library.\n// .\n// To protect each distributor, we want to make it very clear that\n// there is no warranty for the free library. Also, if the library is\n// modified by someone else and passed on, the recipients should know\n// that what they have is not the original version, so that the original\n// author's reputation will not be affected by problems that might be\n// introduced by others.\n// .\n// Finally, software patents pose a constant threat to the existence of\n// any free program. We wish to make sure that a company cannot\n// effectively restrict the users of a free program by obtaining a\n// restrictive license from a patent holder. Therefore, we insist that\n// any patent license obtained for a version of the library must be\n// consistent with the full freedom of use specified in this license.\n// .\n// Most GNU software, including some libraries, is covered by the\n// ordinary GNU General Public License. This license, the GNU Lesser\n// General Public License, applies to certain designated libraries, and\n// is quite different from the ordinary General Public License. We use\n// this license for certain libraries in order to permit linking those\n// libraries into non-free programs.\n// .\n// When a program is linked with a library, whether statically or using\n// a shared library, the combination of the two is legally speaking a\n// combined work, a derivative of the original library. The ordinary\n// General Public License therefore permits such linking only if the\n// entire combination fits its criteria of freedom. The Lesser General\n// Public License permits more lax criteria for linking other code with\n// the library.\n// .\n// We call this license the \"Lesser\" General Public License because it\n// does Less to protect the user's freedom than the ordinary General\n// Public License. It also provides other free software developers Less\n// of an advantage over competing non-free programs. These disadvantages\n// are the reason we use the ordinary General Public License for many\n// libraries. However, the Lesser license provides advantages in certain\n// special circumstances.\n// .\n// For example, on rare occasions, there may be a special need to\n// encourage the widest possible use of a certain library, so that it becomes\n// a de-facto standard. To achieve this, non-free programs must be\n// allowed to use the library. A more frequent case is that a free\n// library does the same job as widely used non-free libraries. In this\n// case, there is little to gain by limiting the free library to free\n// software only, so we use the Lesser General Public License.\n// .\n// In other cases, permission to use a particular library in non-free\n// programs enables a greater number of people to use a large body of\n// free software. For example, permission to use the GNU C Library in\n// non-free programs enables many more people to use the whole GNU\n// operating system, as well as its variant, the GNU/Linux operating\n// system.\n// .\n// Although the Lesser General Public License is Less protective of the\n// users' freedom, it does ensure that the user of a program that is\n// linked with the Library has the freedom and the wherewithal to run\n// that program using a modified version of the Library.\n// .\n// The precise terms and conditions for copying, distribution and\n// modification follow. Pay close attention to the difference between a\n// \"work based on the library\" and a \"work that uses the library\". The\n// former contains code derived from the library, whereas the latter must\n// be combined with the library in order to run.\n// .\n// GNU LESSER GENERAL PUBLIC LICENSE\n// TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION\n// .\n// 0. This License Agreement applies to any software library or other\n// program which contains a notice placed by the copyright holder or\n// other authorized party saying it may be distributed under the terms of\n// this Lesser General Public License (also called \"this License\").\n// Each licensee is addressed as \"you\".\n// .\n// A \"library\" means a collection of software functions and/or data\n// prepared so as to be conveniently linked with application programs\n// (which use some of those functions and data) to form executables.\n// .\n// The \"Library\", below, refers to any such software library or work\n// which has been distributed under these terms. A \"work based on the\n// Library\" means either the Library or any derivative work under\n// copyright law: that is to say, a work containing the Library or a\n// portion of it, either verbatim or with modifications and/or translated\n// straightforwardly into another language. (Hereinafter, translation is\n// included without limitation in the term \"modification\".)\n// .\n// \"Source code\" for a work means the preferred form of the work for\n// making modifications to it. For a library, complete source code means\n// all the source code for all modules it contains, plus any associated\n// interface definition files, plus the scripts used to control compilation\n// and installation of the library.\n// .\n// Activities other than copying, distribution and modification are not\n// covered by this License; they are outside its scope. The act of\n// running a program using the Library is not restricted, and output from\n// such a program is covered only if its contents constitute a work based\n// on the Library (independent of the use of the Library in a tool for\n// writing it). Whether that is true depends on what the Library does\n// and what the program that uses the Library does.\n// \n// 1. You may copy and distribute verbatim copies of the Library's\n// complete source code as you receive it, in any medium, provided that\n// you conspicuously and appropriately publish on each copy an\n// appropriate copyright notice and disclaimer of warranty; keep intact\n// all the notices that refer to this License and to the absence of any\n// warranty; and distribute a copy of this License along with the\n// Library.\n// .\n// You may charge a fee for the physical act of transferring a copy,\n// and you may at your option offer warranty protection in exchange for a\n// fee.\n// .\n// 2. You may modify your copy or copies of the Library or any portion\n// of it, thus forming a work based on the Library, and copy and\n// distribute such modifications or work under the terms of Section 1\n// above, provided that you also meet all of these conditions:\n// .\n// a) The modified work must itself be a software library.\n// .\n// b) You must cause the files modified to carry prominent notices\n// stating that you changed the files and the date of any change.\n// .\n// c) You must cause the whole of the work to be licensed at no\n// charge to all third parties under the terms of this License.\n// .\n// d) If a facility in the modified Library refers to a function or a\n// table of data to be supplied by an application program that uses\n// the facility, other than as an argument passed when the facility\n// is invoked, then you must make a good faith effort to ensure that,\n// in the event an application does not supply such function or\n// table, the facility still operates, and performs whatever part of\n// its purpose remains meaningful.\n// .\n// (For example, a function in a library to compute square roots has\n// a purpose that is entirely well-defined independent of the\n// application. Therefore, Subsection 2d requires that any\n// application-supplied function or table used by this function must\n// be optional: if the application does not supply it, the square\n// root function must still compute square roots.)\n// .\n// These requirements apply to the modified work as a whole. If\n// identifiable sections of that work are not derived from the Library,\n// and can be reasonably considered independent and separate works in\n// themselves, then this License, and its terms, do not apply to those\n// sections when you distribute them as separate works. But when you\n// distribute the same sections as part of a whole which is a work based\n// on the Library, the distribution of the whole must be on the terms of\n// this License, whose permissions for other licensees extend to the\n// entire whole, and thus to each and every part regardless of who wrote\n// it.\n// .\n// Thus, it is not the intent of this section to claim rights or contest\n// your rights to work written entirely by you; rather, the intent is to\n// exercise the right to control the distribution of derivative or\n// collective works based on the Library.\n// .\n// In addition, mere aggregation of another work not based on the Library\n// with the Library (or with a work based on the Library) on a volume of\n// a storage or distribution medium does not bring the other work under\n// the scope of this License.\n// .\n// 3. You may opt to apply the terms of the ordinary GNU General Public\n// License instead of this License to a given copy of the Library. To do\n// this, you must alter all the notices that refer to this License, so\n// that they refer to the ordinary GNU General Public License, version 2,\n// instead of to this License. (If a newer version than version 2 of the\n// ordinary GNU General Public License has appeared, then you can specify\n// that version instead if you wish.) Do not make any other change in\n// these notices.\n// .\n// Once this change is made in a given copy, it is irreversible for\n// that copy, so the ordinary GNU General Public License applies to all\n// subsequent copies and derivative works made from that copy.\n// .\n// This option is useful when you wish to copy part of the code of\n// the Library into a program that is not a library.\n// .\n// 4. You may copy and distribute the Library (or a portion or\n// derivative of it, under Section 2) in object code or executable form\n// under the terms of Sections 1 and 2 above provided that you accompany\n// it with the complete corresponding machine-readable source code, which\n// must be distributed under the terms of Sections 1 and 2 above on a\n// medium customarily used for software interchange.\n// .\n// If distribution of object code is made by offering access to copy\n// from a designated place, then offering equivalent access to copy the\n// source code from the same place satisfies the requirement to\n// distribute the source code, even though third parties are not\n// compelled to copy the source along with the object code.\n// .\n// 5. A program that contains no derivative of any portion of the\n// Library, but is designed to work with the Library by being compiled or\n// linked with it, is called a \"work that uses the Library\". Such a\n// work, in isolation, is not a derivative work of the Library, and\n// therefore falls outside the scope of this License.\n// .\n// However, linking a \"work that uses the Library\" with the Library\n// creates an executable that is a derivative of the Library (because it\n// contains portions of the Library), rather than a \"work that uses the\n// library\". The executable is therefore covered by this License.\n// Section 6 states terms for distribution of such executables.\n// .\n// When a \"work that uses the Library\" uses material from a header file\n// that is part of the Library, the object code for the work may be a\n// derivative work of the Library even though the source code is not.\n// Whether this is true is especially significant if the work can be\n// linked without the Library, or if the work is itself a library. The\n// threshold for this to be true is not precisely defined by law.\n// .\n// If such an object file uses only numerical parameters, data\n// structure layouts and accessors, and small macros and small inline\n// functions (ten lines or less in length), then the use of the object\n// file is unrestricted, regardless of whether it is legally a derivative\n// work. (Executables containing this object code plus portions of the\n// Library will still fall under Section 6.)\n// .\n// Otherwise, if the work is a derivative of the Library, you may\n// distribute the object code for the work under the terms of Section 6.\n// Any executables containing that work also fall under Section 6,\n// whether or not they are linked directly with the Library itself.\n// .\n// 6. As an exception to the Sections above, you may also combine or\n// link a \"work that uses the Library\" with the Library to produce a\n// work containing portions of the Library, and distribute that work\n// under terms of your choice, provided that the terms permit\n// modification of the work for the customer's own use and reverse\n// engineering for debugging such modifications.\n// .\n// You must give prominent notice with each copy of the work that the\n// Library is used in it and that the Library and its use are covered by\n// this License. You must supply a copy of this License. If the work\n// during execution displays copyright notices, you must include the\n// copyright notice for the Library among them, as well as a reference\n// directing the user to the copy of this License. Also, you must do one\n// of these things:\n// .\n// a) Accompany the work with the complete corresponding\n// machine-readable source code for the Library including whatever\n// changes were used in the work (which must be distributed under\n// Sections 1 and 2 above); and, if the work is an executable linked\n// with the Library, with the complete machine-readable \"work that\n// uses the Library\", as object code and/or source code, so that the\n// user can modify the Library and then relink to produce a modified\n// executable containing the modified Library. (It is understood\n// that the user who changes the contents of definitions files in the\n// Library will not necessarily be able to recompile the application\n// to use the modified definitions.)\n// .\n// b) Use a suitable shared library mechanism for linking with the\n// Library. A suitable mechanism is one that (1) uses at run time a\n// copy of the library already present on the user's computer system,\n// rather than copying library functions into the executable, and (2)\n// will operate properly with a modified version of the library, if\n// the user installs one, as long as the modified version is\n// interface-compatible with the version that the work was made with.\n// .\n// c) Accompany the work with a written offer, valid for at\n// least three years, to give the same user the materials\n// specified in Subsection 6a, above, for a charge no more\n// than the cost of performing this distribution.\n// .\n// d) If distribution of the work is made by offering access to copy\n// from a designated place, offer equivalent access to copy the above\n// specified materials from the same place.\n// .\n// e) Verify that the user has already received a copy of these\n// materials or that you have already sent this user a copy.\n// .\n// For an executable, the required form of the \"work that uses the\n// Library\" must include any data and utility programs needed for\n// reproducing the executable from it. However, as a special exception,\n// the materials to be distributed need not include anything that is\n// normally distributed (in either source or binary form) with the major\n// components (compiler, kernel, and so on) of the operating system on\n// which the executable runs, unless that component itself accompanies\n// the executable.\n// .\n// It may happen that this requirement contradicts the license\n// restrictions of other proprietary libraries that do not normally\n// accompany the operating system. Such a contradiction means you cannot\n// use both them and the Library together in an executable that you\n// distribute.\n// .\n// 7. You may place library facilities that are a work based on the\n// Library side-by-side in a single library together with other library\n// facilities not covered by this License, and distribute such a combined\n// library, provided that the separate distribution of the work based on\n// the Library and of the other library facilities is otherwise\n// permitted, and provided that you do these two things:\n// .\n// a) Accompany the combined library with a copy of the same work\n// based on the Library, uncombined with any other library\n// facilities. This must be distributed under the terms of the\n// Sections above.\n// .\n// b) Give prominent notice with the combined library of the fact\n// that part of it is a work based on the Library, and explaining\n// where to find the accompanying uncombined form of the same work.\n// .\n// 8. You may not copy, modify, sublicense, link with, or distribute\n// the Library except as expressly provided under this License. Any\n// attempt otherwise to copy, modify, sublicense, link with, or\n// distribute the Library is void, and will automatically terminate your\n// rights under this License. However, parties who have received copies,\n// or rights, from you under this License will not have their licenses\n// terminated so long as such parties remain in full compliance.\n// .\n// 9. You are not required to accept this License, since you have not\n// signed it. However, nothing else grants you permission to modify or\n// distribute the Library or its derivative works. These actions are\n// prohibited by law if you do not accept this License. Therefore, by\n// modifying or distributing the Library (or any work based on the\n// Library), you indicate your acceptance of this License to do so, and\n// all its terms and conditions for copying, distributing or modifying\n// the Library or works based on it.\n// .\n// 10. Each time you redistribute the Library (or any work based on the\n// Library), the recipient automatically receives a license from the\n// original licensor to copy, distribute, link with or modify the Library\n// subject to these terms and conditions. You may not impose any further\n// restrictions on the recipients' exercise of the rights granted herein.\n// You are not responsible for enforcing compliance by third parties with\n// this License.\n// .\n// 11. If, as a consequence of a court judgment or allegation of patent\n// infringement or for any other reason (not limited to patent issues),\n// conditions are imposed on you (whether by court order, agreement or\n// otherwise) that contradict the conditions of this License, they do not\n// excuse you from the conditions of this License. If you cannot\n// distribute so as to satisfy simultaneously your obligations under this\n// License and any other pertinent obligations, then as a consequence you\n// may not distribute the Library at all. For example, if a patent\n// license would not permit royalty-free redistribution of the Library by\n// all those who receive copies directly or indirectly through you, then\n// the only way you could satisfy both it and this License would be to\n// refrain entirely from distribution of the Library.\n// .\n// If any portion of this section is held invalid or unenforceable under any\n// particular circumstance, the balance of the section is intended to apply,\n// and the section as a whole is intended to apply in other circumstances.\n// .\n// It is not the purpose of this section to induce you to infringe any\n// patents or other property right claims or to contest validity of any\n// such claims; this section has the sole purpose of protecting the\n// integrity of the free software distribution system which is\n// implemented by public license practices. Many people have made\n// generous contributions to the wide range of software distributed\n// through that system in reliance on consistent application of that\n// system; it is up to the author/donor to decide if he or she is willing\n// to distribute software through any other system and a licensee cannot\n// impose that choice.\n// .\n// This section is intended to make thoroughly clear what is believed to\n// be a consequence of the rest of this License.\n// .\n// 12. If the distribution and/or use of the Library is restricted in\n// certain countries either by patents or by copyrighted interfaces, the\n// original copyright holder who places the Library under this License may add\n// an explicit geographical distribution limitation excluding those countries,\n// so that distribution is permitted only in or among countries not thus\n// excluded. In such case, this License incorporates the limitation as if\n// written in the body of this License.\n// .\n// 13. The Free Software Foundation may publish revised and/or new\n// versions of the Lesser General Public License from time to time.\n// Such new versions will be similar in spirit to the present version,\n// but may differ in detail to address new problems or concerns.\n// .\n// Each version is given a distinguishing version number. If the Library\n// specifies a version number of this License which applies to it and\n// \"any later version\", you have the option of following the terms and\n// conditions either of that version or of any later version published by\n// the Free Software Foundation. If the Library does not specify a\n// license version number, you may choose any version ever published by\n// the Free Software Foundation.\n// .\n// 14. If you wish to incorporate parts of the Library into other free\n// programs whose distribution conditions are incompatible with these,\n// write to the author to ask for permission. For software which is\n// copyrighted by the Free Software Foundation, write to the Free\n// Software Foundation; we sometimes make exceptions for this. Our\n// decision will be guided by the two goals of preserving the free status\n// of all derivatives of our free software and of promoting the sharing\n// and reuse of software generally.\n// .\n// NO WARRANTY\n// .\n// 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO\n// WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.\n// EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR\n// OTHER PARTIES PROVIDE THE LIBRARY \"AS IS\" WITHOUT WARRANTY OF ANY\n// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE\n// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n// PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE\n// LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME\n// THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n// .\n// 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN\n// WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY\n// AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU\n// FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR\n// CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE\n// LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING\n// RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A\n// FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF\n// SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH\n// DAMAGES.\n// .\n// END OF TERMS AND CONDITIONS\n// .\n// How to Apply These Terms to Your New Libraries\n// .\n// If you develop a new library, and you want it to be of the greatest\n// possible use to the public, we recommend making it free software that\n// everyone can redistribute and change. You can do so by permitting\n// redistribution under these terms (or, alternatively, under the terms of the\n// ordinary General Public License).\n// .\n// To apply these terms, attach the following notices to the library. It is\n// safest to attach them to the start of each source file to most effectively\n// convey the exclusion of warranty; and each file should have at least the\n// \"copyright\" line and a pointer to where the full notice is found.\n// .\n// \n// Copyright (C) \n// .\n// This library is free software; you can redistribute it and/or\n// modify it under the terms of the GNU Lesser General Public\n// License as published by the Free Software Foundation; either\n// version 2.1 of the License, or (at your option) any later version.\n// .\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// Lesser General Public License for more details.\n// .\n// You should have received a copy of the GNU Lesser General Public\n// License along with this library; if not, write to the Free Software\n// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA\n// .\n// Also add information on how to contact you by electronic and paper mail.\n// .\n// You should also get your employer (if you work as a programmer) or your\n// school, if any, to sign a \"copyright disclaimer\" for the library, if\n// necessary. Here is a sample; alter the names:\n// .\n// Yoyodyne, Inc., hereby disclaims all copyright interest in the\n// library `Frob' (a library for tweaking knobs) written by James Random Hacker.\n// .\n// , 1 April 1990\n// Ty Coon, President of Vice\n// .\n// That's all there is to it!\n\"use strict\";\nvar SubtitlesOctopus = function (options) {\n var supportsWebAssembly = false;\n try {\n if (typeof WebAssembly === \"object\"\n && typeof WebAssembly.instantiate === \"function\") {\n const module = new WebAssembly.Module(Uint8Array.of(0x0, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00));\n if (module instanceof WebAssembly.Module)\n supportsWebAssembly = (new WebAssembly.Instance(module) instanceof WebAssembly.Instance);\n }\n } catch (e) {\n }\n console.log(\"WebAssembly support detected: \" + (supportsWebAssembly ? \"yes\" : \"no\"));\n\n var self = this;\n self.canvas = options.canvas; // HTML canvas element (optional if video specified)\n self.renderMode = options.renderMode || (options.lossyRender ? 'lossy' : 'wasm-blend');\n self.libassMemoryLimit = options.libassMemoryLimit || 0;\n self.libassGlyphLimit = options.libassGlyphLimit || 0;\n self.targetFps = options.targetFps || 24;\n self.prescaleFactor = options.prescaleFactor || 1.0;\n self.prescaleHeightLimit = options.prescaleHeightLimit || 1080;\n self.maxRenderHeight = options.maxRenderHeight || 0; // 0 - no limit\n self.dropAllAnimations = options.dropAllAnimations || false; // attempt to remove all animations as a last ditch effort for displaying on weak hardware; may severly mangle subtitles if enabled\n self.isOurCanvas = false; // (internal) we created canvas and manage it\n self.video = options.video; // HTML video element (optional if canvas specified)\n self.canvasParent = null; // (internal) HTML canvas parent element\n self.fonts = options.fonts || []; // Array with links to fonts used in sub (optional)\n self.availableFonts = options.availableFonts || []; // Object with all available fonts (optional). Key is font name in lower case, value is link: {\"arial\": \"/font1.ttf\"}\n self.fallbackFont = options.fallbackFont || 'default.woff2'; // URL to override fallback font, for example, with a CJK one. Default fallback font is Liberation Sans (Optional)\n self.lazyFileLoading = options.lazyFileLoading || false; // Load fonts in a lazy way. Requires Access-Control-Expose-Headers for Accept-Ranges, Content-Length, and Content-Encoding. If Content-Encoding is compressed, file will be fully fetched instead of just a HEAD request.\n self.onReadyEvent = options.onReady; // Function called when SubtitlesOctopus is ready (optional)\n if (supportsWebAssembly) {\n self.workerUrl = options.workerUrl || 'subtitles-octopus-worker.js'; // Link to WebAssembly worker\n } else {\n self.workerUrl = options.legacyWorkerUrl || 'subtitles-octopus-worker-legacy.js'; // Link to legacy worker\n }\n self.subUrl = options.subUrl; // Link to sub file (optional if subContent specified)\n self.subContent = options.subContent || null; // Sub content (optional if subUrl specified)\n self.onErrorEvent = options.onError; // Function called in case of critical error meaning sub wouldn't be shown and you should use alternative method (for instance it occurs if browser doesn't support web workers).\n self.debug = options.debug || false; // When debug enabled, some performance info printed in console.\n self.lastRenderTime = 0; // (internal) Last time we got some frame from worker\n self.pixelRatio = window.devicePixelRatio || 1; // (internal) Device pixel ratio (for high dpi devices)\n\n self.timeOffset = options.timeOffset || 0; // Time offset would be applied to currentTime from video (option)\n\n self.hasAlphaBug = false;\n\n (function() {\n if (typeof ImageData.prototype.constructor === 'function') {\n try {\n // try actually calling ImageData, as on some browsers it's reported\n // as existing but calling it errors out as \"TypeError: Illegal constructor\"\n new window.ImageData(new Uint8ClampedArray([0, 0, 0, 0]), 1, 1);\n return;\n } catch (e) {\n console.log(\"detected that ImageData is not constructable despite browser saying so\");\n }\n }\n\n var canvas = document.createElement('canvas');\n var ctx = canvas.getContext('2d');\n\n window.ImageData = function () {\n var i = 0;\n if (arguments[0] instanceof Uint8ClampedArray) {\n var data = arguments[i++];\n }\n var width = arguments[i++];\n var height = arguments[i];\n\n var imageData = ctx.createImageData(width, height);\n if (data) imageData.data.set(data);\n return imageData;\n }\n })();\n\n self.workerError = function (error) {\n console.error('Worker error: ', error);\n if (self.onErrorEvent) {\n self.onErrorEvent(error);\n }\n if (!self.debug) {\n self.dispose();\n throw new Error('Worker error: ' + error);\n }\n };\n\n // Not tested for repeated usage yet\n self.init = function () {\n if (!window.Worker) {\n self.workerError('worker not supported');\n return;\n }\n // Worker\n if (!self.worker) {\n self.worker = new Worker(self.workerUrl);\n self.worker.addEventListener('message', self.onWorkerMessage);\n self.worker.addEventListener('error', self.workerError);\n }\n self.workerActive = false;\n self.createCanvas();\n self.setVideo(options.video);\n self.setSubUrl(options.subUrl);\n self.worker.postMessage({\n target: 'worker-init',\n width: self.canvas.width,\n height: self.canvas.height,\n URL: document.URL,\n currentScript: self.workerUrl,\n preMain: true,\n renderMode: self.renderMode,\n subUrl: self.subUrl,\n subContent: self.subContent,\n fonts: self.fonts,\n availableFonts: self.availableFonts,\n fallbackFont: self.fallbackFont,\n lazyFileLoading: self.lazyFileLoading,\n debug: self.debug,\n targetFps: self.targetFps,\n libassMemoryLimit: self.libassMemoryLimit,\n libassGlyphLimit: self.libassGlyphLimit,\n dropAllAnimations: self.dropAllAnimations\n });\n };\n\n self.createCanvas = function () {\n if (!self.canvas) {\n if (self.video) {\n self.isOurCanvas = true;\n self.canvas = document.createElement('canvas');\n self.canvas.className = 'libassjs-canvas';\n self.canvas.style.display = 'none';\n\n self.canvasParent = document.createElement('div');\n self.canvasParent.className = 'libassjs-canvas-parent';\n self.canvasParent.appendChild(self.canvas);\n\n if (self.video.nextSibling) {\n self.video.parentNode.insertBefore(self.canvasParent, self.video.nextSibling);\n }\n else {\n self.video.parentNode.appendChild(self.canvasParent);\n }\n }\n else {\n if (!self.canvas) {\n self.workerError('Don\\'t know where to render: you should give video or canvas in options.');\n }\n }\n }\n self.ctx = self.canvas.getContext('2d');\n self.bufferCanvas = document.createElement('canvas');\n self.bufferCanvasCtx = self.bufferCanvas.getContext('2d');\n\n // test for alpha bug, where e.g. WebKit can render a transparent pixel\n // (with alpha == 0) as non-black which then leads to visual artifacts\n self.bufferCanvas.width = 1;\n self.bufferCanvas.height = 1;\n var testBuf = new Uint8ClampedArray([0, 255, 0, 0]);\n var testImage = new ImageData(testBuf, 1, 1);\n self.bufferCanvasCtx.clearRect(0, 0, 1, 1);\n self.ctx.clearRect(0, 0, 1, 1);\n var prePut = self.ctx.getImageData(0, 0, 1, 1).data;\n self.bufferCanvasCtx.putImageData(testImage, 0, 0);\n self.ctx.drawImage(self.bufferCanvas, 0, 0);\n var postPut = self.ctx.getImageData(0, 0, 1, 1).data;\n self.hasAlphaBug = prePut[1] != postPut[1];\n if (self.hasAlphaBug) {\n console.log(\"Detected a browser having issue with transparent pixels, applying workaround\");\n }\n };\n\n function onTimeUpdate() {\n self.setCurrentTime(self.video.currentTime + self.timeOffset);\n };\n\n function onPlaying() {\n self.setIsPaused(false, self.video.currentTime + self.timeOffset);\n }\n\n function onPause() {\n self.setIsPaused(true, self.video.currentTime + self.timeOffset);\n }\n\n function onSeeking() {\n self.video.removeEventListener('timeupdate', onTimeUpdate, false);\n }\n\n function onSeeked() {\n self.video.addEventListener('timeupdate', onTimeUpdate, false);\n\n var currentTime = self.video.currentTime + self.timeOffset;\n\n self.setCurrentTime(currentTime);\n }\n\n function onRateChange() {\n self.setRate(self.video.playbackRate);\n }\n\n function onWaiting() {\n self.setIsPaused(true, self.video.currentTime + self.timeOffset);\n }\n\n function onLoadedMetadata(e) {\n e.target.removeEventListener(e.type, onLoadedMetadata, false);\n self.resize();\n }\n\n self.setVideo = function (video) {\n self.video = video;\n if (self.video) {\n self.video.addEventListener('timeupdate', onTimeUpdate, false);\n self.video.addEventListener('playing', onPlaying, false);\n self.video.addEventListener('pause', onPause, false);\n self.video.addEventListener('seeking', onSeeking, false);\n self.video.addEventListener('seeked', onSeeked, false);\n self.video.addEventListener('ratechange', onRateChange, false);\n self.video.addEventListener('waiting', onWaiting, false);\n\n document.addEventListener(\"fullscreenchange\", self.resizeWithTimeout, false);\n document.addEventListener(\"mozfullscreenchange\", self.resizeWithTimeout, false);\n document.addEventListener(\"webkitfullscreenchange\", self.resizeWithTimeout, false);\n document.addEventListener(\"msfullscreenchange\", self.resizeWithTimeout, false);\n window.addEventListener(\"resize\", self.resizeWithTimeout, false);\n\n // Support Element Resize Observer\n if (typeof ResizeObserver !== \"undefined\") {\n self.ro = new ResizeObserver(self.resizeWithTimeout);\n self.ro.observe(self.video);\n }\n\n if (self.video.videoWidth > 0) {\n self.resize();\n }\n else {\n self.video.addEventListener('loadedmetadata', onLoadedMetadata, false);\n }\n }\n };\n\n self.getVideoPosition = function () {\n var videoRatio = self.video.videoWidth / self.video.videoHeight;\n var width = self.video.offsetWidth, height = self.video.offsetHeight;\n var elementRatio = width / height;\n var realWidth = width, realHeight = height;\n if (elementRatio > videoRatio) realWidth = Math.floor(height * videoRatio);\n else realHeight = Math.floor(width / videoRatio);\n\n var x = (width - realWidth) / 2;\n var y = (height - realHeight) / 2;\n\n return {\n width: realWidth,\n height: realHeight,\n x: x,\n y: y\n };\n };\n\n self.setSubUrl = function (subUrl) {\n self.subUrl = subUrl;\n };\n\n self.renderFrameData = null;\n function renderFrames() {\n var data = self.renderFramesData;\n var beforeDrawTime = performance.now();\n self.ctx.clearRect(0, 0, self.canvas.width, self.canvas.height);\n for (var i = 0; i < data.canvases.length; i++) {\n var image = data.canvases[i];\n self.bufferCanvas.width = image.w;\n self.bufferCanvas.height = image.h;\n var imageBuffer = new Uint8ClampedArray(image.buffer);\n if (self.hasAlphaBug) {\n for (var j = 3; j < imageBuffer.length; j = j + 4) {\n imageBuffer[j] = (imageBuffer[j] >= 1) ? imageBuffer[j] : 1;\n }\n }\n var imageData = new ImageData(imageBuffer, image.w, image.h);\n self.bufferCanvasCtx.putImageData(imageData, 0, 0);\n self.ctx.drawImage(self.bufferCanvas, image.x, image.y);\n }\n if (self.debug) {\n var drawTime = Math.round(performance.now() - beforeDrawTime);\n var blendTime = data.blendTime;\n if (typeof blendTime !== 'undefined') {\n console.log('render: ' + Math.round(data.spentTime - blendTime) + ' ms, blend: ' + Math.round(blendTime) + ' ms, draw: ' + drawTime + ' ms; TOTAL=' + Math.round(data.spentTime + drawTime) + ' ms');\n } else {\n console.log(Math.round(data.spentTime) + ' ms (+ ' + drawTime + ' ms draw)');\n }\n self.renderStart = performance.now();\n }\n }\n\n /**\n * Lossy Render Mode\n *\n */\n function renderFastFrames() {\n var data = self.renderFramesData;\n var beforeDrawTime = performance.now();\n self.ctx.clearRect(0, 0, self.canvas.width, self.canvas.height);\n for (var i = 0; i < data.bitmaps.length; i++) {\n var image = data.bitmaps[i];\n self.ctx.drawImage(image.bitmap, image.x, image.y);\n }\n if (self.debug) {\n var drawTime = Math.round(performance.now() - beforeDrawTime);\n console.log(data.bitmaps.length + ' bitmaps, libass: ' + Math.round(data.libassTime) + 'ms, decode: ' + Math.round(data.decodeTime) + 'ms, draw: ' + drawTime + 'ms');\n self.renderStart = performance.now();\n }\n }\n\n self.workerActive = false;\n self.frameId = 0;\n self.onWorkerMessage = function (event) {\n //dump('\\nclient got ' + JSON.stringify(event.data).substr(0, 150) + '\\n');\n if (!self.workerActive) {\n self.workerActive = true;\n if (self.onReadyEvent) {\n self.onReadyEvent();\n }\n }\n var data = event.data;\n switch (data.target) {\n case 'stdout': {\n console.log(data.content);\n break;\n }\n case 'console-log': {\n console.log.apply(console, JSON.parse(data.content));\n break;\n }\n case 'console-debug': {\n console.debug.apply(console, JSON.parse(data.content));\n break;\n }\n case 'console-info': {\n console.info.apply(console, JSON.parse(data.content));\n break;\n }\n case 'console-warn': {\n console.warn.apply(console, JSON.parse(data.content));\n break;\n }\n case 'console-error': {\n console.error.apply(console, JSON.parse(data.content));\n break;\n }\n case 'stderr': {\n console.error(data.content);\n break;\n }\n case 'window': {\n window[data.method]();\n break;\n }\n case 'canvas': {\n switch (data.op) {\n case 'getContext': {\n self.ctx = self.canvas.getContext(data.type, data.attributes);\n break;\n }\n case 'resize': {\n self.resize(data.width, data.height);\n break;\n }\n case 'renderCanvas': {\n if (self.lastRenderTime < data.time) {\n self.lastRenderTime = data.time;\n self.renderFramesData = data;\n window.requestAnimationFrame(renderFrames);\n }\n break;\n }\n case 'renderFastCanvas': {\n if (self.lastRenderTime < data.time) {\n self.lastRenderTime = data.time;\n self.renderFramesData = data;\n window.requestAnimationFrame(renderFastFrames);\n }\n break;\n }\n case 'setObjectProperty': {\n self.canvas[data.object][data.property] = data.value;\n break;\n }\n default:\n throw 'eh?';\n }\n break;\n }\n case 'tick': {\n self.frameId = data.id;\n self.worker.postMessage({\n target: 'tock',\n id: self.frameId\n });\n break;\n }\n case 'custom': {\n if (self['onCustomMessage']) {\n self['onCustomMessage'](event);\n } else {\n throw 'Custom message received but client onCustomMessage not implemented.';\n }\n break;\n }\n case 'setimmediate': {\n self.worker.postMessage({\n target: 'setimmediate'\n });\n break;\n }\n case 'get-events': {\n break;\n }\n case 'get-styles': {\n break;\n }\n case 'ready': {\n break;\n }\n default:\n throw 'what? ' + data.target;\n }\n };\n\n function _computeCanvasSize(width, height) {\n var scalefactor = self.prescaleFactor <= 0 ? 1.0 : self.prescaleFactor;\n\n if (height <= 0 || width <= 0) {\n width = 0;\n height = 0;\n } else {\n var sgn = scalefactor < 1 ? -1 : 1;\n var newH = height;\n if (sgn * newH * scalefactor <= sgn * self.prescaleHeightLimit)\n newH *= scalefactor;\n else if (sgn * newH < sgn * self.prescaleHeightLimit)\n newH = self.prescaleHeightLimit;\n\n if (self.maxRenderHeight > 0 && newH > self.maxRenderHeight)\n newH = self.maxRenderHeight;\n\n width *= newH / height;\n height = newH;\n }\n\n return {'width': width, 'height': height};\n }\n\n self.resize = function (width, height, top, left) {\n var videoSize = null;\n top = top || 0;\n left = left || 0;\n if ((!width || !height) && self.video) {\n videoSize = self.getVideoPosition();\n var newSize = _computeCanvasSize(videoSize.width * self.pixelRatio, videoSize.height * self.pixelRatio);\n width = newSize.width;\n height = newSize.height;\n var offset = self.canvasParent.getBoundingClientRect().top - self.video.getBoundingClientRect().top;\n top = videoSize.y - offset;\n left = videoSize.x;\n }\n if (!width || !height) {\n if (!self.video) {\n console.error('width or height is 0. You should specify width & height for resize.');\n }\n return;\n }\n\n\n if (\n self.canvas.width != width ||\n self.canvas.height != height ||\n self.canvas.style.top != top ||\n self.canvas.style.left != left\n ) {\n self.canvas.width = width;\n self.canvas.height = height;\n\n if (videoSize != null) {\n self.canvasParent.style.position = 'relative';\n self.canvas.style.display = 'block';\n self.canvas.style.position = 'absolute';\n self.canvas.style.width = videoSize.width + 'px';\n self.canvas.style.height = videoSize.height + 'px';\n self.canvas.style.top = top + 'px';\n self.canvas.style.left = left + 'px';\n self.canvas.style.pointerEvents = 'none';\n }\n\n self.worker.postMessage({\n target: 'canvas',\n width: self.canvas.width,\n height: self.canvas.height\n });\n }\n };\n\n self.resizeWithTimeout = function () {\n self.resize();\n setTimeout(self.resize, 100);\n };\n\n self.runBenchmark = function () {\n self.worker.postMessage({\n target: 'runBenchmark'\n });\n };\n\n self.customMessage = function (data, options) {\n options = options || {};\n self.worker.postMessage({\n target: 'custom',\n userData: data,\n preMain: options.preMain\n });\n };\n\n self.setCurrentTime = function (currentTime) {\n self.worker.postMessage({\n target: 'video',\n currentTime: currentTime\n });\n };\n\n self.setTrackByUrl = function (url) {\n self.worker.postMessage({\n target: 'set-track-by-url',\n url: url\n });\n };\n\n self.setTrack = function (content) {\n self.worker.postMessage({\n target: 'set-track',\n content: content\n });\n };\n\n self.freeTrack = function (content) {\n self.worker.postMessage({\n target: 'free-track'\n });\n };\n\n\n self.render = self.setCurrentTime;\n\n self.setIsPaused = function (isPaused, currentTime) {\n self.worker.postMessage({\n target: 'video',\n isPaused: isPaused,\n currentTime: currentTime\n });\n };\n\n self.setRate = function (rate) {\n self.worker.postMessage({\n target: 'video',\n rate: rate\n });\n };\n\n self.dispose = function () {\n self.worker.postMessage({\n target: 'destroy'\n });\n\n self.worker.terminate();\n self.worker.removeEventListener('message', self.onWorkerMessage);\n self.worker.removeEventListener('error', self.workerError);\n self.workerActive = false;\n self.worker = null;\n\n // Remove the canvas element to remove residual subtitles rendered on player\n if (self.video) {\n self.video.removeEventListener('timeupdate', onTimeUpdate, false);\n self.video.removeEventListener('playing', onPlaying, false);\n self.video.removeEventListener('pause', onPause, false);\n self.video.removeEventListener('seeking', onSeeking, false);\n self.video.removeEventListener('seeked', onSeeked, false);\n self.video.removeEventListener('ratechange', onRateChange, false);\n self.video.removeEventListener('waiting', onWaiting, false);\n self.video.removeEventListener('loadedmetadata', onLoadedMetadata, false);\n\n document.removeEventListener('fullscreenchange', self.resizeWithTimeout, false);\n document.removeEventListener('mozfullscreenchange', self.resizeWithTimeout, false);\n document.removeEventListener('webkitfullscreenchange', self.resizeWithTimeout, false);\n document.removeEventListener('msfullscreenchange', self.resizeWithTimeout, false);\n window.removeEventListener('resize', self.resizeWithTimeout, false);\n\n self.video.parentNode.removeChild(self.canvasParent);\n\n self.video = null;\n }\n\n if (self.ro) {\n self.ro.disconnect();\n self.ro = null;\n }\n\n self.onCustomMessage = null;\n self.onErrorEvent = null;\n self.onReadyEvent = null;\n };\n\n self.fetchFromWorker = function (workerOptions, onSuccess, onError) {\n try {\n var target = workerOptions['target']\n\n var timeout = setTimeout(function() {\n reject(Error('Error: Timeout while try to fetch ' + target))\n }, 5000)\n\n var resolve = function (event) {\n if (event.data.target == target) {\n onSuccess(event.data)\n self.worker.removeEventListener('message', resolve)\n self.worker.removeEventListener('error', reject)\n clearTimeout(timeout)\n }\n }\n\n var reject = function (event) {\n onError(event)\n self.worker.removeEventListener('message', resolve)\n self.worker.removeEventListener('error', reject)\n clearTimeout(timeout)\n }\n\n self.worker.addEventListener('message', resolve)\n self.worker.addEventListener('error', reject)\n\n self.worker.postMessage(workerOptions)\n } catch (error) {\n onError(error)\n }\n }\n\n self.createEvent = function (event) {\n self.worker.postMessage({\n target: 'create-event',\n event: event\n });\n };\n\n self.getEvents = function (onSuccess, onError) {\n self.fetchFromWorker({\n target: 'get-events'\n }, function(data) {\n onSuccess(data.events)\n }, onError);\n };\n\n self.setEvent = function (event, index) {\n self.worker.postMessage({\n target: 'set-event',\n event: event,\n index: index\n });\n };\n\n self.removeEvent = function (index) {\n self.worker.postMessage({\n target: 'remove-event',\n index: index\n });\n };\n\n self.createStyle = function (style) {\n self.worker.postMessage({\n target: 'create-style',\n style: style\n });\n };\n \n self.getStyles = function (onSuccess, onError) {\n self.fetchFromWorker({\n target: 'get-styles'\n }, function(data) {\n onSuccess(data.styles)\n }, onError);\n };\n\n self.setStyle = function (style, index) {\n self.worker.postMessage({\n target: 'set-style',\n style: style,\n index: index\n });\n };\n\n self.removeStyle = function (index) {\n self.worker.postMessage({\n target: 'remove-style',\n index: index\n });\n };\n\n self.init();\n};\n\nif (typeof SubtitlesOctopusOnLoad == 'function') {\n SubtitlesOctopusOnLoad();\n}\n\nif (typeof exports !== 'undefined') {\n if (typeof module !== 'undefined' && module.exports) {\n exports = module.exports = SubtitlesOctopus\n }\n}\n","exports.interopDefault = function (a) {\n return a && a.__esModule ? a : {default: a};\n};\n\nexports.defineInteropFlag = function (a) {\n Object.defineProperty(a, '__esModule', {value: true});\n};\n\nexports.exportAll = function (source, dest) {\n Object.keys(source).forEach(function (key) {\n if (\n key === 'default' ||\n key === '__esModule' ||\n Object.prototype.hasOwnProperty.call(dest, key)\n ) {\n return;\n }\n\n Object.defineProperty(dest, key, {\n enumerable: true,\n get: function () {\n return source[key];\n },\n });\n });\n\n return dest;\n};\n\nexports.export = function (dest, destName, get) {\n Object.defineProperty(dest, destName, {\n enumerable: true,\n get: get,\n });\n};\n"],"names":[],"version":3,"file":"index.js.map","sourceRoot":"../../../"} \ No newline at end of file diff --git a/packages/artplayer-plugin-libass/.npmignore b/packages/artplayer-plugin-libass/.npmignore deleted file mode 100644 index 932395606..000000000 --- a/packages/artplayer-plugin-libass/.npmignore +++ /dev/null @@ -1,6 +0,0 @@ -node_modules -.DS_Store -.parcel-cache -yarn.lock -package-lock.json -src \ No newline at end of file diff --git a/packages/artplayer-plugin-libass/README.md b/packages/artplayer-plugin-libass/README.md deleted file mode 100644 index 303d7b6c2..000000000 --- a/packages/artplayer-plugin-libass/README.md +++ /dev/null @@ -1,11 +0,0 @@ -# artplayer-plugin-libass - -A powerful ass subtitle renderer [libass-wasm](https://github.com/libass/JavascriptSubtitlesOctopus) for ArtPlayer - -## Demo - -[https://artplayer.org](https://artplayer.org/?libs=./uncompiled/artplayer-plugin-libass/index.js&example=libass) - -## License - -MIT © journey-ad diff --git a/packages/artplayer-plugin-libass/dist/artplayer-plugin-libass.js b/packages/artplayer-plugin-libass/dist/artplayer-plugin-libass.js deleted file mode 100644 index 7606bb652..000000000 --- a/packages/artplayer-plugin-libass/dist/artplayer-plugin-libass.js +++ /dev/null @@ -1,8 +0,0 @@ - -/*! - * artplayer-plugin-libass.js v1.0.0 - * Github: https://github.com/zhw2590582/ArtPlayer - * (c) 2017-2026 Harvey Zack - * Released under the MIT License. - */ -!function(e,t,r,s,n,a,i,o){var l="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},c="function"==typeof l[s]&&l[s],d=c.i||{},u=c.cache||{},v="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function f(t,r){if(!u[t]){if(!e[t]){if(n[t])return n[t];var a="function"==typeof l[s]&&l[s];if(!r&&a)return a(t,!0);if(c)return c(t,!0);if(v&&"string"==typeof t)return v(t);var i=Error("Cannot find module '"+t+"'");throw i.code="MODULE_NOT_FOUND",i}d.resolve=function(r){var s=e[t][1][r];return null!=s?s:r},d.cache={};var o=u[t]=new f.Module(t);e[t][0].call(o.exports,d,o,o.exports,l)}return u[t].exports;function d(e){var t=d.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var r={__esModule:!0};return t.forEach(function(e){var t=e[0],s=e[1],n=e[2]||e[0],a=f(s);"*"===t?Object.keys(a).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(r,e)||Object.defineProperty(r,e,{enumerable:!0,get:function(){return a[e]}})}):"*"===n?Object.defineProperty(r,t,{enumerable:!0,value:a}):Object.defineProperty(r,t,{enumerable:!0,get:function(){return"default"===n?a.__esModule?a.default:a:a[n]}})}),r}return f(t)}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.require=v,this.exports={}},f.modules=e,f.cache=u,f.parent=c,f.distDir=void 0,f.publicUrl=void 0,f.devServer=void 0,f.i=d,f.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(f,"root",{get:function(){return l[s]}}),l[s]=f;for(var h=0;htypeof module?module.exports=m:"function"==typeof define&&define.amd&&define(function(){return m})}}({"9G2Gn":[function(e,t,r,s){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r),n.export(r,"default",()=>o);var a=e("./adapter"),i=n.interopDefault(a);function o(e){return t=>{let r=new(0,i.default)(t,e);return{name:"artplayerPluginLibass",libass:r.libass,visible:r.visible,init:r.init.bind(r),switch:r.switch.bind(r),show:r.show.bind(r),hide:r.hide.bind(r),destroy:r.destroy.bind(r)}}}"u">typeof window&&(window.artplayerPluginLibass=o)},{"./adapter":"aO4ju","@parcel/transformer-js/src/esmodule-helpers.js":"6ykb1"}],aO4ju:[function(e,t,r,s){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r);var a=e("libass-wasm"),i=n.interopDefault(a);let o=`[Script Info] ScriptType: v4.00+`;r.default=class{constructor(e,t){const{constructor:r,template:s}=e;this.art=e,this.$video=s.$video,this.$webvtt=s.$subtitle,this.utils=r.utils,this.libass=null,e.once("ready",this.init.bind(this,t))}async init(e){this.#e(),await this.#t(e),this.#r(),this.art.emit("artplayerPluginLibass:init",this);let t=this.art?.option?.subtitle?.url;t&&"ass"===this.utils.getExt(t)&&this.switch(t)}switch(e){this.art.emit("artplayerPluginLibass:switch",e),e&&"ass"===this.utils.getExt(e)?(this.currentType="ass",this.libass.freeTrack(),this.libass.setTrackByUrl(this.#s(e)),this.visible=this.art.subtitle.show):(this.currentType="webvtt",this.hide(),this.libass.freeTrack())}setVisibility(e){this.visible=e}setOffset(e){this.timeOffset=e}get active(){return"ass"===this.currentType}get visible(){return!!this.libass&&"none"!==this.libass.canvasParent.style.display}set visible(e){this.art.emit("artplayerPluginLibass:visible",e),this.#n(!this.active),this.libass.canvasParent&&(this.libass.canvasParent.style.display=e?"block":"none",e&&this.libass.resize())}get timeOffset(){return this.libass.timeOffset}set timeOffset(e){this.art.emit("artplayerPluginLibass:timeOffset",e),this.libass.timeOffset=e}show(){this.visible=!0}hide(){this.visible=!1}destroy(){this.art.emit("artplayerPluginLibass:destroy"),this.#a(),this.libass.dispose(),URL.revokeObjectURL(this.workerScriptUrl),this.libass=null}async #t(e={}){if(!e.fallbackFont)return this.utils.errorHandle(e.fallbackFont,"artplayerPluginLibass: fallbackFont is required");e.workerUrl||(e.workerUrl="https://cdnjs.cloudflare.com/ajax/libs/libass-wasm/4.1.0/js/subtitles-octopus-worker.js"),e.availableFonts&&(e.availableFonts=Object.entries(e.availableFonts).reduce((e,[t,r])=>(e[t]=this.#s(r),e),{})),this.libass=new(0,i.default)({subContent:o,video:this.$video,...e,workerUrl:await this.#i(e),fallbackFont:this.#s(e.fallbackFont),fonts:e.fonts?.map(e=>this.#s(e))}),this.libass.canvasParent.className="artplayer-plugin-libass",this.libass.canvasParent.style.cssText=` position: absolute; top: 0; left: 0; width: 100%; height: 100%; user-select: none; pointer-events: none; z-index: 20;`}#r(){this.switchHandler=this.switch.bind(this),this.visibleHandler=this.setVisibility.bind(this),this.offsetHandler=this.setOffset.bind(this),this.art.on("subtitle",this.visibleHandler),this.art.on("subtitleLoad",this.switchHandler),this.art.on("subtitleOffset",this.offsetHandler),this.art.once("destroy",this.destroy.bind(this))}#a(){this.art.off("subtitle",this.visibleHandler),this.art.off("subtitleLoad",this.switchHandler),this.art.off("subtitleOffset",this.offsetHandler)}#n(e){this.$webvtt.style.visibility=e?"visible":"hidden"}#s(e){return this.#o(e)?e:new URL(e,document.baseURI).toString()}#o(e){return/^https?:\/\//.test(e)}#i({workerUrl:e,wasmUrl:t}){return new Promise(r=>{fetch(e).then(e=>e.text()).then(s=>{let n=s,a=new Blob([n=n.replace(/wasmBinaryFile\s*=\s*"(subtitles-octopus-worker\.wasm)"/g,(r,s)=>(t=t?this.#s(t):new URL(s,e).toString(),`wasmBinaryFile = "${t}"`))],{type:"text/javascript"});r(URL.createObjectURL(a))})})}#e(){let e=!1;try{if("object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate){let t=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));t instanceof WebAssembly.Module&&(e=new WebAssembly.Instance(t)instanceof WebAssembly.Instance)}}catch(t){console.error("WebAssembly is not supported in this browser.",t),e=!1}this.utils.errorHandle(e,"Browser does not support WebAssembly")}}},{"libass-wasm":"j2WPP","@parcel/transformer-js/src/esmodule-helpers.js":"6ykb1"}],j2WPP:[function(e,t,r,s){"use strict";"function"==typeof SubtitlesOctopusOnLoad&&SubtitlesOctopusOnLoad(),t.exports&&(t.exports=function(e){var t=!1;try{if("object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate){let e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));e instanceof WebAssembly.Module&&(t=new WebAssembly.Instance(e)instanceof WebAssembly.Instance)}}catch(e){}console.log("WebAssembly support detected: "+(t?"yes":"no"));var r=this;function s(){r.setCurrentTime(r.video.currentTime+r.timeOffset)}function n(){r.setIsPaused(!1,r.video.currentTime+r.timeOffset)}function a(){r.setIsPaused(!0,r.video.currentTime+r.timeOffset)}function i(){r.video.removeEventListener("timeupdate",s,!1)}function o(){r.video.addEventListener("timeupdate",s,!1);var e=r.video.currentTime+r.timeOffset;r.setCurrentTime(e)}function l(){r.setRate(r.video.playbackRate)}function c(){r.setIsPaused(!0,r.video.currentTime+r.timeOffset)}function d(e){e.target.removeEventListener(e.type,d,!1),r.resize()}function u(){var e=r.renderFramesData,t=performance.now();r.ctx.clearRect(0,0,r.canvas.width,r.canvas.height);for(var s=0;s=1?a[i]:1;var o=new ImageData(a,n.w,n.h);r.bufferCanvasCtx.putImageData(o,0,0),r.ctx.drawImage(r.bufferCanvas,n.x,n.y)}if(r.debug){var l=Math.round(performance.now()-t),c=e.blendTime;void 0!==c?console.log("render: "+Math.round(e.spentTime-c)+" ms, blend: "+Math.round(c)+" ms, draw: "+l+" ms; TOTAL="+Math.round(e.spentTime+l)+" ms"):console.log(Math.round(e.spentTime)+" ms (+ "+l+" ms draw)"),r.renderStart=performance.now()}}function v(){var e=r.renderFramesData,t=performance.now();r.ctx.clearRect(0,0,r.canvas.width,r.canvas.height);for(var s=0;stypeof ResizeObserver&&(r.ro=new ResizeObserver(r.resizeWithTimeout),r.ro.observe(r.video)),r.video.videoWidth>0?r.resize():r.video.addEventListener("loadedmetadata",d,!1))},r.getVideoPosition=function(){var e=r.video.videoWidth/r.video.videoHeight,t=r.video.offsetWidth,s=r.video.offsetHeight,n=t,a=s;t/s>e?n=Math.floor(s*e):a=Math.floor(t/e);var i=(t-n)/2,o=(s-a)/2;return{width:n,height:a,x:i,y:o}},r.setSubUrl=function(e){r.subUrl=e},r.renderFrameData=null,r.workerActive=!1,r.frameId=0,r.onWorkerMessage=function(e){!r.workerActive&&(r.workerActive=!0,r.onReadyEvent&&r.onReadyEvent());var t=e.data;switch(t.target){case"stdout":console.log(t.content);break;case"console-log":console.log.apply(console,JSON.parse(t.content));break;case"console-debug":console.debug.apply(console,JSON.parse(t.content));break;case"console-info":console.info.apply(console,JSON.parse(t.content));break;case"console-warn":console.warn.apply(console,JSON.parse(t.content));break;case"console-error":console.error.apply(console,JSON.parse(t.content));break;case"stderr":console.error(t.content);break;case"window":window[t.method]();break;case"canvas":switch(t.op){case"getContext":r.ctx=r.canvas.getContext(t.type,t.attributes);break;case"resize":r.resize(t.width,t.height);break;case"renderCanvas":r.lastRenderTime0&&a>r.maxRenderHeight&&(a=r.maxRenderHeight),e*=a/t,t=a}return{width:e,height:t}}((a=r.getVideoPosition()).width*r.pixelRatio,a.height*r.pixelRatio);e=i.width,t=i.height;var o=r.canvasParent.getBoundingClientRect().top-r.video.getBoundingClientRect().top;s=a.y-o,n=a.x}if(!e||!t){r.video||console.error("width or height is 0. You should specify width & height for resize.");return}(r.canvas.width!=e||r.canvas.height!=t||r.canvas.style.top!=s||r.canvas.style.left!=n)&&(r.canvas.width=e,r.canvas.height=t,null!=a&&(r.canvasParent.style.position="relative",r.canvas.style.display="block",r.canvas.style.position="absolute",r.canvas.style.width=a.width+"px",r.canvas.style.height=a.height+"px",r.canvas.style.top=s+"px",r.canvas.style.left=n+"px",r.canvas.style.pointerEvents="none"),r.worker.postMessage({target:"canvas",width:r.canvas.width,height:r.canvas.height}))},r.resizeWithTimeout=function(){r.resize(),setTimeout(r.resize,100)},r.runBenchmark=function(){r.worker.postMessage({target:"runBenchmark"})},r.customMessage=function(e,t){t=t||{},r.worker.postMessage({target:"custom",userData:e,preMain:t.preMain})},r.setCurrentTime=function(e){r.worker.postMessage({target:"video",currentTime:e})},r.setTrackByUrl=function(e){r.worker.postMessage({target:"set-track-by-url",url:e})},r.setTrack=function(e){r.worker.postMessage({target:"set-track",content:e})},r.freeTrack=function(e){r.worker.postMessage({target:"free-track"})},r.render=r.setCurrentTime,r.setIsPaused=function(e,t){r.worker.postMessage({target:"video",isPaused:e,currentTime:t})},r.setRate=function(e){r.worker.postMessage({target:"video",rate:e})},r.dispose=function(){r.worker.postMessage({target:"destroy"}),r.worker.terminate(),r.worker.removeEventListener("message",r.onWorkerMessage),r.worker.removeEventListener("error",r.workerError),r.workerActive=!1,r.worker=null,r.video&&(r.video.removeEventListener("timeupdate",s,!1),r.video.removeEventListener("playing",n,!1),r.video.removeEventListener("pause",a,!1),r.video.removeEventListener("seeking",i,!1),r.video.removeEventListener("seeked",o,!1),r.video.removeEventListener("ratechange",l,!1),r.video.removeEventListener("waiting",c,!1),r.video.removeEventListener("loadedmetadata",d,!1),document.removeEventListener("fullscreenchange",r.resizeWithTimeout,!1),document.removeEventListener("mozfullscreenchange",r.resizeWithTimeout,!1),document.removeEventListener("webkitfullscreenchange",r.resizeWithTimeout,!1),document.removeEventListener("msfullscreenchange",r.resizeWithTimeout,!1),window.removeEventListener("resize",r.resizeWithTimeout,!1),r.video.parentNode.removeChild(r.canvasParent),r.video=null),r.ro&&(r.ro.disconnect(),r.ro=null),r.onCustomMessage=null,r.onErrorEvent=null,r.onReadyEvent=null},r.fetchFromWorker=function(e,t,s){try{var n=e.target,a=setTimeout(function(){o(Error("Error: Timeout while try to fetch "+n))},5e3),i=function(e){e.data.target==n&&(t(e.data),r.worker.removeEventListener("message",i),r.worker.removeEventListener("error",o),clearTimeout(a))},o=function(e){s(e),r.worker.removeEventListener("message",i),r.worker.removeEventListener("error",o),clearTimeout(a)};r.worker.addEventListener("message",i),r.worker.addEventListener("error",o),r.worker.postMessage(e)}catch(e){s(e)}},r.createEvent=function(e){r.worker.postMessage({target:"create-event",event:e})},r.getEvents=function(e,t){r.fetchFromWorker({target:"get-events"},function(t){e(t.events)},t)},r.setEvent=function(e,t){r.worker.postMessage({target:"set-event",event:e,index:t})},r.removeEvent=function(e){r.worker.postMessage({target:"remove-event",index:e})},r.createStyle=function(e){r.worker.postMessage({target:"create-style",style:e})},r.getStyles=function(e,t){r.fetchFromWorker({target:"get-styles"},function(t){e(t.styles)},t)},r.setStyle=function(e,t){r.worker.postMessage({target:"set-style",style:e,index:t})},r.removeStyle=function(e){r.worker.postMessage({target:"remove-style",index:e})},r.init()})},{}],"6ykb1":[function(e,t,r,s){r.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},r.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.exportAll=function(e,t){return Object.keys(e).forEach(function(r){"default"===r||"__esModule"===r||Object.prototype.hasOwnProperty.call(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[r]}})}),t},r.export=function(e,t,r){Object.defineProperty(e,t,{enumerable:!0,get:r})}},{}]},["9G2Gn"],"9G2Gn","parcelRequire4dc0",{}); \ No newline at end of file diff --git a/packages/artplayer-plugin-libass/dist/artplayer-plugin-libass.legacy.js b/packages/artplayer-plugin-libass/dist/artplayer-plugin-libass.legacy.js deleted file mode 100644 index 9d4ec113f..000000000 --- a/packages/artplayer-plugin-libass/dist/artplayer-plugin-libass.legacy.js +++ /dev/null @@ -1,8 +0,0 @@ - -/*! - * artplayer-plugin-libass.js v1.0.0 - * Github: https://github.com/zhw2590582/ArtPlayer - * (c) 2017-2026 Harvey Zack - * Released under the MIT License. - */ -!function(e,t,r,n,s,i,a,o){var c="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},l="function"==typeof c[n]&&c[n],u=l.i||{},d=l.cache||{},f="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function h(t,r){if(!d[t]){if(!e[t]){if(s[t])return s[t];var i="function"==typeof c[n]&&c[n];if(!r&&i)return i(t,!0);if(l)return l(t,!0);if(f&&"string"==typeof t)return f(t);var a=Error("Cannot find module '"+t+"'");throw a.code="MODULE_NOT_FOUND",a}u.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},u.cache={};var o=d[t]=new h.Module(t);e[t][0].call(o.exports,u,o,o.exports,c)}return d[t].exports;function u(e){var t=u.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var r={__esModule:!0};return t.forEach(function(e){var t=e[0],n=e[1],s=e[2]||e[0],i=h(n);"*"===t?Object.keys(i).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(r,e)||Object.defineProperty(r,e,{enumerable:!0,get:function(){return i[e]}})}):"*"===s?Object.defineProperty(r,t,{enumerable:!0,value:i}):Object.defineProperty(r,t,{enumerable:!0,get:function(){return"default"===s?i.__esModule?i.default:i:i[s]}})}),r}return h(t)}}h.isParcelRequire=!0,h.Module=function(e){this.id=e,this.bundle=h,this.require=f,this.exports={}},h.modules=e,h.cache=d,h.parent=l,h.distDir=void 0,h.publicUrl=void 0,h.devServer=void 0,h.i=u,h.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(h,"root",{get:function(){return c[n]}}),c[n]=h;for(var v=0;vtypeof module?module.exports=p:"function"==typeof define&&define.amd&&define(function(){return p})}}({"4kqKD":[function(e,t,r,n){var s=e("@parcel/transformer-js/src/esmodule-helpers.js");s.defineInteropFlag(r),s.export(r,"default",function(){return o});var i=e("./adapter"),a=s.interopDefault(i);function o(e){return function(t){var r=new(0,a.default)(t,e);return{name:"artplayerPluginLibass",libass:r.libass,visible:r.visible,init:r.init.bind(r),switch:r.switch.bind(r),show:r.show.bind(r),hide:r.hide.bind(r),destroy:r.destroy.bind(r)}}}"u">typeof window&&(window.artplayerPluginLibass=o)},{"./adapter":"jEGLL","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],jEGLL:[function(e,t,r,n){var s=e("@parcel/transformer-js/src/esmodule-helpers.js");s.defineInteropFlag(r),s.export(r,"default",function(){return L});var i=e("@swc/helpers/cjs/_async_to_generator.cjs"),a=e("@swc/helpers/cjs/_class_call_check.cjs"),o=e("@swc/helpers/cjs/_class_private_method_get.cjs"),c=e("@swc/helpers/cjs/_class_private_method_init.cjs"),l=e("@swc/helpers/cjs/_create_class.cjs"),u=e("@swc/helpers/cjs/_object_spread.cjs"),d=e("@swc/helpers/cjs/_object_spread_props.cjs"),f=e("@swc/helpers/cjs/_sliced_to_array.cjs"),h=e("@swc/helpers/cjs/_type_of.cjs"),v=e("@swc/helpers/cjs/_ts_generator.cjs"),p=e("libass-wasm"),b=s.interopDefault(p),m=new WeakSet,y=new WeakSet,w=new WeakSet,g=new WeakSet,k=new WeakSet,_=new WeakSet,j=new WeakSet,E=new WeakSet,L=function(){"use strict";function e(t,r){(0,a._)(this,e),(0,c._)(this,m),(0,c._)(this,y),(0,c._)(this,w),(0,c._)(this,g),(0,c._)(this,k),(0,c._)(this,_),(0,c._)(this,j),(0,c._)(this,E);var n=t.constructor,s=t.template;this.art=t,this.$video=s.$video,this.$webvtt=s.$subtitle,this.utils=n.utils,this.libass=null,t.once("ready",this.init.bind(this,r))}return(0,l._)(e,[{key:"init",value:function(e){return(0,i._)(function(){var t,r,n,s;return(0,v._)(this,function(i){switch(i.label){case 0:return(0,o._)(this,E,C).call(this),[4,(0,o._)(this,m,O).call(this,e)];case 1:return i.sent(),(0,o._)(this,y,M).call(this),this.art.emit("artplayerPluginLibass:init",this),(s=null==(n=this.art)||null==(r=n.option)||null==(t=r.subtitle)?void 0:t.url)&&"ass"===this.utils.getExt(s)&&this.switch(s),[2]}})}).call(this)}},{key:"switch",value:function(e){this.art.emit("artplayerPluginLibass:switch",e),e&&"ass"===this.utils.getExt(e)?(this.currentType="ass",this.libass.freeTrack(),this.libass.setTrackByUrl((0,o._)(this,k,P).call(this,e)),this.visible=this.art.subtitle.show):(this.currentType="webvtt",this.hide(),this.libass.freeTrack())}},{key:"setVisibility",value:function(e){this.visible=e}},{key:"setOffset",value:function(e){this.timeOffset=e}},{key:"active",get:function(){return"ass"===this.currentType}},{key:"visible",get:function(){return!!this.libass&&"none"!==this.libass.canvasParent.style.display},set:function(e){this.art.emit("artplayerPluginLibass:visible",e),(0,o._)(this,g,T).call(this,!this.active),this.libass.canvasParent&&(this.libass.canvasParent.style.display=e?"block":"none",e&&this.libass.resize())}},{key:"timeOffset",get:function(){return this.libass.timeOffset},set:function(e){this.art.emit("artplayerPluginLibass:timeOffset",e),this.libass.timeOffset=e}},{key:"show",value:function(){this.visible=!0}},{key:"hide",value:function(){this.visible=!1}},{key:"destroy",value:function(){this.art.emit("artplayerPluginLibass:destroy"),(0,o._)(this,w,x).call(this),this.libass.dispose(),URL.revokeObjectURL(this.workerScriptUrl),this.libass=null}}]),e}();function O(){return(0,i._)(function(){var e,t,r,n,s,i,a,c=arguments;return(0,v._)(this,function(l){switch(l.label){case 0:if(e=this,!(t=c.length>0&&void 0!==c[0]?c[0]:{}).fallbackFont)return[2,this.utils.errorHandle(t.fallbackFont,"artplayerPluginLibass: fallbackFont is required")];return t.workerUrl||(t.workerUrl="https://cdnjs.cloudflare.com/ajax/libs/libass-wasm/4.1.0/js/subtitles-octopus-worker.js"),t.availableFonts&&(t.availableFonts=Object.entries(t.availableFonts).reduce(function(t,r){var n=(0,f._)(r,2),s=n[0],i=n[1];return t[s]=(0,o._)(e,k,P).call(e,i),t},{})),n=this,s=b.default.bind,i=[(0,u._)({subContent:"[Script Info]\nScriptType: v4.00+",video:this.$video},t)],a={},[4,(0,o._)(this,j,W).call(this,t)];case 1:return n.libass=new(s.apply(b.default,[void 0,d._.apply(void 0,i.concat([(a.workerUrl=l.sent(),a.fallbackFont=(0,o._)(this,k,P).call(this,t.fallbackFont),a.fonts=null==(r=t.fonts)?void 0:r.map(function(t){return(0,o._)(e,k,P).call(e,t)}),a)]))])),this.libass.canvasParent.className="artplayer-plugin-libass",this.libass.canvasParent.style.cssText="\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n user-select: none;\n pointer-events: none;\n z-index: 20;",[2]}})}).apply(this,arguments)}function M(){this.switchHandler=this.switch.bind(this),this.visibleHandler=this.setVisibility.bind(this),this.offsetHandler=this.setOffset.bind(this),this.art.on("subtitle",this.visibleHandler),this.art.on("subtitleLoad",this.switchHandler),this.art.on("subtitleOffset",this.offsetHandler),this.art.once("destroy",this.destroy.bind(this))}function x(){this.art.off("subtitle",this.visibleHandler),this.art.off("subtitleLoad",this.switchHandler),this.art.off("subtitleOffset",this.offsetHandler)}function T(e){this.$webvtt.style.visibility=e?"visible":"hidden"}function P(e){return(0,o._)(this,_,A).call(this,e)?e:new URL(e,document.baseURI).toString()}function A(e){return/^https?:\/\//.test(e)}function W(e){var t=this,r=e.workerUrl,n=e.wasmUrl;return new Promise(function(e){fetch(r).then(function(e){return e.text()}).then(function(s){var i=s,a=new Blob([i=i.replace(/wasmBinaryFile\s*=\s*"(subtitles-octopus-worker\.wasm)"/g,function(e,s){return n=n?(0,o._)(t,k,P).call(t,n):new URL(s,r).toString(),'wasmBinaryFile = "'.concat(n,'"')})],{type:"text/javascript"});e(URL.createObjectURL(a))})})}function C(){var e=!1;try{if(("u"typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=s){var i=[],a=!0,o=!1;try{for(s=s.call(e);!(a=(r=s.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){o=!0,n=e}finally{try{a||null==s.return||s.return()}finally{if(o)throw n}}return i}}},{}],heYSj:[function(e,t,r,n){"use strict";r._=function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},{}],fh7mx:[function(e,t,r,n){"use strict";var s=e("3ee51b7dc02d0c44");r._=function(e,t){if(e){if("string"==typeof e)return s._(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return s._(e,t)}}},{"3ee51b7dc02d0c44":"1WOAB"}],"1WOAB":[function(e,t,r,n){"use strict";r._=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);rtypeof Symbol&&e.constructor===Symbol?"symbol":typeof e}},{}],eltGh:[function(e,t,r,n){"use strict";r._=function(e,t){var r,n,s,i={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),o=Object.defineProperty;return o(a,"next",{value:c(0)}),o(a,"throw",{value:c(1)}),o(a,"return",{value:c(2)}),"function"==typeof Symbol&&o(a,Symbol.iterator,{value:function(){return this}}),a;function c(o){return function(c){var l=[o,c];if(r)throw TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(i=0)),i;)try{if(r=1,n&&(s=2&l[0]?n.return:l[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,l[1])).done)return s;switch(n=0,s&&(l=[2&l[0],s.value]),l[0]){case 0:case 1:s=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,n=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(s=(s=i.trys).length>0&&s[s.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!s||l[1]>s[0]&&l[1]=1?i[a]:1;var o=new ImageData(i,s.w,s.h);n.bufferCanvasCtx.putImageData(o,0,0),n.ctx.drawImage(n.bufferCanvas,s.x,s.y)}if(n.debug){var c=Math.round(performance.now()-t),l=e.blendTime;void 0!==l?console.log("render: "+Math.round(e.spentTime-l)+" ms, blend: "+Math.round(l)+" ms, draw: "+c+" ms; TOTAL="+Math.round(e.spentTime+c)+" ms"):console.log(Math.round(e.spentTime)+" ms (+ "+c+" ms draw)"),n.renderStart=performance.now()}}function v(){var e=n.renderFramesData,t=performance.now();n.ctx.clearRect(0,0,n.canvas.width,n.canvas.height);for(var r=0;rtypeof ResizeObserver&&(n.ro=new ResizeObserver(n.resizeWithTimeout),n.ro.observe(n.video)),n.video.videoWidth>0?n.resize():n.video.addEventListener("loadedmetadata",f,!1))},n.getVideoPosition=function(){var e=n.video.videoWidth/n.video.videoHeight,t=n.video.offsetWidth,r=n.video.offsetHeight,s=t,i=r;t/r>e?s=Math.floor(r*e):i=Math.floor(t/e);var a=(t-s)/2,o=(r-i)/2;return{width:s,height:i,x:a,y:o}},n.setSubUrl=function(e){n.subUrl=e},n.renderFrameData=null,n.workerActive=!1,n.frameId=0,n.onWorkerMessage=function(e){!n.workerActive&&(n.workerActive=!0,n.onReadyEvent&&n.onReadyEvent());var t=e.data;switch(t.target){case"stdout":console.log(t.content);break;case"console-log":console.log.apply(console,JSON.parse(t.content));break;case"console-debug":console.debug.apply(console,JSON.parse(t.content));break;case"console-info":console.info.apply(console,JSON.parse(t.content));break;case"console-warn":console.warn.apply(console,JSON.parse(t.content));break;case"console-error":console.error.apply(console,JSON.parse(t.content));break;case"stderr":console.error(t.content);break;case"window":window[t.method]();break;case"canvas":switch(t.op){case"getContext":n.ctx=n.canvas.getContext(t.type,t.attributes);break;case"resize":n.resize(t.width,t.height);break;case"renderCanvas":n.lastRenderTime0&&i>n.maxRenderHeight&&(i=n.maxRenderHeight),e*=i/t,t=i}return{width:e,height:t}}((i=n.getVideoPosition()).width*n.pixelRatio,i.height*n.pixelRatio);e=a.width,t=a.height;var o=n.canvasParent.getBoundingClientRect().top-n.video.getBoundingClientRect().top;r=i.y-o,s=i.x}if(!e||!t){n.video||console.error("width or height is 0. You should specify width & height for resize.");return}(n.canvas.width!=e||n.canvas.height!=t||n.canvas.style.top!=r||n.canvas.style.left!=s)&&(n.canvas.width=e,n.canvas.height=t,null!=i&&(n.canvasParent.style.position="relative",n.canvas.style.display="block",n.canvas.style.position="absolute",n.canvas.style.width=i.width+"px",n.canvas.style.height=i.height+"px",n.canvas.style.top=r+"px",n.canvas.style.left=s+"px",n.canvas.style.pointerEvents="none"),n.worker.postMessage({target:"canvas",width:n.canvas.width,height:n.canvas.height}))},n.resizeWithTimeout=function(){n.resize(),setTimeout(n.resize,100)},n.runBenchmark=function(){n.worker.postMessage({target:"runBenchmark"})},n.customMessage=function(e,t){t=t||{},n.worker.postMessage({target:"custom",userData:e,preMain:t.preMain})},n.setCurrentTime=function(e){n.worker.postMessage({target:"video",currentTime:e})},n.setTrackByUrl=function(e){n.worker.postMessage({target:"set-track-by-url",url:e})},n.setTrack=function(e){n.worker.postMessage({target:"set-track",content:e})},n.freeTrack=function(e){n.worker.postMessage({target:"free-track"})},n.render=n.setCurrentTime,n.setIsPaused=function(e,t){n.worker.postMessage({target:"video",isPaused:e,currentTime:t})},n.setRate=function(e){n.worker.postMessage({target:"video",rate:e})},n.dispose=function(){n.worker.postMessage({target:"destroy"}),n.worker.terminate(),n.worker.removeEventListener("message",n.onWorkerMessage),n.worker.removeEventListener("error",n.workerError),n.workerActive=!1,n.worker=null,n.video&&(n.video.removeEventListener("timeupdate",i,!1),n.video.removeEventListener("playing",a,!1),n.video.removeEventListener("pause",o,!1),n.video.removeEventListener("seeking",c,!1),n.video.removeEventListener("seeked",l,!1),n.video.removeEventListener("ratechange",u,!1),n.video.removeEventListener("waiting",d,!1),n.video.removeEventListener("loadedmetadata",f,!1),document.removeEventListener("fullscreenchange",n.resizeWithTimeout,!1),document.removeEventListener("mozfullscreenchange",n.resizeWithTimeout,!1),document.removeEventListener("webkitfullscreenchange",n.resizeWithTimeout,!1),document.removeEventListener("msfullscreenchange",n.resizeWithTimeout,!1),window.removeEventListener("resize",n.resizeWithTimeout,!1),n.video.parentNode.removeChild(n.canvasParent),n.video=null),n.ro&&(n.ro.disconnect(),n.ro=null),n.onCustomMessage=null,n.onErrorEvent=null,n.onReadyEvent=null},n.fetchFromWorker=function(e,t,r){try{var s=e.target,i=setTimeout(function(){o(Error("Error: Timeout while try to fetch "+s))},5e3),a=function(e){e.data.target==s&&(t(e.data),n.worker.removeEventListener("message",a),n.worker.removeEventListener("error",o),clearTimeout(i))},o=function(e){r(e),n.worker.removeEventListener("message",a),n.worker.removeEventListener("error",o),clearTimeout(i)};n.worker.addEventListener("message",a),n.worker.addEventListener("error",o),n.worker.postMessage(e)}catch(e){r(e)}},n.createEvent=function(e){n.worker.postMessage({target:"create-event",event:e})},n.getEvents=function(e,t){n.fetchFromWorker({target:"get-events"},function(t){e(t.events)},t)},n.setEvent=function(e,t){n.worker.postMessage({target:"set-event",event:e,index:t})},n.removeEvent=function(e){n.worker.postMessage({target:"remove-event",index:e})},n.createStyle=function(e){n.worker.postMessage({target:"create-style",style:e})},n.getStyles=function(e,t){n.fetchFromWorker({target:"get-styles"},function(t){e(t.styles)},t)},n.setStyle=function(e,t){n.worker.postMessage({target:"set-style",style:e,index:t})},n.removeStyle=function(e){n.worker.postMessage({target:"remove-style",index:e})},n.init()})},{"@swc/helpers/cjs/_type_of.cjs":"iXhRw"}],qpMMf:[function(e,t,r,n){r.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},r.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.exportAll=function(e,t){return Object.keys(e).forEach(function(r){"default"===r||"__esModule"===r||Object.prototype.hasOwnProperty.call(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[r]}})}),t},r.export=function(e,t,r){Object.defineProperty(e,t,{enumerable:!0,get:r})}},{}]},["4kqKD"],"4kqKD","parcelRequire4dc0",{}); \ No newline at end of file diff --git a/packages/artplayer-plugin-libass/dist/artplayer-plugin-libass.mjs b/packages/artplayer-plugin-libass/dist/artplayer-plugin-libass.mjs deleted file mode 100644 index 87389404f..000000000 --- a/packages/artplayer-plugin-libass/dist/artplayer-plugin-libass.mjs +++ /dev/null @@ -1,8 +0,0 @@ - -/*! - * artplayer-plugin-libass.js v1.0.0 - * Github: https://github.com/zhw2590582/ArtPlayer - * (c) 2017-2026 Harvey Zack - * Released under the MIT License. - */ -!function(e,t,r,s,a,i,n,o){var l="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},c="function"==typeof l[s]&&l[s],d=c.i||{},u=c.cache||{},v="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function f(t,r){if(!u[t]){if(!e[t]){if(a[t])return a[t];var i="function"==typeof l[s]&&l[s];if(!r&&i)return i(t,!0);if(c)return c(t,!0);if(v&&"string"==typeof t)return v(t);var n=Error("Cannot find module '"+t+"'");throw n.code="MODULE_NOT_FOUND",n}d.resolve=function(r){var s=e[t][1][r];return null!=s?s:r},d.cache={};var o=u[t]=new f.Module(t);e[t][0].call(o.exports,d,o,o.exports,l)}return u[t].exports;function d(e){var t=d.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var r={__esModule:!0};return t.forEach(function(e){var t=e[0],s=e[1],a=e[2]||e[0],i=f(s);"*"===t?Object.keys(i).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(r,e)||Object.defineProperty(r,e,{enumerable:!0,get:function(){return i[e]}})}):"*"===a?Object.defineProperty(r,t,{enumerable:!0,value:i}):Object.defineProperty(r,t,{enumerable:!0,get:function(){return"default"===a?i.__esModule?i.default:i:i[a]}})}),r}return f(t)}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.require=v,this.exports={}},f.modules=e,f.cache=u,f.parent=c,f.distDir=void 0,f.publicUrl=void 0,f.devServer=void 0,f.i=d,f.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(f,"root",{get:function(){return l[s]}}),l[s]=f;for(var h=0;htypeof module?module.exports=m:"function"==typeof define&&define.amd&&define(function(){return m})}}({hSedR:[function(e,t,r,s){var a=e("@parcel/transformer-js/src/esmodule-helpers.js");a.defineInteropFlag(r),a.export(r,"default",()=>o);var i=e("./adapter"),n=a.interopDefault(i);function o(e){return t=>{let r=new(0,n.default)(t,e);return{name:"artplayerPluginLibass",libass:r.libass,visible:r.visible,init:r.init.bind(r),switch:r.switch.bind(r),show:r.show.bind(r),hide:r.hide.bind(r),destroy:r.destroy.bind(r)}}}"u">typeof window&&(window.artplayerPluginLibass=o)},{"./adapter":"ba6AI","@parcel/transformer-js/src/esmodule-helpers.js":"loqXi"}],ba6AI:[function(e,t,r,s){var a=e("@parcel/transformer-js/src/esmodule-helpers.js");a.defineInteropFlag(r);var i=e("libass-wasm"),n=a.interopDefault(i);let o=`[Script Info] ScriptType: v4.00+`;r.default=class{constructor(e,t){let{constructor:r,template:s}=e;this.art=e,this.$video=s.$video,this.$webvtt=s.$subtitle,this.utils=r.utils,this.libass=null,e.once("ready",this.init.bind(this,t))}async init(e){this.#e(),await this.#t(e),this.#r(),this.art.emit("artplayerPluginLibass:init",this);let t=this.art?.option?.subtitle?.url;t&&"ass"===this.utils.getExt(t)&&this.switch(t)}switch(e){this.art.emit("artplayerPluginLibass:switch",e),e&&"ass"===this.utils.getExt(e)?(this.currentType="ass",this.libass.freeTrack(),this.libass.setTrackByUrl(this.#s(e)),this.visible=this.art.subtitle.show):(this.currentType="webvtt",this.hide(),this.libass.freeTrack())}setVisibility(e){this.visible=e}setOffset(e){this.timeOffset=e}get active(){return"ass"===this.currentType}get visible(){return!!this.libass&&"none"!==this.libass.canvasParent.style.display}set visible(e){this.art.emit("artplayerPluginLibass:visible",e),this.#a(!this.active),this.libass.canvasParent&&(this.libass.canvasParent.style.display=e?"block":"none",e&&this.libass.resize())}get timeOffset(){return this.libass.timeOffset}set timeOffset(e){this.art.emit("artplayerPluginLibass:timeOffset",e),this.libass.timeOffset=e}show(){this.visible=!0}hide(){this.visible=!1}destroy(){this.art.emit("artplayerPluginLibass:destroy"),this.#i(),this.libass.dispose(),URL.revokeObjectURL(this.workerScriptUrl),this.libass=null}async #t(e={}){if(!e.fallbackFont)return this.utils.errorHandle(e.fallbackFont,"artplayerPluginLibass: fallbackFont is required");e.workerUrl||(e.workerUrl="https://cdnjs.cloudflare.com/ajax/libs/libass-wasm/4.1.0/js/subtitles-octopus-worker.js"),e.availableFonts&&(e.availableFonts=Object.entries(e.availableFonts).reduce((e,[t,r])=>(e[t]=this.#s(r),e),{})),this.libass=new(0,n.default)({subContent:o,video:this.$video,...e,workerUrl:await this.#n(e),fallbackFont:this.#s(e.fallbackFont),fonts:e.fonts?.map(e=>this.#s(e))}),this.libass.canvasParent.className="artplayer-plugin-libass",this.libass.canvasParent.style.cssText=` position: absolute; top: 0; left: 0; width: 100%; height: 100%; user-select: none; pointer-events: none; z-index: 20;`}#r(){this.switchHandler=this.switch.bind(this),this.visibleHandler=this.setVisibility.bind(this),this.offsetHandler=this.setOffset.bind(this),this.art.on("subtitle",this.visibleHandler),this.art.on("subtitleLoad",this.switchHandler),this.art.on("subtitleOffset",this.offsetHandler),this.art.once("destroy",this.destroy.bind(this))}#i(){this.art.off("subtitle",this.visibleHandler),this.art.off("subtitleLoad",this.switchHandler),this.art.off("subtitleOffset",this.offsetHandler)}#a(e){this.$webvtt.style.visibility=e?"visible":"hidden"}#s(e){return this.#o(e)?e:new URL(e,document.baseURI).toString()}#o(e){return/^https?:\/\//.test(e)}#n({workerUrl:e,wasmUrl:t}){return new Promise(r=>{fetch(e).then(e=>e.text()).then(s=>{let a=s,i=new Blob([a=a.replace(/wasmBinaryFile\s*=\s*"(subtitles-octopus-worker\.wasm)"/g,(r,s)=>(t=t?this.#s(t):new URL(s,e).toString(),`wasmBinaryFile = "${t}"`))],{type:"text/javascript"});r(URL.createObjectURL(i))})})}#e(){let e=!1;try{if("object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate){let t=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));t instanceof WebAssembly.Module&&(e=new WebAssembly.Instance(t)instanceof WebAssembly.Instance)}}catch(t){console.error("WebAssembly is not supported in this browser.",t),e=!1}this.utils.errorHandle(e,"Browser does not support WebAssembly")}}},{"libass-wasm":"k2X1g","@parcel/transformer-js/src/esmodule-helpers.js":"loqXi"}],k2X1g:[function(e,t,r,s){"function"==typeof SubtitlesOctopusOnLoad&&SubtitlesOctopusOnLoad(),t.exports&&(t.exports=function(e){var t=!1;try{if("object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate){let e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));e instanceof WebAssembly.Module&&(t=new WebAssembly.Instance(e)instanceof WebAssembly.Instance)}}catch(e){}console.log("WebAssembly support detected: "+(t?"yes":"no"));var r=this;function s(){r.setCurrentTime(r.video.currentTime+r.timeOffset)}function a(){r.setIsPaused(!1,r.video.currentTime+r.timeOffset)}function i(){r.setIsPaused(!0,r.video.currentTime+r.timeOffset)}function n(){r.video.removeEventListener("timeupdate",s,!1)}function o(){r.video.addEventListener("timeupdate",s,!1);var e=r.video.currentTime+r.timeOffset;r.setCurrentTime(e)}function l(){r.setRate(r.video.playbackRate)}function c(){r.setIsPaused(!0,r.video.currentTime+r.timeOffset)}function d(e){e.target.removeEventListener(e.type,d,!1),r.resize()}function u(){var e=r.renderFramesData,t=performance.now();r.ctx.clearRect(0,0,r.canvas.width,r.canvas.height);for(var s=0;s=1?i[n]:1;var o=new ImageData(i,a.w,a.h);r.bufferCanvasCtx.putImageData(o,0,0),r.ctx.drawImage(r.bufferCanvas,a.x,a.y)}if(r.debug){var l=Math.round(performance.now()-t),c=e.blendTime;void 0!==c?console.log("render: "+Math.round(e.spentTime-c)+" ms, blend: "+Math.round(c)+" ms, draw: "+l+" ms; TOTAL="+Math.round(e.spentTime+l)+" ms"):console.log(Math.round(e.spentTime)+" ms (+ "+l+" ms draw)"),r.renderStart=performance.now()}}function v(){var e=r.renderFramesData,t=performance.now();r.ctx.clearRect(0,0,r.canvas.width,r.canvas.height);for(var s=0;stypeof ResizeObserver&&(r.ro=new ResizeObserver(r.resizeWithTimeout),r.ro.observe(r.video)),r.video.videoWidth>0?r.resize():r.video.addEventListener("loadedmetadata",d,!1))},r.getVideoPosition=function(){var e=r.video.videoWidth/r.video.videoHeight,t=r.video.offsetWidth,s=r.video.offsetHeight,a=t,i=s;t/s>e?a=Math.floor(s*e):i=Math.floor(t/e);var n=(t-a)/2,o=(s-i)/2;return{width:a,height:i,x:n,y:o}},r.setSubUrl=function(e){r.subUrl=e},r.renderFrameData=null,r.workerActive=!1,r.frameId=0,r.onWorkerMessage=function(e){!r.workerActive&&(r.workerActive=!0,r.onReadyEvent&&r.onReadyEvent());var t=e.data;switch(t.target){case"stdout":console.log(t.content);break;case"console-log":console.log.apply(console,JSON.parse(t.content));break;case"console-debug":console.debug.apply(console,JSON.parse(t.content));break;case"console-info":console.info.apply(console,JSON.parse(t.content));break;case"console-warn":console.warn.apply(console,JSON.parse(t.content));break;case"console-error":console.error.apply(console,JSON.parse(t.content));break;case"stderr":console.error(t.content);break;case"window":window[t.method]();break;case"canvas":switch(t.op){case"getContext":r.ctx=r.canvas.getContext(t.type,t.attributes);break;case"resize":r.resize(t.width,t.height);break;case"renderCanvas":r.lastRenderTime0&&i>r.maxRenderHeight&&(i=r.maxRenderHeight),e*=i/t,t=i}return{width:e,height:t}}((i=r.getVideoPosition()).width*r.pixelRatio,i.height*r.pixelRatio);e=n.width,t=n.height;var o=r.canvasParent.getBoundingClientRect().top-r.video.getBoundingClientRect().top;s=i.y-o,a=i.x}if(!e||!t){r.video||console.error("width or height is 0. You should specify width & height for resize.");return}(r.canvas.width!=e||r.canvas.height!=t||r.canvas.style.top!=s||r.canvas.style.left!=a)&&(r.canvas.width=e,r.canvas.height=t,null!=i&&(r.canvasParent.style.position="relative",r.canvas.style.display="block",r.canvas.style.position="absolute",r.canvas.style.width=i.width+"px",r.canvas.style.height=i.height+"px",r.canvas.style.top=s+"px",r.canvas.style.left=a+"px",r.canvas.style.pointerEvents="none"),r.worker.postMessage({target:"canvas",width:r.canvas.width,height:r.canvas.height}))},r.resizeWithTimeout=function(){r.resize(),setTimeout(r.resize,100)},r.runBenchmark=function(){r.worker.postMessage({target:"runBenchmark"})},r.customMessage=function(e,t){t=t||{},r.worker.postMessage({target:"custom",userData:e,preMain:t.preMain})},r.setCurrentTime=function(e){r.worker.postMessage({target:"video",currentTime:e})},r.setTrackByUrl=function(e){r.worker.postMessage({target:"set-track-by-url",url:e})},r.setTrack=function(e){r.worker.postMessage({target:"set-track",content:e})},r.freeTrack=function(e){r.worker.postMessage({target:"free-track"})},r.render=r.setCurrentTime,r.setIsPaused=function(e,t){r.worker.postMessage({target:"video",isPaused:e,currentTime:t})},r.setRate=function(e){r.worker.postMessage({target:"video",rate:e})},r.dispose=function(){r.worker.postMessage({target:"destroy"}),r.worker.terminate(),r.worker.removeEventListener("message",r.onWorkerMessage),r.worker.removeEventListener("error",r.workerError),r.workerActive=!1,r.worker=null,r.video&&(r.video.removeEventListener("timeupdate",s,!1),r.video.removeEventListener("playing",a,!1),r.video.removeEventListener("pause",i,!1),r.video.removeEventListener("seeking",n,!1),r.video.removeEventListener("seeked",o,!1),r.video.removeEventListener("ratechange",l,!1),r.video.removeEventListener("waiting",c,!1),r.video.removeEventListener("loadedmetadata",d,!1),document.removeEventListener("fullscreenchange",r.resizeWithTimeout,!1),document.removeEventListener("mozfullscreenchange",r.resizeWithTimeout,!1),document.removeEventListener("webkitfullscreenchange",r.resizeWithTimeout,!1),document.removeEventListener("msfullscreenchange",r.resizeWithTimeout,!1),window.removeEventListener("resize",r.resizeWithTimeout,!1),r.video.parentNode.removeChild(r.canvasParent),r.video=null),r.ro&&(r.ro.disconnect(),r.ro=null),r.onCustomMessage=null,r.onErrorEvent=null,r.onReadyEvent=null},r.fetchFromWorker=function(e,t,s){try{var a=e.target,i=setTimeout(function(){o(Error("Error: Timeout while try to fetch "+a))},5e3),n=function(e){e.data.target==a&&(t(e.data),r.worker.removeEventListener("message",n),r.worker.removeEventListener("error",o),clearTimeout(i))},o=function(e){s(e),r.worker.removeEventListener("message",n),r.worker.removeEventListener("error",o),clearTimeout(i)};r.worker.addEventListener("message",n),r.worker.addEventListener("error",o),r.worker.postMessage(e)}catch(e){s(e)}},r.createEvent=function(e){r.worker.postMessage({target:"create-event",event:e})},r.getEvents=function(e,t){r.fetchFromWorker({target:"get-events"},function(t){e(t.events)},t)},r.setEvent=function(e,t){r.worker.postMessage({target:"set-event",event:e,index:t})},r.removeEvent=function(e){r.worker.postMessage({target:"remove-event",index:e})},r.createStyle=function(e){r.worker.postMessage({target:"create-style",style:e})},r.getStyles=function(e,t){r.fetchFromWorker({target:"get-styles"},function(t){e(t.styles)},t)},r.setStyle=function(e,t){r.worker.postMessage({target:"set-style",style:e,index:t})},r.removeStyle=function(e){r.worker.postMessage({target:"remove-style",index:e})},r.init()})},{}],loqXi:[function(e,t,r,s){r.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},r.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.exportAll=function(e,t){return Object.keys(e).forEach(function(r){"default"===r||"__esModule"===r||Object.prototype.hasOwnProperty.call(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[r]}})}),t},r.export=function(e,t,r){Object.defineProperty(e,t,{enumerable:!0,get:r})}},{}]},["hSedR"],"hSedR","parcelRequire4dc0",{});let{default:e}=parcelRequire4dc0("hSedR");export{e as default}; \ No newline at end of file diff --git a/packages/artplayer-plugin-libass/package.json b/packages/artplayer-plugin-libass/package.json deleted file mode 100644 index 51924cf90..000000000 --- a/packages/artplayer-plugin-libass/package.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "name": "artplayer-plugin-libass", - "version": "1.0.0", - "description": "A powerful ass subtitle renderer `libass-wasm` for ArtPlayer", - "author": "Harvey Zack ", - "license": "MIT", - "homepage": "https://artplayer.org", - "repository": { - "type": "git", - "url": "git+https://github.com/zhw2590582/ArtPlayer.git" - }, - "bugs": { - "url": "https://github.com/zhw2590582/ArtPlayer/issues" - }, - "keywords": [ - "html5", - "video", - "player" - ], - "exports": { - ".": { - "types": "./types/artplayer-plugin-libass.d.ts", - "import": "./dist/artplayer-plugin-libass.mjs", - "require": "./dist/artplayer-plugin-libass.js" - }, - "./legacy": { - "types": "./types/artplayer-plugin-libass.d.ts", - "import": "./dist/artplayer-plugin-libass.legacy.js", - "require": "./dist/artplayer-plugin-libass.legacy.js" - } - }, - "main": "./dist/artplayer-plugin-libass.js", - "module": "./dist/artplayer-plugin-libass.mjs", - "types": "./types/artplayer-plugin-libass.d.ts", - "legacy": "./dist/artplayer-plugin-libass.legacy.js", - "browserslist": "last 1 Chrome version", - "dependencies": { - "libass-wasm": "^4.1.0" - }, - "devDependencies": { - "@hrgui/libass-wasm-ts": "^1.0.3" - } -} diff --git a/packages/artplayer-plugin-libass/src/adapter.js b/packages/artplayer-plugin-libass/src/adapter.js deleted file mode 100644 index 44e68e0ad..000000000 --- a/packages/artplayer-plugin-libass/src/adapter.js +++ /dev/null @@ -1,226 +0,0 @@ -import SubtitlesOctopus from 'libass-wasm' - -const defaultAssSubtitle = `[Script Info]\nScriptType: v4.00+` - -export default class LibassAdapter { - constructor(art, option) { - const { constructor, template } = art - - this.art = art - this.$video = template.$video - this.$webvtt = template.$subtitle - this.utils = constructor.utils - - this.libass = null - - art.once('ready', this.init.bind(this, option)) - } - - async init(option) { - this.#checkWebAssemblySupport() - - await this.#createLibass(option) - - this.#addEventListeners() - - this.art.emit('artplayerPluginLibass:init', this) - - // set initial subtitle - const initialSubtitle = this.art?.option?.subtitle?.url - if (initialSubtitle && this.utils.getExt(initialSubtitle) === 'ass') { - this.switch(initialSubtitle) - } - } - - switch(url) { - this.art.emit('artplayerPluginLibass:switch', url) - - if (url && this.utils.getExt(url) === 'ass') { - this.currentType = 'ass' - this.libass.freeTrack() - this.libass.setTrackByUrl(this.#toAbsoluteUrl(url)) - - this.visible = this.art.subtitle.show - } - else { - this.currentType = 'webvtt' - this.hide() - this.libass.freeTrack() - } - } - - setVisibility(visible) { - this.visible = visible - } - - setOffset(offset) { - this.timeOffset = offset - } - - get active() { - return this.currentType === 'ass' - } - - get visible() { - if (!this.libass) - return false - - return this.libass.canvasParent.style.display !== 'none' - } - - set visible(visible) { - this.art.emit('artplayerPluginLibass:visible', visible) - - this.#setVttVisible(!this.active) - - if (this.libass.canvasParent) { - this.libass.canvasParent.style.display = visible ? 'block' : 'none' - - if (visible) - this.libass.resize() - } - } - - get timeOffset() { - return this.libass.timeOffset - } - - set timeOffset(offset) { - this.art.emit('artplayerPluginLibass:timeOffset', offset) - this.libass.timeOffset = offset - } - - show() { - this.visible = true - } - - hide() { - this.visible = false - } - - destroy() { - this.art.emit('artplayerPluginLibass:destroy') - - this.#removeEventListeners() - - this.libass.dispose() - URL.revokeObjectURL(this.workerScriptUrl) - this.libass = null - } - - async #createLibass(option = {}) { - if (!option.fallbackFont) { - return this.utils.errorHandle(option.fallbackFont, 'artplayerPluginLibass: fallbackFont is required') - } - - if (!option.workerUrl) { - option.workerUrl - = 'https://cdnjs.cloudflare.com/ajax/libs/libass-wasm/4.1.0/js/subtitles-octopus-worker.js' - } - - if (option.availableFonts) { - option.availableFonts = Object.entries(option.availableFonts).reduce((acc, [key, value]) => { - acc[key] = this.#toAbsoluteUrl(value) - return acc - }, {}) - } - - this.libass = new SubtitlesOctopus({ - subContent: defaultAssSubtitle, - video: this.$video, - ...option, - workerUrl: await this.#loadWorker(option), - fallbackFont: this.#toAbsoluteUrl(option.fallbackFont), - fonts: option.fonts?.map(font => this.#toAbsoluteUrl(font)), - }) - - this.libass.canvasParent.className = 'artplayer-plugin-libass' - this.libass.canvasParent.style.cssText = ` - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; - user-select: none; - pointer-events: none; - z-index: 20;` - } - - #addEventListeners() { - this.switchHandler = this.switch.bind(this) - this.visibleHandler = this.setVisibility.bind(this) - this.offsetHandler = this.setOffset.bind(this) - - this.art.on('subtitle', this.visibleHandler) - this.art.on('subtitleLoad', this.switchHandler) - this.art.on('subtitleOffset', this.offsetHandler) - - this.art.once('destroy', this.destroy.bind(this)) - } - - #removeEventListeners() { - this.art.off('subtitle', this.visibleHandler) - this.art.off('subtitleLoad', this.switchHandler) - this.art.off('subtitleOffset', this.offsetHandler) - } - - #setVttVisible(visible) { - this.$webvtt.style.visibility = visible ? 'visible' : 'hidden' - } - - #toAbsoluteUrl(url) { - if (this.#isAbsoluteUrl(url)) - return url - - // handle absolute URL when the `Worker` of `BLOB` type loading network resources - return new URL(url, document.baseURI).toString() - } - - #isAbsoluteUrl(url) { - return /^https?:\/\//.test(url) - } - - #loadWorker({ workerUrl, wasmUrl }) { - return new Promise((resolve) => { - fetch(workerUrl) - .then(res => res.text()) - .then((text) => { - let workerScriptContent = text - - workerScriptContent = workerScriptContent.replace( - /wasmBinaryFile\s*=\s*"(subtitles-octopus-worker\.wasm)"/g, - (_match, wasm) => { - if (!wasmUrl) { - wasmUrl = new URL(wasm, workerUrl).toString() - } - else { - wasmUrl = this.#toAbsoluteUrl(wasmUrl) - } - - return `wasmBinaryFile = "${wasmUrl}"` - }, - ) - - const workerBlob = new Blob([workerScriptContent], { type: 'text/javascript' }) - resolve(URL.createObjectURL(workerBlob)) - }) - }) - } - - #checkWebAssemblySupport() { - let supportsWebAssembly = false - try { - if (typeof WebAssembly === 'object' && typeof WebAssembly.instantiate === 'function') { - const module = new WebAssembly.Module(Uint8Array.of(0x0, 0x61, 0x73, 0x6D, 0x01, 0x00, 0x00, 0x00)) - if (module instanceof WebAssembly.Module) - supportsWebAssembly = new WebAssembly.Instance(module) instanceof WebAssembly.Instance - } - } - catch (error) { - console.error('WebAssembly is not supported in this browser.', error) - supportsWebAssembly = false - } - - this.utils.errorHandle(supportsWebAssembly, 'Browser does not support WebAssembly') - } -} diff --git a/packages/artplayer-plugin-libass/src/index.js b/packages/artplayer-plugin-libass/src/index.js deleted file mode 100644 index 878dd7cf5..000000000 --- a/packages/artplayer-plugin-libass/src/index.js +++ /dev/null @@ -1,21 +0,0 @@ -import LibassAdapter from './adapter' - -export default function artplayerPluginLibass(option) { - return (art) => { - const adapter = new LibassAdapter(art, option) - return { - name: 'artplayerPluginLibass', - libass: adapter.libass, - visible: adapter.visible, - init: adapter.init.bind(adapter), - switch: adapter.switch.bind(adapter), - show: adapter.show.bind(adapter), - hide: adapter.hide.bind(adapter), - destroy: adapter.destroy.bind(adapter), - } - } -} - -if (typeof window !== 'undefined') { - window.artplayerPluginLibass = artplayerPluginLibass -} diff --git a/packages/artplayer-plugin-libass/types/artplayer-plugin-libass.d.ts b/packages/artplayer-plugin-libass/types/artplayer-plugin-libass.d.ts deleted file mode 100644 index d6e24de1a..000000000 --- a/packages/artplayer-plugin-libass/types/artplayer-plugin-libass.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -import type SubtitlesOctopus from '@hrgui/libass-wasm-ts' -import type Artplayer from 'artplayer' -import type { Options } from 'libass-wasm' - -declare const artplayerPluginAss: (options: Options) => (art: Artplayer) => { - name: 'artplayerPluginLibass' - libass: SubtitlesOctopus - visible: boolean - init: () => void - switch: (url: string) => void - show: () => void - hide: () => void - destroy: () => void -} - -export default artplayerPluginAss diff --git a/packages/artplayer-vitepress/docs/.vitepress/config.js b/packages/artplayer-vitepress/docs/.vitepress/config.js index f9d6e5e6a..0805ddc92 100644 --- a/packages/artplayer-vitepress/docs/.vitepress/config.js +++ b/packages/artplayer-vitepress/docs/.vitepress/config.js @@ -72,7 +72,6 @@ const config = { { text: 'DASH 控制', link: 'https://artplayer.org/?libs=https://cdnjs.cloudflare.com/ajax/libs/dashjs/4.5.2/dash.all.min.js%0A./uncompiled/artplayer-plugin-dash-control/index.js&example=dash.control' }, { text: 'VTT 缩略图', link: 'https://artplayer.org/?libs=./uncompiled/artplayer-plugin-vtt-thumbnail/index.js&example=vtt.thumbnail' }, { text: '多重字幕', link: 'https://artplayer.org/?libs=./uncompiled/artplayer-plugin-multiple-subtitles/index.js&example=multiple.subtitles' }, - { text: 'ASS 字幕 - JSSO', link: 'https://artplayer.org/?libs=./uncompiled/artplayer-plugin-libass/index.js&example=libass' }, { text: 'ASS 字幕 - JASSUB', link: 'https://artplayer.org/?libs=./uncompiled/artplayer-plugin-jassub/index.js&example=jassub' }, { text: 'Chromecast', link: 'https://artplayer.org/?libs=./uncompiled/artplayer-plugin-chromecast/index.js&example=chromecast' }, { text: 'VAST 广告', link: 'https://artplayer.org/?libs=./uncompiled/artplayer-plugin-vast/index.js&example=vast' }, @@ -144,7 +143,6 @@ const config = { { text: 'DASH Control', link: 'https://artplayer.org/?libs=https://cdnjs.cloudflare.com/ajax/libs/dashjs/4.5.2/dash.all.min.js%0A./uncompiled/artplayer-plugin-dash-control/index.js&example=dash.control' }, { text: 'VTT Thumbnail', link: 'https://artplayer.org/?libs=./uncompiled/artplayer-plugin-vtt-thumbnail/index.js&example=vtt.thumbnail' }, { text: 'Multiple Subtitles', link: 'https://artplayer.org/?libs=./uncompiled/artplayer-plugin-multiple-subtitles/index.js&example=multiple.subtitles' }, - { text: 'ASS Subtitle - JSSO', link: 'https://artplayer.org/?libs=./uncompiled/artplayer-plugin-libass/index.js&example=libass' }, { text: 'ASS Subtitle - JASSUB', link: 'https://artplayer.org/?libs=./uncompiled/artplayer-plugin-jassub/index.js&example=jassub' }, { text: 'Chromecast', link: 'https://artplayer.org/?libs=./uncompiled/artplayer-plugin-chromecast/index.js&example=chromecast' }, { text: 'VAST', link: 'https://artplayer.org/?libs=./uncompiled/artplayer-plugin-vast/index.js&example=vast' },