mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-23 05:41:20 -08:00
Add fullscreenError event to Artplayer
This commit is contained in:
1 parent
7f295a5c84
commit
fb6179e2be
130 files changed
+1941
-1843
No files matched your search
@@ -1,7 +1,7 @@
|
||||
/*!
|
||||
* artplayer-plugin-multiple-subtitles.js v1.0.0
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2023 Harvey Zack
|
||||
* (c) 2017-2024 Harvey Zack
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,n,i,r){var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},s="function"==typeof a[i]&&a[i],o=s.cache||{},l="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function u(t,n){if(!o[t]){if(!e[t]){var r="function"==typeof a[i]&&a[i];if(!n&&r)return r(t,!0);if(s)return s(t,!0);if(l&&"string"==typeof t)return l(t);var f=new Error("Cannot find module '"+t+"'");throw f.code="MODULE_NOT_FOUND",f}d.resolve=function(n){var i=e[t][1][n];return null!=i?i:n},d.cache={};var c=o[t]=new u.Module(t);e[t][0].call(c.exports,d,c,c.exports,this)}return o[t].exports;function d(e){var t=d.resolve(e);return!1===t?{}:u(t)}}u.isParcelRequire=!0,u.Module=function(e){this.id=e,this.bundle=u,this.exports={}},u.modules=e,u.cache=o,u.parent=s,u.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(u,"root",{get:function(){return a[i]}}),a[i]=u;for(var f=0;f<t.length;f++)u(t[f]);if(n){var c=u(n);"object"==typeof exports&&"undefined"!=typeof module?module.exports=c:"function"==typeof define&&define.amd&&define((function(){return c}))}}({"4Kbf6":[function(e,t,n){e("@parcel/transformer-js/src/esmodule-helpers.js").defineInteropFlag(n);var i=e("./parser");function r({subtitles:e=[]}){return async t=>{const{unescape:n,getExt:r,srtToVtt:a,assToVtt:s}=t.constructor.utils,o=new(0,i.WebVTTParser),l=new(0,i.WebVTTSerializer),u=await Promise.all(e.map((e=>async function(e,{getExt:t,srtToVtt:n,assToVtt:i}){const r=await fetch(e.url),a=await r.arrayBuffer(),s=new TextDecoder(e.encoding||"utf-8").decode(a);switch(e.type||t(e.url)){case"srt":return n(s);case"ass":return i(s);case"vtt":return s;default:return""}}(e,{getExt:r,srtToVtt:a,assToVtt:s})))),f=u.map(((t,n)=>{const i=o.parse(t,"metadata");return i.url=e[n].url,i.name=e[n].name,i}));let c="";function d(e=[]){const r=function(e){const t=(new(0,i.WebVTTParser)).parse("","metadata");for(let n=0;n<e.length;n++){const i=e[n];if(!i.updated){i.updated=!0;for(let e=0;e<i.cues.length;e++){const t=i.cues[e];for(let e=0;e<t.tree.children.length;e++){const n=t.tree.children[e];n.value=`<div class="art-subtitle-${i.name}">${n.value}</div>`}}}if(0===t.cues.length)t.cues=[...i.cues];else for(let e=0;e<t.cues.length;e++){const n=t.cues[e].tree.children,r=i.cues[e]?.tree?.children;t.cues[e]={...t.cues[e],tree:{children:[...n,...r]}}}}return t}(e),a=l.serialize(r.cues);URL.revokeObjectURL(c);const s=URL.createObjectURL(new Blob([a],{type:"text/vtt"}));c=s,t.option.subtitle.escape=!1,t.subtitle.init({...t.option.subtitle,url:s,type:"vtt",onVttLoad:n})}return d(f),{name:"multipleSubtitles",tracks:(e=[])=>d(e.map((e=>f.find((t=>t.name===e))))),reset:()=>d(f)}}}n.default=r,"undefined"!=typeof window&&(window.artplayerPluginMultipleSubtitles=r)},{"./parser":"cU78l","@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],cU78l:[function(e,t,n){!function(){var e={direction:"horizontal",snapToLines:!0,linePosition:"auto",lineAlign:"start",textPosition:"auto",positionAlign:"auto",size:100,alignment:"center"},t=function(t){t||(t={"&":"&","<":"<",">":">","&lrm":"","&rlm":""," ":" "}),this.entities=t,this.parse=function(n,a){n=n.replace(/\0/g,"�");var s=Date.now(),o=0,l=n.split(/\r\n|\r|\n/),u=!1,f=[],c=[],d=[];function p(e,t){d.push({message:e,line:o+1,col:t})}var m=l[o],g=m.length,h="WEBVTT",v=0,b=6;for("\ufeff"===m[0]&&(v=1,b+=1),(g<b||m.indexOf(h)!==0+v||g>b&&" "!==m[b]&&"\t"!==m[b])&&p('No valid signature. (File needs to start with "WEBVTT".)'),o++;""!=l[o]&&null!=l[o];){if(p("No blank line after the signature."),-1!=l[o].indexOf("--\x3e")){u=!0;break}o++}for(;null!=l[o];){for(var T;!u&&""==l[o];)o++;if(!u&&null==l[o])break;T=Object.assign({},e,{id:"",startTime:0,endTime:0,pauseOnExit:!1,direction:"horizontal",snapToLines:!0,linePosition:"auto",lineAlign:"start",textPosition:"auto",positionAlign:"auto",size:100,alignment:"center",text:"",tree:null});var x=!0;if(-1==l[o].indexOf("--\x3e")){if(T.id=l[o],/^NOTE($|[ \t])/.test(T.id)){for(o++;""!=l[o]&&null!=l[o];)-1!=l[o].indexOf("--\x3e")&&p("Cannot have timestamp in a comment."),o++;continue}if(/^STYLE($|[ \t])/.test(T.id)){var y=[],w=!1;for(o++;""!=l[o]&&null!=l[o];)-1!=l[o].indexOf("--\x3e")&&(p("Cannot have timestamp in a style block."),w=!0),y.push(l[o]),o++;if(c.length){p("Style blocks cannot appear after the first cue.");continue}w||f.push(y.join("\n"));continue}if(""==l[++o]||null==l[o]){p("Cue identifier cannot be standalone.");continue}if(-1==l[o].indexOf("--\x3e")){x=!1,p("Cue identifier needs to be followed by timestamp.");continue}}u=!1;var O=new i(l[o],p),P=0;if(c.length>0&&(P=c[c.length-1].startTime),!x||O.parse(T,P)){for(o++;""!=l[o]&&null!=l[o];){if(-1!=l[o].indexOf("--\x3e")){p("Blank line missing before cue."),u=!0;break}""!=T.text&&(T.text+="\n"),T.text+=l[o],o++}var j=new r(T.text,p,a,t);T.tree=j.parse(T.startTime,T.endTime),c.push(T)}else for(T=null,o+Line truncated
|
||||
!function(e,t,n,i,r){var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},s="function"==typeof a[i]&&a[i],o=s.cache||{},l="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function u(t,n){if(!o[t]){if(!e[t]){var r="function"==typeof a[i]&&a[i];if(!n&&r)return r(t,!0);if(s)return s(t,!0);if(l&&"string"==typeof t)return l(t);var f=new Error("Cannot find module '"+t+"'");throw f.code="MODULE_NOT_FOUND",f}d.resolve=function(n){var i=e[t][1][n];return null!=i?i:n},d.cache={};var c=o[t]=new u.Module(t);e[t][0].call(c.exports,d,c,c.exports,this)}return o[t].exports;function d(e){var t=d.resolve(e);return!1===t?{}:u(t)}}u.isParcelRequire=!0,u.Module=function(e){this.id=e,this.bundle=u,this.exports={}},u.modules=e,u.cache=o,u.parent=s,u.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(u,"root",{get:function(){return a[i]}}),a[i]=u;for(var f=0;f<t.length;f++)u(t[f]);if(n){var c=u(n);"object"==typeof exports&&"undefined"!=typeof module?module.exports=c:"function"==typeof define&&define.amd&&define((function(){return c}))}}({"4Kbf6":[function(e,t,n){e("@parcel/transformer-js/src/esmodule-helpers.js").defineInteropFlag(n);var i=e("./parser");function r({subtitles:e=[]}){return async t=>{const{unescape:n,getExt:r,srtToVtt:a,assToVtt:s}=t.constructor.utils,o=new(0,i.WebVTTParser),l=new(0,i.WebVTTSerializer),u=await Promise.all(e.map((e=>async function(e,{getExt:t,srtToVtt:n,assToVtt:i}){const r=await fetch(e.url),a=await r.arrayBuffer(),s=new TextDecoder(e.encoding||"utf-8").decode(a);switch(e.type||t(e.url)){case"srt":return n(s);case"ass":return i(s);case"vtt":return s;default:return""}}(e,{getExt:r,srtToVtt:a,assToVtt:s})))),f=u.map(((t,n)=>{const i=o.parse(t,"metadata");return i.url=e[n].url,i.name=e[n].name,i}));let c="";function d(e=[]){const r=function(e){const t=(new(0,i.WebVTTParser)).parse("","metadata");for(let n=0;n<e.length;n++){const i=e[n];if(!i.updated){i.updated=!0;for(let e=0;e<i.cues.length;e++){const t=i.cues[e];for(let e=0;e<t.tree.children.length;e++){const n=t.tree.children[e];n.value=`<div class="art-subtitle-${i.name}">${n.value}</div>`}}}if(0===t.cues.length)t.cues=[...i.cues];else for(let e=0;e<t.cues.length;e++){const n=t.cues[e].tree.children,r=i.cues[e]?.tree?.children;t.cues[e]={...t.cues[e],tree:{children:[...n,...r]}}}}return t}(e),a=l.serialize(r.cues);URL.revokeObjectURL(c);const s=URL.createObjectURL(new Blob([a],{type:"text/vtt"}));c=s,t.option.subtitle.escape=!1,t.subtitle.init({...t.option.subtitle,url:s,type:"vtt",onVttLoad:n})}return d(f),{name:"multipleSubtitles",tracks:(e=[])=>d(e.map((e=>f.find((t=>t.name===e))))),reset:()=>d(f)}}}n.default=r,"undefined"!=typeof window&&(window.artplayerPluginMultipleSubtitles=r)},{"./parser":"cU78l","@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],cU78l:[function(e,t,n){!function(){var e={direction:"horizontal",snapToLines:!0,linePosition:"auto",lineAlign:"start",textPosition:"auto",positionAlign:"auto",size:100,alignment:"center"},t=function(t){t||(t={"&":"&","<":"<",">":">","&lrm":"","&rlm":""," ":" "}),this.entities=t,this.parse=function(n,a){n=n.replace(/\0/g,"�");var s=Date.now(),o=0,l=n.split(/\r\n|\r|\n/),u=!1,f=[],c=[],d=[];function p(e,t){d.push({message:e,line:o+1,col:t})}var m=l[o],g=m.length,h="WEBVTT",v=0,b=h.length;for("\ufeff"===m[0]&&(v=1,b+=1),(g<b||m.indexOf(h)!==0+v||g>b&&" "!==m[b]&&"\t"!==m[b])&&p('No valid signature. (File needs to start with "WEBVTT".)'),o++;""!=l[o]&&null!=l[o];){if(p("No blank line after the signature."),-1!=l[o].indexOf("--\x3e")){u=!0;break}o++}for(;null!=l[o];){for(var T;!u&&""==l[o];)o++;if(!u&&null==l[o])break;T=Object.assign({},e,{id:"",startTime:0,endTime:0,pauseOnExit:!1,direction:"horizontal",snapToLines:!0,linePosition:"auto",lineAlign:"start",textPosition:"auto",positionAlign:"auto",size:100,alignment:"center",text:"",tree:null});var x=!0;if(-1==l[o].indexOf("--\x3e")){if(T.id=l[o],/^NOTE($|[ \t])/.test(T.id)){for(o++;""!=l[o]&&null!=l[o];)-1!=l[o].indexOf("--\x3e")&&p("Cannot have timestamp in a comment."),o++;continue}if(/^STYLE($|[ \t])/.test(T.id)){var y=[],w=!1;for(o++;""!=l[o]&&null!=l[o];)-1!=l[o].indexOf("--\x3e")&&(p("Cannot have timestamp in a style block."),w=!0),y.push(l[o]),o++;if(c.length){p("Style blocks cannot appear after the first cue.");continue}w||f.push(y.join("\n"));continue}if(""==l[++o]||null==l[o]){p("Cue identifier cannot be standalone.");continue}if(-1==l[o].indexOf("--\x3e")){x=!1,p("Cue identifier needs to be followed by timestamp.");continue}}u=!1;var O=new i(l[o],p),P=0;if(c.length>0&&(P=c[c.length-1].startTime),!x||O.parse(T,P)){for(o++;""!=l[o]&&null!=l[o];){if(-1!=l[o].indexOf("--\x3e")){p("Blank line missing before cue."),u=!0;break}""!=T.text&&(T.text+="\n"),T.text+=l[o],o++}var j=new r(T.text,p,a,t);T.tree=j.parse(T.startTime,T.endTime),c.push(T)}else for(T=Line truncated
|
||||
Reference in new issue
Block a user