mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-20 20:21:20 -08:00
添加ready事件
This commit is contained in:
1 parent
d43a71b931
commit
a6816d68fa
10 files changed
+42
-51
No files matched your search
Vendored
+1
-1
@@ -5,4 +5,4 @@
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
|
||||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).Artplayer=e()}(this,function(){"use strict";var a=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")};function r(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var i=function(t,e,n){return e&&r(t.prototype,e),n&&r(t,n),t};"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function t(t,e){return t(e={exports:{}},e.exports),e.exports}var c=t(function(e){function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function r(t){return"function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?e.exports=r=function(t){return n(t)}:e.exports=r=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":n(t)},r(t)}e.exports=r});var o=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t};var s=function(t,e){return!e||"object"!==c(e)&&"function"!=typeof e?o(t):e},l=t(function(e){function n(t){return e.exports=n=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},n(t)}e.exports=n}),u=t(function(n){function r(t,e){return n.exports=r=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},r(t,e)}n.exports=r});var e=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&u(t,e)},f=t(function(t,e){function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function r(t){return t.constructor?t.constructor.name:null}function s(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:["option"];return l(t,e,n),u(t,e,n),function(o,a,c){var t=f(a),e=f(o);if("object"===t){if("object"!==e)throw new Error("[Type Error]: '".concat(c.join("."),"' require 'object' type, but got '").concat(e,"'"));Object.keys(a).forEach(function(t){var e=o[t],n=a[t],r=c.slice();r.push(t),l(e,n,r),u(e,n,r),s(e,n,r)})}if("array"===t){if("array"!==e)throw new Error("[Type Error]: '".concat(c.join("."),"' require 'array' type, but got '").concat(e,"'"));o.forEach(function(t,e){var n=o[e],r=a[e]||a[0],i=c.slice();i.push(e),l(n,r,i),u(n,r,i),s(n,r,i)})}}(t,e,n),t}function l(t,e,n){if("string"===f(e)){var r=f(t);if(!(-1<e.indexOf("|")?e.split("|").map(function(t){return t.toLowerCase().trim()}).filter(Boolean).some(function(t){return r===t}):e.toLowerCase().trim()===r))throw new Error("[Type Error]: '".concat(n.join("."),"' require '").concat(e,"' type, but got '").concat(r,"'"))}}function u(t,e,n){if("function"===f(e)){var r=e(t,f(t),n);if(!0!==r){var i=f(r);throw"string"===i?new Error(r):"error"===i?r:new Error("[Validator Error]: The scheme for '".concat(n.join("."),"' validator require return true, but got '").concat(r,"'"))}}}var i,f;t.exports=(i=Object.prototype.toString,s.kindOf=f=function(t){if(void 0===t)return"undefined";if(null===t)return"null";var e=n(t);if("boolean"===e)return"boolean";if("string"===e)return"string";if("number"===e)return"number";if("symbol"===e)return"symbol";if("function"===e)return function(t){return"GeneratorFunction"===r(t)}(t)?"generatorfunction":"function";if(function(t){return Array.isArray?Array.isArray(t):t instanceof Array}(t))return"array";if(function(t){return!(!t.constructor||"function"!=typeof t.constructor.isBuffer)&&t.constructor.isBuffer(t)}(t))return"buffer";if(function(t){try{if("number"==typeof t.length&&"function"==typeof t.callee)return!0}catch(t){if(-1!==t.message.indexOf("callee"))return!0}return!1}(t))return"arguments";if(function(t){return t instanceof Date||"function"==typeof t.toDateString&&"function"==typeof t.getDate&&"function"==typeof t.setDate}(t))return"date";if(function(t){return t instanceof Error||"string"==typeof t.message&&t.constructor&&"number"==typeof t.constructor.stackTraceLimit}(t))return"error";if(function(t){return t instanceof RegExp||"string"==typeof t.flags&&"boolean"==typeof t.ignoreCase&&"boolean"==typeof t.multiline&&"boolean"==typeof t.global}(t))return"regexp";switch(r(t)){case"Symbol":return"symbol";case"Promise":return"promise";case"WeakMap":return"weakmap";case"WeakSet":return"weakset";case"Map":return"map";case"Set":return"set";case"Int8Array":return"int8array";case"Uint8Array":return"uint8array";case"Uint8ClampedArray":return"uiLine truncated
|
||||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).Artplayer=e()}(this,function(){"use strict";var a=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")};function r(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var i=function(t,e,n){return e&&r(t.prototype,e),n&&r(t,n),t};"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function t(t,e){return t(e={exports:{}},e.exports),e.exports}var c=t(function(e){function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function r(t){return"function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?e.exports=r=function(t){return n(t)}:e.exports=r=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":n(t)},r(t)}e.exports=r});var o=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t};var s=function(t,e){return!e||"object"!==c(e)&&"function"!=typeof e?o(t):e},l=t(function(e){function n(t){return e.exports=n=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},n(t)}e.exports=n}),u=t(function(n){function r(t,e){return n.exports=r=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},r(t,e)}n.exports=r});var e=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&u(t,e)},f=t(function(t,e){function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function r(t){return t.constructor?t.constructor.name:null}function s(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:["option"];return l(t,e,n),u(t,e,n),function(o,a,c){var t=f(a),e=f(o);if("object"===t){if("object"!==e)throw new Error("[Type Error]: '".concat(c.join("."),"' require 'object' type, but got '").concat(e,"'"));Object.keys(a).forEach(function(t){var e=o[t],n=a[t],r=c.slice();r.push(t),l(e,n,r),u(e,n,r),s(e,n,r)})}if("array"===t){if("array"!==e)throw new Error("[Type Error]: '".concat(c.join("."),"' require 'array' type, but got '").concat(e,"'"));o.forEach(function(t,e){var n=o[e],r=a[e]||a[0],i=c.slice();i.push(e),l(n,r,i),u(n,r,i),s(n,r,i)})}}(t,e,n),t}function l(t,e,n){if("string"===f(e)){var r=f(t);if(!(-1<e.indexOf("|")?e.split("|").map(function(t){return t.toLowerCase().trim()}).filter(Boolean).some(function(t){return r===t}):e.toLowerCase().trim()===r))throw new Error("[Type Error]: '".concat(n.join("."),"' require '").concat(e,"' type, but got '").concat(r,"'"))}}function u(t,e,n){if("function"===f(e)){var r=e(t,f(t),n);if(!0!==r){var i=f(r);throw"string"===i?new Error(r):"error"===i?r:new Error("[Validator Error]: The scheme for '".concat(n.join("."),"' validator require return true, but got '").concat(r,"'"))}}}var i,f;t.exports=(i=Object.prototype.toString,s.kindOf=f=function(t){if(void 0===t)return"undefined";if(null===t)return"null";var e=n(t);if("boolean"===e)return"boolean";if("string"===e)return"string";if("number"===e)return"number";if("symbol"===e)return"symbol";if("function"===e)return function(t){return"GeneratorFunction"===r(t)}(t)?"generatorfunction":"function";if(function(t){return Array.isArray?Array.isArray(t):t instanceof Array}(t))return"array";if(function(t){return!(!t.constructor||"function"!=typeof t.constructor.isBuffer)&&t.constructor.isBuffer(t)}(t))return"buffer";if(function(t){try{if("number"==typeof t.length&&"function"==typeof t.callee)return!0}catch(t){if(-1!==t.message.indexOf("callee"))return!0}return!1}(t))return"arguments";if(function(t){return t instanceof Date||"function"==typeof t.toDateString&&"function"==typeof t.getDate&&"function"==typeof t.setDate}(t))return"date";if(function(t){return t instanceof Error||"string"==typeof t.message&&t.constructor&&"number"==typeof t.constructor.stackTraceLimit}(t))return"error";if(function(t){return t instanceof RegExp||"string"==typeof t.flags&&"boolean"==typeof t.ignoreCase&&"boolean"==typeof t.multiline&&"boolean"==typeof t.global}(t))return"regexp";switch(r(t)){case"Symbol":return"symbol";case"Promise":return"promise";case"WeakMap":return"weakmap";case"WeakSet":return"weakset";case"Map":return"map";case"Set":return"set";case"Int8Array":return"int8array";case"Uint8Array":return"uint8array";case"Uint8ClampedArray":return"uiLine truncated
|
||||
@@ -10,7 +10,7 @@ export default class Contextmenu {
|
||||
constructor(art) {
|
||||
this.id = 0;
|
||||
this.art = art;
|
||||
this.art.once('video:canplay', () => {
|
||||
this.art.on('ready', () => {
|
||||
this.init();
|
||||
});
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ export default class Controls {
|
||||
constructor(art) {
|
||||
this.id = 0;
|
||||
this.art = art;
|
||||
this.art.once('video:canplay', () => {
|
||||
this.art.on('ready', () => {
|
||||
this.init();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ export default class Hotkey {
|
||||
this.art = art;
|
||||
this.keys = {};
|
||||
if (this.art.option.hotkey) {
|
||||
this.art.once('video:canplay', () => {
|
||||
this.art.on('ready', () => {
|
||||
this.add(27, () => {
|
||||
if (art.player.fullscreenWeb) {
|
||||
art.player.fullscreenWeb = false;
|
||||
|
||||
@@ -5,7 +5,7 @@ export default class Layers {
|
||||
this.id = 0;
|
||||
this.art = art;
|
||||
this.add = this.add.bind(this);
|
||||
this.art.once('video:canplay', () => {
|
||||
this.art.on('ready', () => {
|
||||
this.art.option.layers.forEach(item => {
|
||||
this.add(item);
|
||||
});
|
||||
|
||||
@@ -9,10 +9,10 @@ export default function eventInit(art, player) {
|
||||
i18n,
|
||||
notice,
|
||||
} = art;
|
||||
|
||||
|
||||
let reconnectTime = 0;
|
||||
const maxReconnectTime = 5;
|
||||
|
||||
|
||||
proxy($video, 'click', () => {
|
||||
player.toggle = true;
|
||||
});
|
||||
@@ -24,7 +24,7 @@ export default function eventInit(art, player) {
|
||||
});
|
||||
|
||||
// art.on('video:abort', () => {
|
||||
|
||||
|
||||
// });
|
||||
|
||||
art.on('video:canplay', () => {
|
||||
@@ -34,6 +34,10 @@ export default function eventInit(art, player) {
|
||||
art.loading.show = false;
|
||||
});
|
||||
|
||||
art.once('video:canplay', () => {
|
||||
art.emit('ready');
|
||||
});
|
||||
|
||||
// art.on('video:canplaythrough', () => {
|
||||
|
||||
// });
|
||||
@@ -74,7 +78,7 @@ export default function eventInit(art, player) {
|
||||
});
|
||||
|
||||
// art.on('video:loadeddata', () => {
|
||||
|
||||
|
||||
// });
|
||||
|
||||
art.on('video:loadedmetadata', () => {
|
||||
@@ -117,11 +121,11 @@ export default function eventInit(art, player) {
|
||||
});
|
||||
|
||||
// art.on('video:stalled', () => {
|
||||
|
||||
|
||||
// });
|
||||
|
||||
// art.on('video:suspend', () => {
|
||||
|
||||
|
||||
// });
|
||||
|
||||
art.on('video:timeupdate', () => {
|
||||
@@ -129,7 +133,7 @@ export default function eventInit(art, player) {
|
||||
});
|
||||
|
||||
// art.on('video:volumechange', () => {
|
||||
|
||||
|
||||
// });
|
||||
|
||||
art.on('video:waiting', () => {
|
||||
|
||||
@@ -9,7 +9,7 @@ export default class Setting {
|
||||
this.art = art;
|
||||
this.state = false;
|
||||
if (art.option.setting) {
|
||||
this.art.once('video:canplay', () => {
|
||||
this.art.on('ready', () => {
|
||||
this.init();
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user