mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-18 02:21:20 -08:00
feat: add artplayer-plugin-jassub for enhanced video subtitle rendering
This commit is contained in:
1 parent
0d032f685b
commit
b69d020c5a
47 files changed
+110
-61
No files matched your search
@@ -0,0 +1,8 @@
|
||||
|
||||
/*!
|
||||
* artplayer-plugin-jassub.js v1.0.0
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2026 Harvey Zack
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,s,i,a,r,n,o){var h="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},d="function"==typeof h[i]&&h[i],l=d.i||{},c=d.cache||{},u="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function m(t,s){if(!c[t]){if(!e[t]){if(a[t])return a[t];var r="function"==typeof h[i]&&h[i];if(!s&&r)return r(t,!0);if(d)return d(t,!0);if(u&&"string"==typeof t)return u(t);var n=Error("Cannot find module '"+t+"'");throw n.code="MODULE_NOT_FOUND",n}l.resolve=function(s){var i=e[t][1][s];return null!=i?i:s},l.cache={};var o=c[t]=new m.Module(t);e[t][0].call(o.exports,l,o,o.exports,h)}return c[t].exports;function l(e){var t=l.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var s={__esModule:!0};return t.forEach(function(e){var t=e[0],i=e[1],a=e[2]||e[0],r=m(i);"*"===t?Object.keys(r).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(s,e)||Object.defineProperty(s,e,{enumerable:!0,get:function(){return r[e]}})}):"*"===a?Object.defineProperty(s,t,{enumerable:!0,value:r}):Object.defineProperty(s,t,{enumerable:!0,get:function(){return"default"===a?r.__esModule?r.default:r:r[a]}})}),s}return m(t)}}m.isParcelRequire=!0,m.Module=function(e){this.id=e,this.bundle=m,this.require=u,this.exports={}},m.modules=e,m.cache=c,m.parent=d,m.distDir=void 0,m.publicUrl=void 0,m.devServer=void 0,m.i=l,m.register=function(t,s){e[t]=[function(e,t){t.exports=s},{}]},Object.defineProperty(m,"root",{get:function(){return h[i]}}),h[i]=m;for(var _=0;_<t.length;_++)m(t[_]);if(s){var v=m(s);"object"==typeof exports&&"u">typeof module?module.exports=v:"function"==typeof define&&define.amd&&define(function(){return v})}}({g5KxT:[function(e,t,s,i){var a=e("@parcel/transformer-js/src/esmodule-helpers.js");a.defineInteropFlag(s),a.export(s,"default",()=>o);var r=e("./jassub.es.js"),n=a.interopDefault(r);function o(e){return t=>{let s=new(0,n.default)({video:t.video,...e});return s._canvasParent.style.zIndex=20,t.on("destroy",()=>{s.destroy()}),{name:"artplayerPluginJassub",instance:s}}}"u">typeof window&&(window.artplayerPluginJassub=o)},{"./jassub.es.js":"8Qqq1","@parcel/transformer-js/src/esmodule-helpers.js":"6ykb1"}],"8Qqq1":[function(e,t,s,i){var a=e("@parcel/transformer-js/src/esmodule-helpers.js");a.defineInteropFlag(s),a.export(s,"default",()=>o),"u">typeof HTMLVideoElement&&!("requestVideoFrameCallback"in HTMLVideoElement.prototype)&&"getVideoPlaybackQuality"in HTMLVideoElement.prototype&&(HTMLVideoElement.prototype._rvfcpolyfillmap={},HTMLVideoElement.prototype.requestVideoFrameCallback=function(e){let t=performance.now(),s=this.getVideoPlaybackQuality(),i=this.mozPresentedFrames||this.mozPaintedFrames||s.totalVideoFrames-s.droppedVideoFrames,a=(r,n)=>{let o=this.getVideoPlaybackQuality(),h=this.mozPresentedFrames||this.mozPaintedFrames||o.totalVideoFrames-o.droppedVideoFrames;if(h>i){let i=this.mozFrameDelay||o.totalFrameDelay-s.totalFrameDelay||0,a=n-r;e(n,{presentationTime:n+1e3*i,expectedDisplayTime:n+a,width:this.videoWidth,height:this.videoHeight,mediaTime:Math.max(0,this.currentTime||0)+a/1e3,presentedFrames:h,processingDuration:i}),delete this._rvfcpolyfillmap[t]}else this._rvfcpolyfillmap[t]=requestAnimationFrame(e=>a(n,e))};return this._rvfcpolyfillmap[t]=requestAnimationFrame(e=>a(t,e)),t},HTMLVideoElement.prototype.cancelVideoFrameCallback=function(e){cancelAnimationFrame(this._rvfcpolyfillmap[e]),delete this._rvfcpolyfillmap[e]});let r={bt709:"BT709",bt470bg:"BT601",smpte170m:"BT601"},n={BT601:{BT709:"1.0863 -0.0723 -0.014 0 0 0.0965 0.8451 0.0584 0 0 -0.0141 -0.0277 1.0418"},BT709:{BT601:"0.9137 0.0784 0.0079 0 0 -0.1049 1.1722 -0.0671 0 0 0.0096 0.0322 0.9582"},FCC:{BT709:"1.0873 -0.0736 -0.0137 0 0 0.0974 0.8494 0.0531 0 0 -0.0127 -0.0251 1.0378",BT601:"1.001 -0.0008 -0.0002 0 0 0.0009 1.005 -0.006 0 0 0.0013 0.0027 0.996"},SMPTE240M:{BT709:"0.9993 0.0006 0.0001 0 0 -0.0004 0.9812 0.0192 0 0 -0.0034 -0.0114 1.0148",BT601:"0.913 0.0774 0.0096 0 0 -0.1051 1.1508 -0.0456 0 0 0.0063 0.0207 0.973"}};class o extends EventTarget{constructor(e){if(super(),!globalThis.Worker)throw this.destroy("Worker not supported");if(!e)throw this.destroy("No options provided");this._loaded=new Promise(e=>{this._init=e});const t=o._test();if(this._onDemandRender="requestVideoFrameCallback"in HTMLVideoElement.prototype&&(e.onDemandRender??!0),this._offscreenRender="transferControlToOffscreen"in HTMLCanvasElement.prototype&&!e.canvas&&(e.offscreenRender??!0),this.timeOffset=e.timeOffset||0,this._video=e.video,this._videoHeight=0,this._videoWidth=0,this._videoColorSpace=null,this._canvas=e.canvas,this._video&&!this._canvas)this._canvasParent=document.createElement("div"),this._canvasParent.className="JASSUB",this._canvasParent.style.position="relative",this._canvas=this._createCanvas(),this._video.insertAdjacentElement("afterend",this._canvasParent);else if(!this._canvas)throw this.destroy("Don't know where to render: you shoulLine truncated
|
||||
@@ -0,0 +1,8 @@
|
||||
|
||||
/*!
|
||||
* artplayer-plugin-jassub.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,i,a,s,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(i[t])return i[t];var a="function"==typeof c[n]&&c[n];if(!r&&a)return a(t,!0);if(l)return l(t,!0);if(f&&"string"==typeof t)return f(t);var s=Error("Cannot find module '"+t+"'");throw s.code="MODULE_NOT_FOUND",s}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],i=e[2]||e[0],a=h(n);"*"===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]}})}):"*"===i?Object.defineProperty(r,t,{enumerable:!0,value:a}):Object.defineProperty(r,t,{enumerable:!0,get:function(){return"default"===i?a.__esModule?a.default:a:a[i]}})}),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 _=0;_<t.length;_++)h(t[_]);if(r){var v=h(r);"object"==typeof exports&&"u">typeof module?module.exports=v:"function"==typeof define&&define.amd&&define(function(){return v})}}({k1Tni:[function(e,t,r,n){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(r),i.export(r,"default",function(){return c});var a=e("@swc/helpers/cjs/_object_spread.cjs"),s=e("./jassub.es.js"),o=i.interopDefault(s);function c(e){return function(t){var r=new(0,o.default)((0,a._)({video:t.video},e));return r._canvasParent.style.zIndex=20,t.on("destroy",function(){r.destroy()}),{name:"artplayerPluginJassub",instance:r}}}"u">typeof window&&(window.artplayerPluginJassub=c)},{"@swc/helpers/cjs/_object_spread.cjs":"kyoEj","./jassub.es.js":"5H1mY","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],kyoEj:[function(e,t,r,n){"use strict";var i=e("9f9b8a24218ee51e");r._=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){i._(e,t,r[t])})}return e}},{"9f9b8a24218ee51e":"ltU3W"}],ltU3W:[function(e,t,r,n){"use strict";r._=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}},{}],"5H1mY":[function(e,t,r,n){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(r),i.export(r,"default",function(){return b});var a=e("@swc/helpers/cjs/_async_to_generator.cjs"),s=e("@swc/helpers/cjs/_call_super.cjs"),o=e("@swc/helpers/cjs/_class_call_check.cjs"),c=e("@swc/helpers/cjs/_create_class.cjs"),l=e("@swc/helpers/cjs/_define_property.cjs"),u=e("@swc/helpers/cjs/_inherits.cjs"),d=e("@swc/helpers/cjs/_object_spread.cjs"),f=e("@swc/helpers/cjs/_sliced_to_array.cjs"),h=e("@swc/helpers/cjs/_to_consumable_array.cjs"),_=e("@swc/helpers/cjs/_type_of.cjs"),v=e("@swc/helpers/cjs/_wrap_native_super.cjs"),p=e("@swc/helpers/cjs/_ts_generator.cjs");("u"<typeof HTMLVideoElement?"undefined":(0,_._)(HTMLVideoElement))<"u"&&!("requestVideoFrameCallback"in HTMLVideoElement.prototype)&&"getVideoPlaybackQuality"in HTMLVideoElement.prototype&&(HTMLVideoElement.prototype._rvfcpolyfillmap={},HTMLVideoElement.prototype.requestVideoFrameCallback=function(e){var t=this,r=performance.now(),n=this.getVideoPlaybackQuality(),i=this.mozPresentedFrames||this.mozPaintedFrames||n.totalVideoFrames-n.droppedVideoFrames,a=function(s,o){var c=t.getVideoPlaybackQuality(),l=t.mozPresentedFrames||t.mozPaintedFrames||c.totalVideoFrames-c.droppedVideoFrames;if(l>i){var u=t.mozFrameDelay||c.totalFrameDelay-n.totalFrameDelay||0,d=o-s;e(o,{presentationTime:o+1e3*u,expectedDisplayTime:o+d,width:t.videoWidth,height:t.videoHeight,mediaTime:Math.max(0,t.currentTime||0)+d/1e3,presentedFrames:l,processingDuration:u}),delete t._rvfcpolyfillmap[r]}else t._rvfcpolyfillmap[r]=requestAnimationFrame(function(e){return a(o,e)})};return this._rvfcpolyfillmap[r]=requestAnimationFrame(function(e){return a(r,e)}),r},HTMLVideoElement.prototype.cancelVideoFrameCallback=function(e){cancelAnimationFrame(this._rvfcpolyfillmap[e]),delete this._rvfcpolyfillmap[e]});var m={bt709:"BT709",bt470bg:"BT601",smpte170m:"BT601"},y={BT601:{BT709:"1.0863 -0.0723 -0.014 0 0 0.0965 0.8451 0.0584 0 0 -0.0141 -0.0277 1.0418"},BT709:{BT601:"0.9137 0.0784 0.0079Line truncated
|
||||
@@ -0,0 +1,8 @@
|
||||
|
||||
/*!
|
||||
* artplayer-plugin-jassub.js v1.0.0
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2026 Harvey Zack
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,s,i,a,r,n,o){var h="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},d="function"==typeof h[i]&&h[i],l=d.i||{},c=d.cache||{},u="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function m(t,s){if(!c[t]){if(!e[t]){if(a[t])return a[t];var r="function"==typeof h[i]&&h[i];if(!s&&r)return r(t,!0);if(d)return d(t,!0);if(u&&"string"==typeof t)return u(t);var n=Error("Cannot find module '"+t+"'");throw n.code="MODULE_NOT_FOUND",n}l.resolve=function(s){var i=e[t][1][s];return null!=i?i:s},l.cache={};var o=c[t]=new m.Module(t);e[t][0].call(o.exports,l,o,o.exports,h)}return c[t].exports;function l(e){var t=l.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var s={__esModule:!0};return t.forEach(function(e){var t=e[0],i=e[1],a=e[2]||e[0],r=m(i);"*"===t?Object.keys(r).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(s,e)||Object.defineProperty(s,e,{enumerable:!0,get:function(){return r[e]}})}):"*"===a?Object.defineProperty(s,t,{enumerable:!0,value:r}):Object.defineProperty(s,t,{enumerable:!0,get:function(){return"default"===a?r.__esModule?r.default:r:r[a]}})}),s}return m(t)}}m.isParcelRequire=!0,m.Module=function(e){this.id=e,this.bundle=m,this.require=u,this.exports={}},m.modules=e,m.cache=c,m.parent=d,m.distDir=void 0,m.publicUrl=void 0,m.devServer=void 0,m.i=l,m.register=function(t,s){e[t]=[function(e,t){t.exports=s},{}]},Object.defineProperty(m,"root",{get:function(){return h[i]}}),h[i]=m;for(var _=0;_<t.length;_++)m(t[_]);if(s){var v=m(s);"object"==typeof exports&&"u">typeof module?module.exports=v:"function"==typeof define&&define.amd&&define(function(){return v})}}({bm4Y0:[function(e,t,s,i){var a=e("@parcel/transformer-js/src/esmodule-helpers.js");a.defineInteropFlag(s),a.export(s,"default",()=>o);var r=e("./jassub.es.js"),n=a.interopDefault(r);function o(e){return t=>{let s=new(0,n.default)({video:t.video,...e});return s._canvasParent.style.zIndex=20,t.on("destroy",()=>{s.destroy()}),{name:"artplayerPluginJassub",instance:s}}}"u">typeof window&&(window.artplayerPluginJassub=o)},{"./jassub.es.js":"kL36e","@parcel/transformer-js/src/esmodule-helpers.js":"loqXi"}],kL36e:[function(e,t,s,i){var a=e("@parcel/transformer-js/src/esmodule-helpers.js");a.defineInteropFlag(s),a.export(s,"default",()=>o),"u">typeof HTMLVideoElement&&!("requestVideoFrameCallback"in HTMLVideoElement.prototype)&&"getVideoPlaybackQuality"in HTMLVideoElement.prototype&&(HTMLVideoElement.prototype._rvfcpolyfillmap={},HTMLVideoElement.prototype.requestVideoFrameCallback=function(e){let t=performance.now(),s=this.getVideoPlaybackQuality(),i=this.mozPresentedFrames||this.mozPaintedFrames||s.totalVideoFrames-s.droppedVideoFrames,a=(r,n)=>{let o=this.getVideoPlaybackQuality(),h=this.mozPresentedFrames||this.mozPaintedFrames||o.totalVideoFrames-o.droppedVideoFrames;if(h>i){let i=this.mozFrameDelay||o.totalFrameDelay-s.totalFrameDelay||0,a=n-r;e(n,{presentationTime:n+1e3*i,expectedDisplayTime:n+a,width:this.videoWidth,height:this.videoHeight,mediaTime:Math.max(0,this.currentTime||0)+a/1e3,presentedFrames:h,processingDuration:i}),delete this._rvfcpolyfillmap[t]}else this._rvfcpolyfillmap[t]=requestAnimationFrame(e=>a(n,e))};return this._rvfcpolyfillmap[t]=requestAnimationFrame(e=>a(t,e)),t},HTMLVideoElement.prototype.cancelVideoFrameCallback=function(e){cancelAnimationFrame(this._rvfcpolyfillmap[e]),delete this._rvfcpolyfillmap[e]});let r={bt709:"BT709",bt470bg:"BT601",smpte170m:"BT601"},n={BT601:{BT709:"1.0863 -0.0723 -0.014 0 0 0.0965 0.8451 0.0584 0 0 -0.0141 -0.0277 1.0418"},BT709:{BT601:"0.9137 0.0784 0.0079 0 0 -0.1049 1.1722 -0.0671 0 0 0.0096 0.0322 0.9582"},FCC:{BT709:"1.0873 -0.0736 -0.0137 0 0 0.0974 0.8494 0.0531 0 0 -0.0127 -0.0251 1.0378",BT601:"1.001 -0.0008 -0.0002 0 0 0.0009 1.005 -0.006 0 0 0.0013 0.0027 0.996"},SMPTE240M:{BT709:"0.9993 0.0006 0.0001 0 0 -0.0004 0.9812 0.0192 0 0 -0.0034 -0.0114 1.0148",BT601:"0.913 0.0774 0.0096 0 0 -0.1051 1.1508 -0.0456 0 0 0.0063 0.0207 0.973"}};class o extends EventTarget{constructor(e){if(super(),!globalThis.Worker)throw this.destroy("Worker not supported");if(!e)throw this.destroy("No options provided");this._loaded=new Promise(e=>{this._init=e});let t=o._test();if(this._onDemandRender="requestVideoFrameCallback"in HTMLVideoElement.prototype&&(e.onDemandRender??!0),this._offscreenRender="transferControlToOffscreen"in HTMLCanvasElement.prototype&&!e.canvas&&(e.offscreenRender??!0),this.timeOffset=e.timeOffset||0,this._video=e.video,this._videoHeight=0,this._videoWidth=0,this._videoColorSpace=null,this._canvas=e.canvas,this._video&&!this._canvas)this._canvasParent=document.createElement("div"),this._canvasParent.className="JASSUB",this._canvasParent.style.position="relative",this._canvas=this._createCanvas(),this._video.insertAdjacentElement("afterend",this._canvasParent);else if(!this._canvas)throw this.destroy("Don't know where to render: you should giLine truncated
|
||||
Reference in new issue
Block a user