mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-25 08:01:20 -08:00
Merge branch 'pr/654'
This commit is contained in:
commit
4360c1e695
17 files changed
+2450
No files matched your search
@@ -0,0 +1,10 @@
|
||||
node_modules
|
||||
.DS_Store
|
||||
yarn.lock
|
||||
package-lock.json
|
||||
test
|
||||
coverage
|
||||
.nyc_output
|
||||
.parcel-cache
|
||||
.cache
|
||||
docs
|
||||
@@ -0,0 +1 @@
|
||||
package-lock=false
|
||||
@@ -0,0 +1,15 @@
|
||||
# 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)
|
||||
|
||||
## Usage
|
||||
|
||||
[https://artplayer.org/document/en/Plugins/libass](https://artplayer.org/document/en/Plugins/libass)
|
||||
|
||||
## License
|
||||
|
||||
MIT © journey-ad
|
||||
@@ -0,0 +1,7 @@
|
||||
/*!
|
||||
* artplayer-plugin-libass.js v1.0.0
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2023 Harvey Zack
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,s,r,n){var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},i="function"==typeof a[r]&&a[r],o=i.cache||{},l="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function c(t,s){if(!o[t]){if(!e[t]){var n="function"==typeof a[r]&&a[r];if(!s&&n)return n(t,!0);if(i)return i(t,!0);if(l&&"string"==typeof t)return l(t);var d=new Error("Cannot find module '"+t+"'");throw d.code="MODULE_NOT_FOUND",d}v.resolve=function(s){var r=e[t][1][s];return null!=r?r:s},v.cache={};var u=o[t]=new c.Module(t);e[t][0].call(u.exports,v,u,u.exports,this)}return o[t].exports;function v(e){var t=v.resolve(e);return!1===t?{}:c(t)}}c.isParcelRequire=!0,c.Module=function(e){this.id=e,this.bundle=c,this.exports={}},c.modules=e,c.cache=o,c.parent=i,c.register=function(t,s){e[t]=[function(e,t){t.exports=s},{}]},Object.defineProperty(c,"root",{get:function(){return a[r]}}),a[r]=c;for(var d=0;d<t.length;d++)c(t[d]);if(s){var u=c(s);"object"==typeof exports&&"undefined"!=typeof module?module.exports=u:"function"==typeof define&&define.amd&&define((function(){return u}))}}({abjMI:[function(e,t,s){var r=e("@parcel/transformer-js/src/esmodule-helpers.js");r.defineInteropFlag(s);var n=e("./adapter"),a=r.interopDefault(n);function i(e){return t=>{!function(e){const{version:t,utils:{errorHandle:s}}=e.constructor,r=t.split(".").map(Number);s(r[0]+r[1]/100>=5,`Artplayer.js@${t} is not compatible the artplayerPluginLibass@${i.version}. Please update it to version Artplayer.js@5.x.x`)}(t);let s=new(0,a.default)(t,e);return{name:"artplayerPluginLibass",libass:s.libass,visible:s.visible,init:s.init.bind(s),switch:s.switch.bind(s),show:s.show.bind(s),hide:s.hide.bind(s),destroy:s.destroy.bind(s)}}}s.default=i,i.env="production",i.version="1.0.0",i.build="2023-11-14 12:36:09","undefined"!=typeof window&&(window.artplayerPluginLibass=i)},{"./adapter":"cjgNP","@parcel/transformer-js/src/esmodule-helpers.js":"4ajKp"}],cjgNP:[function(e,t,s){var r=e("@parcel/transformer-js/src/esmodule-helpers.js");r.defineInteropFlag(s);var n=e("libass-wasm"),a=r.interopDefault(n);s.default=class{constructor(e,t){const{constructor:s,template:r}=e;this.art=e,this.$video=r.$video,this.$webvtt=r.$subtitle,this.utils=s.utils,this.libass=null,e.once("ready",this.init.bind(this,t))}async init(e){this.#e(),await this.#t(e),this.#s(),this.art.emit("artplayerPluginLibass:init",this);const 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.#r(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,s])=>(e[t]=this.#r(s),e)),{})),this.libass=new(0,a.default)({subContent:"[Script Info]\nScriptType: v4.00+",video:this.$video,...e,workerUrl:await this.#i(e),fallbackFont:this.#r(e.fallbackFont),fonts:e.fonts?.map((e=>this.#r(e)))}),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;"}#s(){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":"hiddenLine truncated
|
||||
@@ -0,0 +1,7 @@
|
||||
/*!
|
||||
* artplayer-plugin-libass.js v1.0.0
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2023 Harvey Zack
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,r,n,s){var o="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},a="function"==typeof o[n]&&o[n],i=a.cache||{},c="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function l(t,r){if(!i[t]){if(!e[t]){var s="function"==typeof o[n]&&o[n];if(!r&&s)return s(t,!0);if(a)return a(t,!0);if(c&&"string"==typeof t)return c(t);var u=new Error("Cannot find module '"+t+"'");throw u.code="MODULE_NOT_FOUND",u}p.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},p.cache={};var f=i[t]=new l.Module(t);e[t][0].call(f.exports,p,f,f.exports,this)}return i[t].exports;function p(e){var t=p.resolve(e);return!1===t?{}:l(t)}}l.isParcelRequire=!0,l.Module=function(e){this.id=e,this.bundle=l,this.exports={}},l.modules=e,l.cache=i,l.parent=a,l.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(l,"root",{get:function(){return o[n]}}),o[n]=l;for(var u=0;u<t.length;u++)l(t[u]);if(r){var f=l(r);"object"==typeof exports&&"undefined"!=typeof module?module.exports=f:"function"==typeof define&&define.amd&&define((function(){return f}))}}({"7Csdv":[function(e,t,r){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r);var s=e("./adapter"),o=n.interopDefault(s);function a(e){return function(t){!function(e){var t=e.constructor,r=t.version,n=t.utils.errorHandle,s=r.split(".").map(Number);n(s[0]+s[1]/100>=5,"Artplayer.js@".concat(r," is not compatible the artplayerPluginLibass@").concat(a.version,". Please update it to version Artplayer.js@5.x.x"))}(t);var r=new(0,o.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)}}}r.default=a,a.env="production",a.version="1.0.0",a.build="2023-11-14 12:36:10","undefined"!=typeof window&&(window.artplayerPluginLibass=a)},{"./adapter":"9NihZ","@parcel/transformer-js/src/esmodule-helpers.js":"38Wbh"}],"9NihZ":[function(e,t,r){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r),n.export(r,"default",(function(){return I}));var s=e("@swc/helpers/src/_async_to_generator.mjs"),o=n.interopDefault(s),a=e("@swc/helpers/src/_class_call_check.mjs"),i=n.interopDefault(a),c=e("@swc/helpers/src/_class_private_method_get.mjs"),l=n.interopDefault(c),u=e("@swc/helpers/src/_class_private_method_init.mjs"),f=n.interopDefault(u),p=e("@swc/helpers/src/_create_class.mjs"),d=n.interopDefault(p),h=e("@swc/helpers/src/_object_spread.mjs"),m=n.interopDefault(h),v=e("@swc/helpers/src/_object_spread_props.mjs"),b=n.interopDefault(v),y=e("@swc/helpers/src/_sliced_to_array.mjs"),_=n.interopDefault(y),g=e("@swc/helpers/src/_ts_generator.mjs"),w=n.interopDefault(g),j=e("libass-wasm"),k=n.interopDefault(j),x="[Script Info]\nScriptType: v4.00+",O=new WeakSet,E=new WeakSet,P=new WeakSet,T=new WeakSet,F=new WeakSet,L=new WeakSet,W=new WeakSet,S=new WeakSet,I=function(){"use strict";function e(t,r){(0,i.default)(this,e),(0,f.default)(this,O),(0,f.default)(this,E),(0,f.default)(this,P),(0,f.default)(this,T),(0,f.default)(this,F),(0,f.default)(this,L),(0,f.default)(this,W),(0,f.default)(this,S);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,d.default)(e,[{key:"init",value:function(e){var t=this;return(0,o.default)((function(){var r,n,s,o;return(0,w.default)(this,(function(a){switch(a.label){case 0:return(0,l.default)(t,S,B).call(t),[4,(0,l.default)(t,O,C).call(t,e)];case 1:return a.sent(),(0,l.default)(t,E,R).call(t),t.art.emit("artplayerPluginLibass:init",t),(o=null===(r=t.art)||void 0===r||null===(n=r.option)||void 0===n||null===(s=n.subtitle)||void 0===s?void 0:s.url)&&"ass"===t.utils.getExt(o)&&t.switch(o),[2]}}))}))()}},{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,l.default)(this,F,U).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,l.default)(this,T,D).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:fuLine truncated
|
||||
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"license": "MIT",
|
||||
"version": "1.0.0",
|
||||
"name": "artplayer-plugin-libass",
|
||||
"types": "types/artplayer-plugin-libass.d.ts",
|
||||
"description": "A powerful ass subtitle renderer `libass-wasm` for ArtPlayer",
|
||||
"main": "dist/artplayer-plugin-libass.js",
|
||||
"legacy": "dist/artplayer-plugin-libass.legacy.js",
|
||||
"author": "Harvey Zack <laozhaochaguan@gmail.com>",
|
||||
"browserslist": "last 1 Chrome version",
|
||||
"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"
|
||||
],
|
||||
"dependencies": {
|
||||
"libass-wasm": "^4.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@hrgui/libass-wasm-ts": "^1.0.3"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,222 @@
|
||||
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 (e) {
|
||||
//
|
||||
}
|
||||
|
||||
this.utils.errorHandle(supportsWebAssembly, "Browser does not support WebAssembly")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
import LibassAdapter from './adapter'
|
||||
|
||||
function checkVersion(art) {
|
||||
const {
|
||||
version,
|
||||
utils: { errorHandle },
|
||||
} = art.constructor
|
||||
const arr = version.split('.').map(Number)
|
||||
const major = arr[0]
|
||||
const minor = arr[1] / 100
|
||||
errorHandle(
|
||||
major + minor >= 5,
|
||||
`Artplayer.js@${version} is not compatible the artplayerPluginLibass@${artplayerPluginLibass.version}. Please update it to version Artplayer.js@5.x.x`,
|
||||
)
|
||||
}
|
||||
|
||||
export default function artplayerPluginLibass(option) {
|
||||
return (art) => {
|
||||
checkVersion(art)
|
||||
|
||||
let 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),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
artplayerPluginLibass.env = process.env.NODE_ENV
|
||||
artplayerPluginLibass.version = process.env.APP_VER
|
||||
artplayerPluginLibass.build = process.env.BUILD_DATE
|
||||
|
||||
if (typeof window !== 'undefined') {
|
||||
window['artplayerPluginLibass'] = artplayerPluginLibass
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import type Artplayer from 'artplayer';
|
||||
import type SubtitlesOctopus from "@hrgui/libass-wasm-ts"
|
||||
import { type Options } from "libass-wasm"
|
||||
|
||||
export = artplayerPluginAss
|
||||
export as namespace artplayerPluginAss
|
||||
|
||||
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;
|
||||
};
|
||||
Reference in new issue
Block a user