update docs

This commit is contained in:
Harvey Zack committed 2023-05-06 09:52:01 +08:00
1 parent 2749d50209
commit 550aa0e7f2
95 files changed
+1734 -1828

No files matched your search

@@ -523,10 +523,9 @@ art.on('ready', () => {
## `autoSize`
- Type: `Setter/Getter`
- Parameter: `Boolean`
- Type: `Function`
设置视频是否自适应尺寸,设置为 `true` 之后它会只执行一次
设置视频是否自适应尺寸
<div className="run-code">▶ Run Code</div>
@@ -537,9 +536,7 @@ var art = new Artplayer({
});
art.on('ready', () => {
console.info(art.autoSize);
art.autoSize = true;
console.info(art.autoSize);
art.autoSize();
});
```
@@ -666,10 +663,9 @@ art.on('ready', () => {
## `autoHeight`
- Type: `Setter/Getter`
- Parameter: `Boolean`
- Type: `Function`
当容器只有宽度,该属性可以自动计算出并设置视频的高度,设置为 `true` 之后它会只执行一次
当容器只有宽度,该属性可以自动计算出并设置视频的高度
<div className="run-code">▶ Run Code</div>
@@ -680,11 +676,11 @@ var art = new Artplayer({
});
art.on('ready', () => {
art.autoHeight = true;
art.autoHeight();
});
art.on('resize', () => {
art.autoHeight = true;
art.autoHeight();
});
```
+1 -1
View File
@@ -4,4 +4,4 @@
* (c) 2017-2023 Harvey Zack
* Released under the MIT License.
*/
!function(e,t,r,a,o){var n="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},i="function"==typeof n[a]&&n[a],s=i.cache||{},l="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function c(t,r){if(!s[t]){if(!e[t]){var o="function"==typeof n[a]&&n[a];if(!r&&o)return o(t,!0);if(i)return i(t,!0);if(l&&"string"==typeof t)return l(t);var p=new Error("Cannot find module '"+t+"'");throw p.code="MODULE_NOT_FOUND",p}d.resolve=function(r){var a=e[t][1][r];return null!=a?a:r},d.cache={};var u=s[t]=new c.Module(t);e[t][0].call(u.exports,d,u,u.exports,this)}return s[t].exports;function d(e){var t=d.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=s,c.parent=i,c.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(c,"root",{get:function(){return n[a]}}),n[a]=c;for(var p=0;p<t.length;p++)c(t[p]);if(r){var u=c(r);"object"==typeof exports&&"undefined"!=typeof module?module.exports=u:"function"==typeof define&&define.amd&&define((function(){return u}))}}({"5lTcX":[function(e,t,r){var a=e("@parcel/transformer-js/src/esmodule-helpers.js");a.defineInteropFlag(r);var o=e("bundle-text:./style/index.less"),n=a.interopDefault(o),i=e("option-validator"),s=a.interopDefault(i),l=e("./utils/emitter"),c=a.interopDefault(l),p=e("./utils"),u=e("./scheme"),d=a.interopDefault(u),f=e("./config"),h=a.interopDefault(f),m=e("./template"),g=a.interopDefault(m),v=e("./i18n"),y=a.interopDefault(v),b=e("./player"),x=a.interopDefault(b),w=e("./control"),j=a.interopDefault(w),k=e("./contextmenu"),S=a.interopDefault(k),I=e("./info"),C=a.interopDefault(I),P=e("./subtitle"),$=a.interopDefault(P),T=e("./events"),M=a.interopDefault(T),E=e("./hotkey"),F=a.interopDefault(E),z=e("./layer"),A=a.interopDefault(z),H=e("./loading"),D=a.interopDefault(H),R=e("./notice"),O=a.interopDefault(R),L=e("./mask"),V=a.interopDefault(L),N=e("./icons"),Y=a.interopDefault(N),_=e("./setting"),W=a.interopDefault(_),B=e("./storage"),q=a.interopDefault(B),U=e("./plugins"),K=a.interopDefault(U);let G=0;const Z=[];class J extends c.default{constructor(e,t){super(),this.id=++G;const r=p.mergeDeep(J.option,e);if(r.container=e.container,this.option=(0,s.default)(r,d.default),this.isLock=!1,this.isReady=!1,this.isFocus=!1,this.isInput=!1,this.isRotate=!1,this.isDestroy=!1,this.template=new(0,g.default)(this),this.events=new(0,M.default)(this),this.storage=new(0,q.default)(this),this.icons=new(0,Y.default)(this),this.i18n=new(0,y.default)(this),this.notice=new(0,O.default)(this),this.player=new(0,x.default)(this),this.layers=new(0,A.default)(this),this.controls=new(0,j.default)(this),this.contextmenu=new(0,S.default)(this),this.subtitle=new(0,$.default)(this),this.info=new(0,C.default)(this),this.loading=new(0,D.default)(this),this.hotkey=new(0,F.default)(this),this.mask=new(0,V.default)(this),this.setting=new(0,W.default)(this),this.plugins=new(0,K.default)(this),"function"==typeof t&&this.on("ready",(()=>t.call(this,this))),J.DEBUG){const e=e=>console.log(`[ART.${this.id}] -> ${e}`);e("Version@"+J.version),e("Env@"+J.env),e("Build@"+J.build);for(let t=0;t<h.default.events.length;t++)this.on("video:"+h.default.events[t],(t=>e("Event@"+t.type)))}Z.push(this)}static get instances(){return Z}static get version(){return"5.0.6"}static get env(){return"production"}static get build(){return"2023-05-03 12:46:22"}static get config(){return h.default}static get utils(){return p}static get scheme(){return d.default}static get Emitter(){return c.default}static get validator(){return s.default}static get kindOf(){return s.default.kindOf}static get html(){return g.default.html}static get option(){return{id:"",container:"#artplayer",url:"",poster:"",type:"",theme:"#f00",volume:.7,isLive:!1,muted:!1,autoplay:!1,autoSize:!1,autoMini:!1,loop:!1,flip:!1,playbackRate:!1,aspectRatio:!1,screenshot:!1,setting:!1,hotkey:!0,pip:!1,mutex:!0,backdrop:!0,fullscreen:!1,fullscreenWeb:!1,subtitleOffset:!1,miniProgressBar:!1,useSSR:!1,playsInline:!0,lock:!1,fastForward:!1,autoPlayback:!1,autoOrientation:!1,airplay:!1,layers:[],contextmenu:[],controls:[],settings:[],quality:[],highlight:[],plugins:[],thumbnails:{url:"",number:60,column:10,width:0,height:0},subtitle:{url:"",type:"",style:{},escape:!0,encoding:"utf-8",onVttLoad:e=>e},moreVideoAttr:{controls:!1,preload:p.isSafari?"auto":"metadata"},i18n:{},icons:{},cssVar:{},customType:{},lang:navigator.language.toLowerCase()}}get proxy(){return this.events.proxy}get query(){return this.template.query}get video(){return this.template.$video}destroy(e=!0){this.events.destroy(),this.template.destroy(e),Z.splice(Z.indexOf(this),1),this.isDestroy=!0,this.emit("destroy")}}if(r.default=J,J.DEBUG=!1,J.CONTEXTMENU=!0,J.NOTICE_TIME=2e3,J.SETTING_WIDTH=250,J.SETTING_ITEM_WIDTH=200,J.SETTING_ITEM_HEIGHT=35,J.RESIZE_TIME=500,J.SCROLL_TIMLine truncated
!function(e,t,r,a,o){var n="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},i="function"==typeof n[a]&&n[a],s=i.cache||{},l="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function c(t,r){if(!s[t]){if(!e[t]){var o="function"==typeof n[a]&&n[a];if(!r&&o)return o(t,!0);if(i)return i(t,!0);if(l&&"string"==typeof t)return l(t);var p=new Error("Cannot find module '"+t+"'");throw p.code="MODULE_NOT_FOUND",p}d.resolve=function(r){var a=e[t][1][r];return null!=a?a:r},d.cache={};var u=s[t]=new c.Module(t);e[t][0].call(u.exports,d,u,u.exports,this)}return s[t].exports;function d(e){var t=d.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=s,c.parent=i,c.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(c,"root",{get:function(){return n[a]}}),n[a]=c;for(var p=0;p<t.length;p++)c(t[p]);if(r){var u=c(r);"object"==typeof exports&&"undefined"!=typeof module?module.exports=u:"function"==typeof define&&define.amd&&define((function(){return u}))}}({"5lTcX":[function(e,t,r){var a=e("@parcel/transformer-js/src/esmodule-helpers.js");a.defineInteropFlag(r);var o=e("bundle-text:./style/index.less"),n=a.interopDefault(o),i=e("option-validator"),s=a.interopDefault(i),l=e("./utils/emitter"),c=a.interopDefault(l),p=e("./utils"),u=e("./scheme"),d=a.interopDefault(u),f=e("./config"),h=a.interopDefault(f),m=e("./template"),g=a.interopDefault(m),v=e("./i18n"),y=a.interopDefault(v),b=e("./player"),x=a.interopDefault(b),w=e("./control"),j=a.interopDefault(w),k=e("./contextmenu"),S=a.interopDefault(k),I=e("./info"),P=a.interopDefault(I),C=e("./subtitle"),$=a.interopDefault(C),T=e("./events"),M=a.interopDefault(T),E=e("./hotkey"),F=a.interopDefault(E),z=e("./layer"),A=a.interopDefault(z),H=e("./loading"),D=a.interopDefault(H),R=e("./notice"),O=a.interopDefault(R),L=e("./mask"),V=a.interopDefault(L),N=e("./icons"),Y=a.interopDefault(N),_=e("./setting"),W=a.interopDefault(_),B=e("./storage"),q=a.interopDefault(B),U=e("./plugins"),K=a.interopDefault(U);let G=0;const Z=[];class J extends c.default{constructor(e,t){super(),this.id=++G;const r=p.mergeDeep(J.option,e);if(r.container=e.container,this.option=(0,s.default)(r,d.default),this.isLock=!1,this.isReady=!1,this.isFocus=!1,this.isInput=!1,this.isRotate=!1,this.isDestroy=!1,this.template=new(0,g.default)(this),this.events=new(0,M.default)(this),this.storage=new(0,q.default)(this),this.icons=new(0,Y.default)(this),this.i18n=new(0,y.default)(this),this.notice=new(0,O.default)(this),this.player=new(0,x.default)(this),this.layers=new(0,A.default)(this),this.controls=new(0,j.default)(this),this.contextmenu=new(0,S.default)(this),this.subtitle=new(0,$.default)(this),this.info=new(0,P.default)(this),this.loading=new(0,D.default)(this),this.hotkey=new(0,F.default)(this),this.mask=new(0,V.default)(this),this.setting=new(0,W.default)(this),this.plugins=new(0,K.default)(this),"function"==typeof t&&this.on("ready",(()=>t.call(this,this))),J.DEBUG){const e=e=>console.log(`[ART.${this.id}] -> ${e}`);e("Version@"+J.version),e("Env@"+J.env),e("Build@"+J.build);for(let t=0;t<h.default.events.length;t++)this.on("video:"+h.default.events[t],(t=>e("Event@"+t.type)))}Z.push(this)}static get instances(){return Z}static get version(){return"5.0.6"}static get env(){return"production"}static get build(){return"2023-05-06 09:51:23"}static get config(){return h.default}static get utils(){return p}static get scheme(){return d.default}static get Emitter(){return c.default}static get validator(){return s.default}static get kindOf(){return s.default.kindOf}static get html(){return g.default.html}static get option(){return{id:"",container:"#artplayer",url:"",poster:"",type:"",theme:"#f00",volume:.7,isLive:!1,muted:!1,autoplay:!1,autoSize:!1,autoMini:!1,loop:!1,flip:!1,playbackRate:!1,aspectRatio:!1,screenshot:!1,setting:!1,hotkey:!0,pip:!1,mutex:!0,backdrop:!0,fullscreen:!1,fullscreenWeb:!1,subtitleOffset:!1,miniProgressBar:!1,useSSR:!1,playsInline:!0,lock:!1,fastForward:!1,autoPlayback:!1,autoOrientation:!1,airplay:!1,layers:[],contextmenu:[],controls:[],settings:[],quality:[],highlight:[],plugins:[],thumbnails:{url:"",number:60,column:10,width:0,height:0},subtitle:{url:"",type:"",style:{},escape:!0,encoding:"utf-8",onVttLoad:e=>e},moreVideoAttr:{controls:!1,preload:p.isSafari?"auto":"metadata"},i18n:{},icons:{},cssVar:{},customType:{},lang:navigator.language.toLowerCase()}}get proxy(){return this.events.proxy}get query(){return this.template.query}get video(){return this.template.$video}destroy(e=!0){this.events.destroy(),this.template.destroy(e),Z.splice(Z.indexOf(this),1),this.isDestroy=!0,this.emit("destroy")}}if(r.default=J,J.DEBUG=!1,J.CONTEXTMENU=!0,J.NOTICE_TIME=2e3,J.SETTING_WIDTH=250,J.SETTING_ITEM_WIDTH=200,J.SETTING_ITEM_HEIGHT=35,J.RESIZE_TIME=500,J.SCROLL_TIMLine truncated
+1 -1
View File
@@ -4,4 +4,4 @@
* (c) 2017-2023 Harvey Zack
* Released under the MIT License.
*/
!function(e,t,r,n,a){var o="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},s="function"==typeof o[n]&&o[n],i=s.cache||{},l="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function c(t,r){if(!i[t]){if(!e[t]){var a="function"==typeof o[n]&&o[n];if(!r&&a)return a(t,!0);if(s)return s(t,!0);if(l&&"string"==typeof t)return l(t);var u=new Error("Cannot find module '"+t+"'");throw u.code="MODULE_NOT_FOUND",u}f.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},f.cache={};var p=i[t]=new c.Module(t);e[t][0].call(p.exports,f,p,p.exports,this)}return i[t].exports;function f(e){var t=f.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=i,c.parent=s,c.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(c,"root",{get:function(){return o[n]}}),o[n]=c;for(var u=0;u<t.length;u++)c(t[u]);if(r){var p=c(r);"object"==typeof exports&&"undefined"!=typeof module?module.exports=p:"function"==typeof define&&define.amd&&define((function(){return p}))}}({"4Be4O":[function(e,t,r){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r),n.export(r,"default",(function(){return ie}));var a=e("@swc/helpers/src/_assert_this_initialized.mjs"),o=n.interopDefault(a),s=e("@swc/helpers/src/_class_call_check.mjs"),i=n.interopDefault(s),l=e("@swc/helpers/src/_create_class.mjs"),c=n.interopDefault(l),u=e("@swc/helpers/src/_inherits.mjs"),p=n.interopDefault(u),f=e("@swc/helpers/src/_create_super.mjs"),d=n.interopDefault(f),h=e("bundle-text:./style/index.less"),m=n.interopDefault(h),v=e("option-validator"),g=n.interopDefault(v),y=e("./utils/emitter"),b=n.interopDefault(y),w=e("./utils"),j=e("./scheme"),_=n.interopDefault(j),x=e("./config"),k=n.interopDefault(x),S=e("./template"),D=n.interopDefault(S),I=e("./i18n"),M=n.interopDefault(I),P=e("./player"),R=n.interopDefault(P),F=e("./control"),E=n.interopDefault(F),T=e("./contextmenu"),z=n.interopDefault(T),O=e("./info"),C=n.interopDefault(O),W=e("./subtitle"),A=n.interopDefault(W),L=e("./events"),V=n.interopDefault(L),$=e("./hotkey"),N=n.interopDefault($),H=e("./layer"),U=n.interopDefault(H),B=e("./loading"),q=n.interopDefault(B),Y=e("./notice"),G=n.interopDefault(Y),Z=e("./mask"),Q=n.interopDefault(Z),K=e("./icons"),X=n.interopDefault(K),J=e("./setting"),ee=n.interopDefault(J),te=e("./storage"),re=n.interopDefault(te),ne=e("./plugins"),ae=n.interopDefault(ne),oe=0,se=[],ie=function(e){"use strict";(0,p.default)(r,e);var t=(0,d.default)(r);function r(e,n){var a;(0,i.default)(this,r),(a=t.call(this)).id=++oe;var s=w.mergeDeep(r.option,e);if(s.container=e.container,a.option=(0,g.default)(s,_.default),a.isLock=!1,a.isReady=!1,a.isFocus=!1,a.isInput=!1,a.isRotate=!1,a.isDestroy=!1,a.template=new(0,D.default)((0,o.default)(a)),a.events=new(0,V.default)((0,o.default)(a)),a.storage=new(0,re.default)((0,o.default)(a)),a.icons=new(0,X.default)((0,o.default)(a)),a.i18n=new(0,M.default)((0,o.default)(a)),a.notice=new(0,G.default)((0,o.default)(a)),a.player=new(0,R.default)((0,o.default)(a)),a.layers=new(0,U.default)((0,o.default)(a)),a.controls=new(0,E.default)((0,o.default)(a)),a.contextmenu=new(0,z.default)((0,o.default)(a)),a.subtitle=new(0,A.default)((0,o.default)(a)),a.info=new(0,C.default)((0,o.default)(a)),a.loading=new(0,q.default)((0,o.default)(a)),a.hotkey=new(0,N.default)((0,o.default)(a)),a.mask=new(0,Q.default)((0,o.default)(a)),a.setting=new(0,ee.default)((0,o.default)(a)),a.plugins=new(0,ae.default)((0,o.default)(a)),"function"==typeof n&&a.on("ready",(function(){return n.call((0,o.default)(a),(0,o.default)(a))})),r.DEBUG){var l=function(e){return console.log("[ART.".concat(a.id,"] -> ").concat(e))};l("Version@"+r.version),l("Env@"+r.env),l("Build@"+r.build);for(var c=0;c<k.default.events.length;c++)a.on("video:"+k.default.events[c],(function(e){return l("Event@"+e.type)}))}return se.push((0,o.default)(a)),a}return(0,c.default)(r,[{key:"proxy",get:function(){return this.events.proxy}},{key:"query",get:function(){return this.template.query}},{key:"video",get:function(){return this.template.$video}},{key:"destroy",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.events.destroy(),this.template.destroy(e),se.splice(se.indexOf(this),1),this.isDestroy=!0,this.emit("destroy")}}],[{key:"instances",get:function(){return se}},{key:"version",get:function(){return"5.0.6"}},{key:"env",get:function(){return"production"}},{key:"build",get:function(){return"2023-05-03 12:46:25"}},{key:"config",get:function(){return k.default}},{key:"utils",get:function(){return w}},{key:"scheme",get:function(){return _.default}},{key:"Emitter",get:function(){return b.default}},{key:"validator",get:function(){return g.default}},{key:"kindOf",get:function(){return g.default.kindOf}},{key:"html",get:function(){return DLine truncated
!function(e,t,r,n,a){var o="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},s="function"==typeof o[n]&&o[n],i=s.cache||{},l="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function c(t,r){if(!i[t]){if(!e[t]){var a="function"==typeof o[n]&&o[n];if(!r&&a)return a(t,!0);if(s)return s(t,!0);if(l&&"string"==typeof t)return l(t);var u=new Error("Cannot find module '"+t+"'");throw u.code="MODULE_NOT_FOUND",u}f.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},f.cache={};var p=i[t]=new c.Module(t);e[t][0].call(p.exports,f,p,p.exports,this)}return i[t].exports;function f(e){var t=f.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=i,c.parent=s,c.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(c,"root",{get:function(){return o[n]}}),o[n]=c;for(var u=0;u<t.length;u++)c(t[u]);if(r){var p=c(r);"object"==typeof exports&&"undefined"!=typeof module?module.exports=p:"function"==typeof define&&define.amd&&define((function(){return p}))}}({"4Be4O":[function(e,t,r){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r),n.export(r,"default",(function(){return ie}));var a=e("@swc/helpers/src/_assert_this_initialized.mjs"),o=n.interopDefault(a),s=e("@swc/helpers/src/_class_call_check.mjs"),i=n.interopDefault(s),l=e("@swc/helpers/src/_create_class.mjs"),c=n.interopDefault(l),u=e("@swc/helpers/src/_inherits.mjs"),p=n.interopDefault(u),f=e("@swc/helpers/src/_create_super.mjs"),d=n.interopDefault(f),h=e("bundle-text:./style/index.less"),m=n.interopDefault(h),v=e("option-validator"),g=n.interopDefault(v),y=e("./utils/emitter"),b=n.interopDefault(y),w=e("./utils"),j=e("./scheme"),_=n.interopDefault(j),x=e("./config"),k=n.interopDefault(x),D=e("./template"),S=n.interopDefault(D),I=e("./i18n"),M=n.interopDefault(I),P=e("./player"),R=n.interopDefault(P),F=e("./control"),E=n.interopDefault(F),T=e("./contextmenu"),O=n.interopDefault(T),z=e("./info"),C=n.interopDefault(z),W=e("./subtitle"),A=n.interopDefault(W),L=e("./events"),V=n.interopDefault(L),$=e("./hotkey"),N=n.interopDefault($),H=e("./layer"),U=n.interopDefault(H),B=e("./loading"),q=n.interopDefault(B),Y=e("./notice"),G=n.interopDefault(Y),Z=e("./mask"),Q=n.interopDefault(Z),K=e("./icons"),X=n.interopDefault(K),J=e("./setting"),ee=n.interopDefault(J),te=e("./storage"),re=n.interopDefault(te),ne=e("./plugins"),ae=n.interopDefault(ne),oe=0,se=[],ie=function(e){"use strict";(0,p.default)(r,e);var t=(0,d.default)(r);function r(e,n){var a;(0,i.default)(this,r),(a=t.call(this)).id=++oe;var s=w.mergeDeep(r.option,e);if(s.container=e.container,a.option=(0,g.default)(s,_.default),a.isLock=!1,a.isReady=!1,a.isFocus=!1,a.isInput=!1,a.isRotate=!1,a.isDestroy=!1,a.template=new(0,S.default)((0,o.default)(a)),a.events=new(0,V.default)((0,o.default)(a)),a.storage=new(0,re.default)((0,o.default)(a)),a.icons=new(0,X.default)((0,o.default)(a)),a.i18n=new(0,M.default)((0,o.default)(a)),a.notice=new(0,G.default)((0,o.default)(a)),a.player=new(0,R.default)((0,o.default)(a)),a.layers=new(0,U.default)((0,o.default)(a)),a.controls=new(0,E.default)((0,o.default)(a)),a.contextmenu=new(0,O.default)((0,o.default)(a)),a.subtitle=new(0,A.default)((0,o.default)(a)),a.info=new(0,C.default)((0,o.default)(a)),a.loading=new(0,q.default)((0,o.default)(a)),a.hotkey=new(0,N.default)((0,o.default)(a)),a.mask=new(0,Q.default)((0,o.default)(a)),a.setting=new(0,ee.default)((0,o.default)(a)),a.plugins=new(0,ae.default)((0,o.default)(a)),"function"==typeof n&&a.on("ready",(function(){return n.call((0,o.default)(a),(0,o.default)(a))})),r.DEBUG){var l=function(e){return console.log("[ART.".concat(a.id,"] -> ").concat(e))};l("Version@"+r.version),l("Env@"+r.env),l("Build@"+r.build);for(var c=0;c<k.default.events.length;c++)a.on("video:"+k.default.events[c],(function(e){return l("Event@"+e.type)}))}return se.push((0,o.default)(a)),a}return(0,c.default)(r,[{key:"proxy",get:function(){return this.events.proxy}},{key:"query",get:function(){return this.template.query}},{key:"video",get:function(){return this.template.$video}},{key:"destroy",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.events.destroy(),this.template.destroy(e),se.splice(se.indexOf(this),1),this.isDestroy=!0,this.emit("destroy")}}],[{key:"instances",get:function(){return se}},{key:"version",get:function(){return"5.0.6"}},{key:"env",get:function(){return"production"}},{key:"build",get:function(){return"2023-05-06 09:51:27"}},{key:"config",get:function(){return k.default}},{key:"utils",get:function(){return w}},{key:"scheme",get:function(){return _.default}},{key:"Emitter",get:function(){return b.default}},{key:"validator",get:function(){return g.default}},{key:"kindOf",get:function(){return g.default.kindOf}},{key:"html",get:function(){return SLine truncated
+9 -8
View File
@@ -1,17 +1,18 @@
import { throttle } from '../utils';
export default function resizeInit(art, events) {
const { option } = art;
const { option, constructor } = art;
const resizeFn = throttle(() => {
if (art.state === 'standard') {
art.autoSize = option.autoSize;
art.on('resize', () => {
const { aspectRatio, notice } = art;
art.aspectRatio = aspectRatio;
if (art.state === 'standard' && option.autoSize) {
art.autoSize();
}
art.aspectRatioReset();
art.notice.show = '';
art.emit('resize');
}, art.constructor.RESIZE_TIME);
notice.show = '';
});
const resizeFn = throttle(() => art.emit('resize'), constructor.RESIZE_TIME);
events.proxy(window, ['orientationchange', 'resize'], () => resizeFn());
if (screen && screen.orientation && screen.orientation.onchange) {
events.proxy(screen.orientation, 'change', () => resizeFn());
@@ -42,11 +42,4 @@ export default function aspectRatioMix(art) {
art.emit('aspectRatio', ratio);
},
});
def(art, 'aspectRatioReset', {
value() {
const { aspectRatio } = art;
art.aspectRatio = aspectRatio;
},
});
}
+7 -22
View File
@@ -1,32 +1,17 @@
import { setStyle, hasClass, addClass, removeClass, def } from '../utils';
import { setStyle, def } from '../utils';
export default function autoHeightMix(art) {
const {
option,
template: { $container, $video },
} = art;
const heightCache = $container.style.height;
def(art, 'autoHeight', {
get() {
return hasClass($container, 'art-auto-height');
},
set(value) {
if (value) {
const { clientWidth } = $container;
const { videoHeight, videoWidth } = $video;
const height = videoHeight * (clientWidth / videoWidth);
setStyle($container, 'height', height + 'px');
addClass($container, 'art-auto-height');
art.autoSize = option.autoSize;
art.emit('autoHeight', height);
} else {
setStyle($container, 'height', heightCache);
removeClass($container, 'art-auto-height');
art.autoSize = option.autoSize;
art.emit('autoHeight');
}
value() {
const { clientWidth } = $container;
const { videoHeight, videoWidth } = $video;
const height = videoHeight * (clientWidth / videoWidth);
setStyle($container, 'height', height + 'px');
art.emit('autoHeight', height);
},
});
}
+17 -28
View File
@@ -1,38 +1,27 @@
import { setStyle, addClass, removeClass, hasClass, def } from '../utils';
import { setStyle, def } from '../utils';
export default function resizeMix(art) {
const { $container, $player, $video } = art.template;
def(art, 'autoSize', {
get() {
return hasClass($container, 'art-auto-size');
},
set(value) {
if (value) {
const { videoWidth, videoHeight } = $video;
const { width, height } = $container.getBoundingClientRect();
const videoRatio = videoWidth / videoHeight;
const containerRatio = width / height;
addClass($container, 'art-auto-size');
if (containerRatio > videoRatio) {
const percentage = ((height * videoRatio) / width) * 100;
setStyle($player, 'width', `${percentage}%`);
setStyle($player, 'height', '100%');
} else {
const percentage = (width / videoRatio / height) * 100;
setStyle($player, 'width', '100%');
setStyle($player, 'height', `${percentage}%`);
}
art.emit('autoSize', {
width: art.width,
height: art.height,
});
value() {
const { videoWidth, videoHeight } = $video;
const { width, height } = $container.getBoundingClientRect();
const videoRatio = videoWidth / videoHeight;
const containerRatio = width / height;
if (containerRatio > videoRatio) {
const percentage = ((height * videoRatio) / width) * 100;
setStyle($player, 'width', `${percentage}%`);
setStyle($player, 'height', '100%');
} else {
removeClass($container, 'art-auto-size');
setStyle($player, 'width', null);
setStyle($player, 'height', null);
art.emit('autoSize');
const percentage = (width / videoRatio / height) * 100;
setStyle($player, 'width', '100%');
setStyle($player, 'height', `${percentage}%`);
}
art.emit('autoSize', {
width: art.width,
height: art.height,
});
},
});
}
+1 -1
View File
@@ -83,7 +83,7 @@ export default function eventInit(art) {
// });
art.on('video:loadedmetadata', () => {
art.autoSize = option.autoSize;
art.emit('resize');
if (isMobile) {
art.loading.show = false;
art.controls.show = true;
@@ -20,15 +20,11 @@ export default function fullscreenMix(art) {
async set(value) {
if (value) {
art.state = 'fullscreen';
art.aspectRatioReset();
art.autoSize = false;
await screenfull.request($player);
addClass($player, 'art-fullscreen');
art.emit('resize');
notice.show = '';
} else {
art.aspectRatioReset();
art.autoSize = art.option.autoSize;
await screenfull.exit();
removeClass($player, 'art-fullscreen');
art.emit('resize');
@@ -2,7 +2,6 @@ import { addClass, removeClass, hasClass, def, append } from '../utils';
export default function fullscreenWebMix(art) {
const {
option,
notice,
constructor,
template: { $container, $player },
@@ -21,8 +20,6 @@ export default function fullscreenWebMix(art) {
}
art.state = 'fullscreenWeb';
addClass($player, 'art-fullscreen-web');
art.aspectRatioReset();
art.autoSize = false;
art.emit('resize');
art.emit('fullscreenWeb', true);
notice.show = '';
@@ -35,8 +32,6 @@ export default function fullscreenWebMix(art) {
cssText = '';
}
removeClass($player, 'art-fullscreen-web');
art.aspectRatioReset();
art.autoSize = option.autoSize;
art.emit('resize');
art.emit('fullscreenWeb', false);
notice.show = '';
@@ -15,6 +15,7 @@
color: var(--art-font-color);
background-color: var(--art-background-color);
text-shadow: 0 0 2px var(--art-text-shadow-color);
transition: width, height var(--art-transition-duration) ease;
font-family: PingFang SC, Helvetica Neue, Microsoft YaHei, Roboto, Arial, sans-serif;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
-ms-touch-action: manipulation;
@@ -1,7 +0,0 @@
.art-auto-size {
.art-center();
.art-video-player {
transition: width, height var(--art-transition-duration) ease;
}
}
@@ -1,4 +1,5 @@
.art-fullscreen-web {
.art-fullscreen();
.art-full(var(--art-fullscreen-web-index), fixed);
width: 100% !important;
}
-1
View File
@@ -23,7 +23,6 @@
@import './fullscreen.less';
@import './fullscreenWeb.less';
@import './mini.less';
@import './autoSize.less';
@import './flip.less';
@import './plugins.less';
@import './selector.less';
+2 -5
View File
@@ -15,10 +15,6 @@ export declare class Player {
set type(name: CustomType);
get playbackRate(): PlaybackRate;
set playbackRate(rate: PlaybackRate);
get autoSize(): boolean;
set autoSize(state: boolean);
get autoHeight(): boolean;
set autoHeight(state: boolean);
get currentTime(): number;
set currentTime(time: number);
get duration(): number;
@@ -78,5 +74,6 @@ export declare class Player {
getBlobUrl(): Promise<string>;
screenshot(): Promise<string>;
airplay(): void;
aspectRatioReset(state: boolean): void;
autoSize(): void;
autoHeight(): void;
}