mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-29 02:51:20 -08:00
修改多实例时的图标bug
This commit is contained in:
1 parent
1573364202
commit
381a7e657e
7 files changed
+170
-138
No files matched your search
@@ -907,7 +907,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (typeof url === 'function') {
|
if (typeof url === 'function') {
|
||||||
return url.call(art).then(function (videoUrl) {
|
var result = url.call(art);
|
||||||
|
errorHandle(typeof result.then === 'function', 'If url is a function, it needs to return a promise.');
|
||||||
|
return result.then(function (videoUrl) {
|
||||||
art.loading.show();
|
art.loading.show();
|
||||||
return attachUrl(videoUrl);
|
return attachUrl(videoUrl);
|
||||||
});
|
});
|
||||||
@@ -3294,52 +3296,6 @@
|
|||||||
|
|
||||||
var objectSpread = _objectSpread;
|
var objectSpread = _objectSpread;
|
||||||
|
|
||||||
function _arrayWithHoles(arr) {
|
|
||||||
if (Array.isArray(arr)) return arr;
|
|
||||||
}
|
|
||||||
|
|
||||||
var arrayWithHoles = _arrayWithHoles;
|
|
||||||
|
|
||||||
function _iterableToArrayLimit(arr, i) {
|
|
||||||
var _arr = [];
|
|
||||||
var _n = true;
|
|
||||||
var _d = false;
|
|
||||||
var _e = undefined;
|
|
||||||
|
|
||||||
try {
|
|
||||||
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
|
|
||||||
_arr.push(_s.value);
|
|
||||||
|
|
||||||
if (i && _arr.length === i) break;
|
|
||||||
}
|
|
||||||
} catch (err) {
|
|
||||||
_d = true;
|
|
||||||
_e = err;
|
|
||||||
} finally {
|
|
||||||
try {
|
|
||||||
if (!_n && _i["return"] != null) _i["return"]();
|
|
||||||
} finally {
|
|
||||||
if (_d) throw _e;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return _arr;
|
|
||||||
}
|
|
||||||
|
|
||||||
var iterableToArrayLimit = _iterableToArrayLimit;
|
|
||||||
|
|
||||||
function _nonIterableRest() {
|
|
||||||
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
|
||||||
}
|
|
||||||
|
|
||||||
var nonIterableRest = _nonIterableRest;
|
|
||||||
|
|
||||||
function _slicedToArray(arr, i) {
|
|
||||||
return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || nonIterableRest();
|
|
||||||
}
|
|
||||||
|
|
||||||
var slicedToArray = _slicedToArray;
|
|
||||||
|
|
||||||
var loading = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"50px\" height=\"50px\" viewBox=\"0 0 100 100\" preserveAspectRatio=\"xMidYMid\" class=\"uil-default\">\n <rect x=\"0\" y=\"0\" width=\"100\" height=\"100\" fill=\"none\" class=\"bk\"/>\n <rect x=\"47\" y=\"40\" width=\"6\" height=\"20\" rx=\"5\" ry=\"5\" fill=\"#ffffff\" transform=\"rotate(0 50 50) translate(0 -30)\">\n <animate attributeName=\"opacity\" from=\"1\" to=\"0\" dur=\"1s\" begin=\"-1s\" repeatCount=\"indefinite\"/>\n </rect>\n <rect x=\"47\" y=\"40\" width=\"6\" height=\"20\" rx=\"5\" ry=\"5\" fill=\"#ffffff\" transform=\"rotate(30 50 50) translate(0 -30)\">\n <animate attributeName=\"opacity\" from=\"1\" to=\"0\" dur=\"1s\" begin=\"-0.9166666666666666s\" repeatCount=\"indefinite\"/>\n </rect>\n <rect x=\"47\" y=\"40\" width=\"6\" height=\"20\" rx=\"5\" ry=\"5\" fill=\"#ffffff\" transform=\"rotate(60 50 50) translate(0 -30)\">\n <animate attributeName=\"opacity\" from=\"1\" to=\"0\" dur=\"1s\" begin=\"-0.8333333333333334s\" repeatCount=\"indefinite\"/>\n </rect>\n <rect x=\"47\" y=\"40\" width=\"6\" height=\"20\" rx=\"5\" ry=\"5\" fill=\"#ffffff\" transform=\"rotate(90 50 50) translate(0 -30)\">\n <animate attributeName=\"opacity\" from=\"1\" to=\"0\" dur=\"1s\" begin=\"-0.75s\" repeatCount=\"indefinite\"/></rect>\n <rect x=\"47\" y=\"40\" width=\"6\" height=\"20\" rx=\"5\" ry=\"5\" fill=\"#ffffff\" transform=\"rotate(120 50 50) translate(0 -30)\">\n <animate attributeName=\"opacity\" from=\"1\" to=\"0\" dur=\"1s\" begin=\"-0.6666666666666666s\" repeatCount=\"indefinite\"/>\n </rect>\n <rect x=\"47\" y=\"40\" width=\"6\" height=\"20\" rx=\"5\" ry=\"5\" fill=\"#ffffff\" transform=\"rotate(150 50 50) translate(0 -30)\">\n <animate attributeName=\"opacity\" from=\"1\" to=\"0\" dur=\"1s\" begin=\"-0.5833333333333334s\" repeatCount=\"indefinite\"/>\n </rect>\n <rect x=\"47\" y=\"40\" width=\"6\" height=\"20\" rx=\"5\" ry=\"5\" fill=\"#ffffff\" transform=\"rotate(180 50 50) translate(0 -30)\">\n <animate attributeName=\"opacity\" from=\"1\" to=\"0\" dur=\"1s\" begin=\"-0.5s\" repeatCount=\"indefinite\"/></rect>\n <rect x=\"47\" y=\"40\" width=\"6\" height=\"20\" rx=\"5\" ry=\"5\" fill=\"#ffffff\" transform=\"rotate(210 50 50) translate(0 -30)\">\n <animate attributeName=\"opacity\" from=\"1\" to=\"0\" dur=\"1s\" begin=\"-0.4166666666666667s\" repeatCount=\"indefinite\"/>\n </rect>\n <rect x=\"47\" y=\"40\" width=\"6\" height=\"20\" rx=\"5\" ry=\"5\" fill=\"#ffffff\" transform=\"rotate(240 50 50) translate(0 -30)\">\n <animate attributeName=\"opacity\" from=\"1\" to=\"0\" dur=\"1s\" begin=\"-0.3333333333333333s\" repeatCount=\"indefinite\"/>\n </rect>\n <rect x=\"47\" y=\"40\" width=\"6\" height=\"20\" rx=\"5\" ry=\"5\" fill=\"#ffffff\" transform=\"rotate(270 50 50) translate(0 -30)\">\n <animate attributeName=\"opacity\" from=\"1\" to=\"0\" dur=\"1s\" begin=\"-0.25s\" repeatCount=\"indefinite\"/></rect>\n <rect x=\"47\" y=\"40\" width=\"6\" height=\"20\" rx=\"5\" ry=\"5\" fill=\"#ffffff\" transform=\"rotate(300 50 50) translate(0 -30)\">\n <animate attributeName=\"opacity\" from=\"1\" to=\"0\" dur=\"1s\" begin=\"-0.16666666666666666s\" repeatCount=\"indefinite\"/>\n </rect>\n <rect x=\"47\" y=\"40\" width=\"6\" height=\"20\" rx=\"5\" ry=\"5\" fill=\"#ffffff\" transform=\"rotate(330 50 50) translate(0 -30)\">\n <animate attributeName=\"opacity\" from=\"1\" to=\"0\" dur=\"1s\" begin=\"-0.08333333333333333s\" repeatCount=\"indefinite\"/>\n </rect>\n</svg>";
|
var loading = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"50px\" height=\"50px\" viewBox=\"0 0 100 100\" preserveAspectRatio=\"xMidYMid\" class=\"uil-default\">\n <rect x=\"0\" y=\"0\" width=\"100\" height=\"100\" fill=\"none\" class=\"bk\"/>\n <rect x=\"47\" y=\"40\" width=\"6\" height=\"20\" rx=\"5\" ry=\"5\" fill=\"#ffffff\" transform=\"rotate(0 50 50) translate(0 -30)\">\n <animate attributeName=\"opacity\" from=\"1\" to=\"0\" dur=\"1s\" begin=\"-1s\" repeatCount=\"indefinite\"/>\n </rect>\n <rect x=\"47\" y=\"40\" width=\"6\" height=\"20\" rx=\"5\" ry=\"5\" fill=\"#ffffff\" transform=\"rotate(30 50 50) translate(0 -30)\">\n <animate attributeName=\"opacity\" from=\"1\" to=\"0\" dur=\"1s\" begin=\"-0.9166666666666666s\" repeatCount=\"indefinite\"/>\n </rect>\n <rect x=\"47\" y=\"40\" width=\"6\" height=\"20\" rx=\"5\" ry=\"5\" fill=\"#ffffff\" transform=\"rotate(60 50 50) translate(0 -30)\">\n <animate attributeName=\"opacity\" from=\"1\" to=\"0\" dur=\"1s\" begin=\"-0.8333333333333334s\" repeatCount=\"indefinite\"/>\n </rect>\n <rect x=\"47\" y=\"40\" width=\"6\" height=\"20\" rx=\"5\" ry=\"5\" fill=\"#ffffff\" transform=\"rotate(90 50 50) translate(0 -30)\">\n <animate attributeName=\"opacity\" from=\"1\" to=\"0\" dur=\"1s\" begin=\"-0.75s\" repeatCount=\"indefinite\"/></rect>\n <rect x=\"47\" y=\"40\" width=\"6\" height=\"20\" rx=\"5\" ry=\"5\" fill=\"#ffffff\" transform=\"rotate(120 50 50) translate(0 -30)\">\n <animate attributeName=\"opacity\" from=\"1\" to=\"0\" dur=\"1s\" begin=\"-0.6666666666666666s\" repeatCount=\"indefinite\"/>\n </rect>\n <rect x=\"47\" y=\"40\" width=\"6\" height=\"20\" rx=\"5\" ry=\"5\" fill=\"#ffffff\" transform=\"rotate(150 50 50) translate(0 -30)\">\n <animate attributeName=\"opacity\" from=\"1\" to=\"0\" dur=\"1s\" begin=\"-0.5833333333333334s\" repeatCount=\"indefinite\"/>\n </rect>\n <rect x=\"47\" y=\"40\" width=\"6\" height=\"20\" rx=\"5\" ry=\"5\" fill=\"#ffffff\" transform=\"rotate(180 50 50) translate(0 -30)\">\n <animate attributeName=\"opacity\" from=\"1\" to=\"0\" dur=\"1s\" begin=\"-0.5s\" repeatCount=\"indefinite\"/></rect>\n <rect x=\"47\" y=\"40\" width=\"6\" height=\"20\" rx=\"5\" ry=\"5\" fill=\"#ffffff\" transform=\"rotate(210 50 50) translate(0 -30)\">\n <animate attributeName=\"opacity\" from=\"1\" to=\"0\" dur=\"1s\" begin=\"-0.4166666666666667s\" repeatCount=\"indefinite\"/>\n </rect>\n <rect x=\"47\" y=\"40\" width=\"6\" height=\"20\" rx=\"5\" ry=\"5\" fill=\"#ffffff\" transform=\"rotate(240 50 50) translate(0 -30)\">\n <animate attributeName=\"opacity\" from=\"1\" to=\"0\" dur=\"1s\" begin=\"-0.3333333333333333s\" repeatCount=\"indefinite\"/>\n </rect>\n <rect x=\"47\" y=\"40\" width=\"6\" height=\"20\" rx=\"5\" ry=\"5\" fill=\"#ffffff\" transform=\"rotate(270 50 50) translate(0 -30)\">\n <animate attributeName=\"opacity\" from=\"1\" to=\"0\" dur=\"1s\" begin=\"-0.25s\" repeatCount=\"indefinite\"/></rect>\n <rect x=\"47\" y=\"40\" width=\"6\" height=\"20\" rx=\"5\" ry=\"5\" fill=\"#ffffff\" transform=\"rotate(300 50 50) translate(0 -30)\">\n <animate attributeName=\"opacity\" from=\"1\" to=\"0\" dur=\"1s\" begin=\"-0.16666666666666666s\" repeatCount=\"indefinite\"/>\n </rect>\n <rect x=\"47\" y=\"40\" width=\"6\" height=\"20\" rx=\"5\" ry=\"5\" fill=\"#ffffff\" transform=\"rotate(330 50 50) translate(0 -30)\">\n <animate attributeName=\"opacity\" from=\"1\" to=\"0\" dur=\"1s\" begin=\"-0.08333333333333333s\" repeatCount=\"indefinite\"/>\n </rect>\n</svg>";
|
||||||
|
|
||||||
var playBig = "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"60\" width=\"60\" style=\"filter: drop-shadow(0px 1px 1px black);\" viewBox=\"0 0 24 24\">\n <path d=\"M20,2H4C1.8,2,0,3.8,0,6v12c0,2.2,1.8,4,4,4h16c2.2,0,4-1.8,4-4V6C24,3.8,22.2,2,20,2z M15.6,12.8L10.5,16 C9.9,16.5,9,16,9,15.2V8.8C9,8,9.9,7.5,10.5,8l5.1,3.2C16.3,11.5,16.3,12.5,15.6,12.8z\"/>\n</svg>";
|
var playBig = "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"60\" width=\"60\" style=\"filter: drop-shadow(0px 1px 1px black);\" viewBox=\"0 0 24 24\">\n <path d=\"M20,2H4C1.8,2,0,3.8,0,6v12c0,2.2,1.8,4,4,4h16c2.2,0,4-1.8,4-4V6C24,3.8,22.2,2,20,2z M15.6,12.8L10.5,16 C9.9,16.5,9,16,9,15.2V8.8C9,8,9.9,7.5,10.5,8l5.1,3.2C16.3,11.5,16.3,12.5,15.6,12.8z\"/>\n</svg>";
|
||||||
@@ -3368,20 +3324,8 @@
|
|||||||
|
|
||||||
var next = "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"36\" width=\"36\" viewBox=\"0 0 36 36\">\n <path d=\"M 12,24 20.5,18 12,12 V 24 z M 22,12 v 12 h 2 V 12 h -2 z\"></path>\n</svg>";
|
var next = "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"36\" width=\"36\" viewBox=\"0 0 36 36\">\n <path d=\"M 12,24 20.5,18 12,12 V 24 z M 22,12 v 12 h 2 V 12 h -2 z\"></path>\n</svg>";
|
||||||
|
|
||||||
function creatDomFromSvg(map) {
|
var icons = {};
|
||||||
var result = {};
|
var svgs = {
|
||||||
Object.keys(map).forEach(function (name) {
|
|
||||||
var tmp = document.createElement('div');
|
|
||||||
tmp.innerHTML = "<i class=\"art-icon art-icon-".concat(name, "\">").concat(map[name], "</i>");
|
|
||||||
|
|
||||||
var _tmp$childNodes = slicedToArray(tmp.childNodes, 1);
|
|
||||||
|
|
||||||
result[name] = _tmp$childNodes[0];
|
|
||||||
});
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
var icons = creatDomFromSvg({
|
|
||||||
loading: loading,
|
loading: loading,
|
||||||
playBig: playBig,
|
playBig: playBig,
|
||||||
play: play,
|
play: play,
|
||||||
@@ -3396,6 +3340,15 @@
|
|||||||
pip: pip,
|
pip: pip,
|
||||||
prev: prev,
|
prev: prev,
|
||||||
next: next
|
next: next
|
||||||
|
};
|
||||||
|
Object.keys(svgs).forEach(function (key) {
|
||||||
|
Object.defineProperty(icons, key, {
|
||||||
|
get: function get() {
|
||||||
|
var tmp = document.createElement('div');
|
||||||
|
tmp.innerHTML = "<i class=\"art-icon art-icon-".concat(key, "\">").concat(svgs[key], "</i>");
|
||||||
|
return tmp.childNodes[0];
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function fullscreen$1(controlOption) {
|
function fullscreen$1(controlOption) {
|
||||||
@@ -4116,7 +4069,7 @@
|
|||||||
|
|
||||||
function version(menuOption) {
|
function version(menuOption) {
|
||||||
return objectSpread({}, menuOption, {
|
return objectSpread({}, menuOption, {
|
||||||
html: '<a href="https://github.com/zhw2590582/artplayer" target="_blank">ArtPlayer 1.0.6</a>'
|
html: '<a href="https://github.com/zhw2590582/artplayer" target="_blank">ArtPlayer 3.1.5</a>'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4298,7 +4251,7 @@
|
|||||||
key: "creatInfo",
|
key: "creatInfo",
|
||||||
value: function creatInfo() {
|
value: function creatInfo() {
|
||||||
var infoHtml = [];
|
var infoHtml = [];
|
||||||
infoHtml.push("\n <div class=\"art-info-item \">\n <div class=\"art-info-title\">Player version:</div>\n <div class=\"art-info-content\">1.0.6</div>\n </div>\n ");
|
infoHtml.push("\n <div class=\"art-info-item \">\n <div class=\"art-info-title\">Player version:</div>\n <div class=\"art-info-content\">3.1.5</div>\n </div>\n ");
|
||||||
infoHtml.push("\n <div class=\"art-info-item\">\n <div class=\"art-info-title\">Video url:</div>\n <div class=\"art-info-content\">".concat(this.art.option.url, "</div>\n </div>\n "));
|
infoHtml.push("\n <div class=\"art-info-item\">\n <div class=\"art-info-title\">Video url:</div>\n <div class=\"art-info-content\">".concat(this.art.option.url, "</div>\n </div>\n "));
|
||||||
infoHtml.push("\n <div class=\"art-info-item\">\n <div class=\"art-info-title\">Video volume:</div>\n <div class=\"art-info-content\" data-video=\"volume\"></div>\n </div>\n ");
|
infoHtml.push("\n <div class=\"art-info-item\">\n <div class=\"art-info-title\">Video volume:</div>\n <div class=\"art-info-content\" data-video=\"volume\"></div>\n </div>\n ");
|
||||||
infoHtml.push("\n <div class=\"art-info-item\">\n <div class=\"art-info-title\">Video time:</div>\n <div class=\"art-info-content\" data-video=\"currentTime\"></div>\n </div>\n ");
|
infoHtml.push("\n <div class=\"art-info-item\">\n <div class=\"art-info-title\">Video time:</div>\n <div class=\"art-info-content\" data-video=\"currentTime\"></div>\n </div>\n ");
|
||||||
@@ -4343,6 +4296,52 @@
|
|||||||
return Info;
|
return Info;
|
||||||
}();
|
}();
|
||||||
|
|
||||||
|
function _arrayWithHoles(arr) {
|
||||||
|
if (Array.isArray(arr)) return arr;
|
||||||
|
}
|
||||||
|
|
||||||
|
var arrayWithHoles = _arrayWithHoles;
|
||||||
|
|
||||||
|
function _iterableToArrayLimit(arr, i) {
|
||||||
|
var _arr = [];
|
||||||
|
var _n = true;
|
||||||
|
var _d = false;
|
||||||
|
var _e = undefined;
|
||||||
|
|
||||||
|
try {
|
||||||
|
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
|
||||||
|
_arr.push(_s.value);
|
||||||
|
|
||||||
|
if (i && _arr.length === i) break;
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
_d = true;
|
||||||
|
_e = err;
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
if (!_n && _i["return"] != null) _i["return"]();
|
||||||
|
} finally {
|
||||||
|
if (_d) throw _e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return _arr;
|
||||||
|
}
|
||||||
|
|
||||||
|
var iterableToArrayLimit = _iterableToArrayLimit;
|
||||||
|
|
||||||
|
function _nonIterableRest() {
|
||||||
|
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
||||||
|
}
|
||||||
|
|
||||||
|
var nonIterableRest = _nonIterableRest;
|
||||||
|
|
||||||
|
function _slicedToArray(arr, i) {
|
||||||
|
return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || nonIterableRest();
|
||||||
|
}
|
||||||
|
|
||||||
|
var slicedToArray = _slicedToArray;
|
||||||
|
|
||||||
var Subtitle =
|
var Subtitle =
|
||||||
/*#__PURE__*/
|
/*#__PURE__*/
|
||||||
function () {
|
function () {
|
||||||
@@ -5552,7 +5551,7 @@
|
|||||||
}], [{
|
}], [{
|
||||||
key: "version",
|
key: "version",
|
||||||
get: function get() {
|
get: function get() {
|
||||||
return '1.0.6';
|
return '3.1.5';
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
key: "env",
|
key: "env",
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"artplayer.js","sources":["../../node_modules/@babel/runtime/helpers/classCallCheck.js","../../node_modules/@babel/runtime/helpers/createClass.js","../../node_modules/@babel/runtime/helpers/typeof.js","../../node_modules/@babel/runtime/helpers/assertThisInitialized.js","../../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js","../../node_modules/@babel/runtime/helpers/getPrototypeOf.js","../../node_modules/@babel/runtime/helpers/setPrototypeOf.js","../../node_modules/@babel/runtime/helpers/inherits.js","../../packages/artplayer/node_modules/tiny-emitter/index.js","../../packages/artplayer/node_modules/option-validator/dist/option-validator.js","../../node_modules/@babel/runtime/helpers/defineProperty.js","../../node_modules/@babel/runtime/helpers/isNativeFunction.js","../../node_modules/@babel/runtime/helpers/construct.js","../../node_modules/@babel/runtime/helpers/wrapNativeSuper.js","../../packages/artplayer/src/utils/index.js","../../packages/artplayer/src/scheme/validElement.js","../../packages/artplayer/src/scheme/index.js","../../packages/artplayer/src/config/mimeCodec.js","../../packages/artplayer/src/config/mse.js","../../packages/artplayer/src/config/video.js","../../packages/artplayer/src/config/index.js","../../packages/artplayer/src/whitelist.js","../../packages/artplayer/src/template.js","../../packages/artplayer/src/i18n.js","../../packages/artplayer/src/player/attachUrlMix.js","../../packages/artplayer/src/player/attrInit.js","../../packages/artplayer/src/player/eventInit.js","../../packages/artplayer/src/player/playMix.js","../../packages/artplayer/src/player/pauseMin.js","../../packages/artplayer/src/player/toggleMix.js","../../packages/artplayer/src/player/seekMix.js","../../packages/artplayer/src/player/volumeMix.js","../../packages/artplayer/src/player/currentTimeMix.js","../../packages/artplayer/src/player/durationMix.js","../../packages/artplayer/src/player/switchQualityMix.js","../../packages/artplayer/src/player/playbackRateMix.js","../../packages/artplayer/src/player/aspectRatioMix.js","../../packages/artplayer/src/player/screenshotMix.js","../../packages/artplayer/node_modules/screenfull/dist/screenfull.js","../../packages/artplayer/src/player/fullscreenMix.js","../../packages/artplayer/src/player/fullscreenWebMix.js","../../packages/artplayer/node_modules/get-size/get-size.js","../../packages/artplayer/node_modules/ev-emitter/ev-emitter.js","../../packages/artplayer/node_modules/unipointer/unipointer.js","../../packages/artplayer/node_modules/unidragger/unidragger.js","../../packages/artplayer/node_modules/draggabilly/draggabilly.js","../../packages/artplayer/src/player/pipMix.js","../../packages/artplayer/src/player/loadedMix.js","../../packages/artplayer/src/player/playedMix.js","../../packages/artplayer/src/player/playingMix.js","../../packages/artplayer/src/player/autoSizeMix.js","../../packages/artplayer/src/player/flipMix.js","../../packages/artplayer/src/player/index.js","../../packages/artplayer/src/utils/component.js","../../node_modules/@babel/runtime/helpers/objectSpread.js","../../node_modules/@babel/runtime/helpers/arrayWithHoles.js","../../node_modules/@babel/runtime/helpers/iterableToArrayLimit.js","../../node_modules/@babel/runtime/helpers/nonIterableRest.js","../../node_modules/@babel/runtime/helpers/slicedToArray.js","../../packages/artplayer/src/icons/index.js","../../packages/artplayer/src/controls/fullscreen.js","../../packages/artplayer/src/controls/fullscreenWeb.js","../../packages/artplayer/src/controls/pip.js","../../packages/artplayer/src/controls/playAndPause.js","../../packages/artplayer/src/controls/progress.js","../../packages/artplayer/src/controls/subtitle.js","../../packages/artplayer/src/controls/time.js","../../packages/artplayer/src/controls/volume.js","../../packages/artplayer/src/controls/setting.js","../../packages/artplayer/src/controls/thumbnails.js","../../packages/artplayer/src/controls/screenshot.js","../../packages/artplayer/src/controls/quality.js","../../packages/artplayer/src/controls/index.js","../../packages/artplayer/src/contextmenu/playbackRate.js","../../packages/artplayer/src/contextmenu/aspectRatio.js","../../packages/artplayer/src/contextmenu/info.js","../../packages/artplayer/src/contextmenu/version.js","../../packages/artplayer/src/contextmenu/close.js","../../packages/artplayer/src/contextmenu/index.js","../../packages/artplayer/src/info.js","../../packages/artplayer/src/subtitle.js","../../packages/artplayer/src/events/clickInit.js","../../packages/artplayer/src/events/hoverInit.js","../../packages/artplayer/src/events/mousemoveInit.js","../../packages/artplayer/node_modules/resize-observer/lib/ContentRect.js","../../packages/artplayer/node_modules/resize-observer/lib/ResizeObservation.js","../../packages/artplayer/node_modules/resize-observer/lib/ResizeObserverEntry.js","../../packages/artplayer/node_modules/resize-observer/lib/ResizeObserver.js","../../packages/artplayer/src/events/reLine truncated
|
{"version":3,"file":"artplayer.js","sources":["../../node_modules/@babel/runtime/helpers/classCallCheck.js","../../node_modules/@babel/runtime/helpers/createClass.js","../../node_modules/@babel/runtime/helpers/typeof.js","../../node_modules/@babel/runtime/helpers/assertThisInitialized.js","../../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js","../../node_modules/@babel/runtime/helpers/getPrototypeOf.js","../../node_modules/@babel/runtime/helpers/setPrototypeOf.js","../../node_modules/@babel/runtime/helpers/inherits.js","../../packages/artplayer/node_modules/tiny-emitter/index.js","../../packages/artplayer/node_modules/option-validator/dist/option-validator.js","../../node_modules/@babel/runtime/helpers/defineProperty.js","../../node_modules/@babel/runtime/helpers/isNativeFunction.js","../../node_modules/@babel/runtime/helpers/construct.js","../../node_modules/@babel/runtime/helpers/wrapNativeSuper.js","../../packages/artplayer/src/utils/index.js","../../packages/artplayer/src/scheme/validElement.js","../../packages/artplayer/src/scheme/index.js","../../packages/artplayer/src/config/mimeCodec.js","../../packages/artplayer/src/config/mse.js","../../packages/artplayer/src/config/video.js","../../packages/artplayer/src/config/index.js","../../packages/artplayer/src/whitelist.js","../../packages/artplayer/src/template.js","../../packages/artplayer/src/i18n.js","../../packages/artplayer/src/player/attachUrlMix.js","../../packages/artplayer/src/player/attrInit.js","../../packages/artplayer/src/player/eventInit.js","../../packages/artplayer/src/player/playMix.js","../../packages/artplayer/src/player/pauseMin.js","../../packages/artplayer/src/player/toggleMix.js","../../packages/artplayer/src/player/seekMix.js","../../packages/artplayer/src/player/volumeMix.js","../../packages/artplayer/src/player/currentTimeMix.js","../../packages/artplayer/src/player/durationMix.js","../../packages/artplayer/src/player/switchQualityMix.js","../../packages/artplayer/src/player/playbackRateMix.js","../../packages/artplayer/src/player/aspectRatioMix.js","../../packages/artplayer/src/player/screenshotMix.js","../../packages/artplayer/node_modules/screenfull/dist/screenfull.js","../../packages/artplayer/src/player/fullscreenMix.js","../../packages/artplayer/src/player/fullscreenWebMix.js","../../packages/artplayer/node_modules/get-size/get-size.js","../../packages/artplayer/node_modules/ev-emitter/ev-emitter.js","../../packages/artplayer/node_modules/unipointer/unipointer.js","../../packages/artplayer/node_modules/unidragger/unidragger.js","../../packages/artplayer/node_modules/draggabilly/draggabilly.js","../../packages/artplayer/src/player/pipMix.js","../../packages/artplayer/src/player/loadedMix.js","../../packages/artplayer/src/player/playedMix.js","../../packages/artplayer/src/player/playingMix.js","../../packages/artplayer/src/player/autoSizeMix.js","../../packages/artplayer/src/player/flipMix.js","../../packages/artplayer/src/player/index.js","../../packages/artplayer/src/utils/component.js","../../node_modules/@babel/runtime/helpers/objectSpread.js","../../packages/artplayer/src/icons/index.js","../../packages/artplayer/src/controls/fullscreen.js","../../packages/artplayer/src/controls/fullscreenWeb.js","../../packages/artplayer/src/controls/pip.js","../../packages/artplayer/src/controls/playAndPause.js","../../packages/artplayer/src/controls/progress.js","../../packages/artplayer/src/controls/subtitle.js","../../packages/artplayer/src/controls/time.js","../../packages/artplayer/src/controls/volume.js","../../packages/artplayer/src/controls/setting.js","../../packages/artplayer/src/controls/thumbnails.js","../../packages/artplayer/src/controls/screenshot.js","../../packages/artplayer/src/controls/quality.js","../../packages/artplayer/src/controls/index.js","../../packages/artplayer/src/contextmenu/playbackRate.js","../../packages/artplayer/src/contextmenu/aspectRatio.js","../../packages/artplayer/src/contextmenu/info.js","../../packages/artplayer/src/contextmenu/version.js","../../packages/artplayer/src/contextmenu/close.js","../../packages/artplayer/src/contextmenu/index.js","../../packages/artplayer/src/info.js","../../node_modules/@babel/runtime/helpers/arrayWithHoles.js","../../node_modules/@babel/runtime/helpers/iterableToArrayLimit.js","../../node_modules/@babel/runtime/helpers/nonIterableRest.js","../../node_modules/@babel/runtime/helpers/slicedToArray.js","../../packages/artplayer/src/subtitle.js","../../packages/artplayer/src/events/clickInit.js","../../packages/artplayer/src/events/hoverInit.js","../../packages/artplayer/src/events/mousemoveInit.js","../../packages/artplayer/node_modules/resize-observer/lib/ContentRect.js","../../packages/artplayer/node_modules/resize-observer/lib/ResizeObservation.js","../../packages/artplayer/node_modules/resize-observer/lib/ResizeObserverEntry.js","../../packages/artplayer/node_modules/resize-observer/lib/ResizeObserver.js","../../packages/artplayer/src/events/reLine truncated
|
||||||
@@ -13,17 +13,8 @@ import pip from './pip.svg';
|
|||||||
import prev from './prev.svg';
|
import prev from './prev.svg';
|
||||||
import next from './next.svg';
|
import next from './next.svg';
|
||||||
|
|
||||||
function creatDomFromSvg(map) {
|
const icons = {};
|
||||||
const result = {};
|
const svgs = {
|
||||||
Object.keys(map).forEach(name => {
|
|
||||||
const tmp = document.createElement('div');
|
|
||||||
tmp.innerHTML = `<i class="art-icon art-icon-${name}">${map[name]}</i>`;
|
|
||||||
[result[name]] = tmp.childNodes;
|
|
||||||
});
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
export default creatDomFromSvg({
|
|
||||||
loading,
|
loading,
|
||||||
playBig,
|
playBig,
|
||||||
play,
|
play,
|
||||||
@@ -38,4 +29,16 @@ export default creatDomFromSvg({
|
|||||||
pip,
|
pip,
|
||||||
prev,
|
prev,
|
||||||
next,
|
next,
|
||||||
|
};
|
||||||
|
|
||||||
|
Object.keys(svgs).forEach(key => {
|
||||||
|
Object.defineProperty(icons, key, {
|
||||||
|
get() {
|
||||||
|
const tmp = document.createElement('div');
|
||||||
|
tmp.innerHTML = `<i class="art-icon art-icon-${key}">${svgs[key]}</i>`;
|
||||||
|
return tmp.childNodes[0];
|
||||||
|
},
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export default icons;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import { getExt, sleep } from '../utils';
|
import { getExt, sleep, errorHandle } from '../utils';
|
||||||
|
|
||||||
export default function attachUrlMix(art, player) {
|
export default function attachUrlMix(art, player) {
|
||||||
const {
|
const {
|
||||||
@@ -7,31 +7,37 @@ export default function attachUrlMix(art, player) {
|
|||||||
} = art;
|
} = art;
|
||||||
|
|
||||||
Object.defineProperty(player, 'attachUrl', {
|
Object.defineProperty(player, 'attachUrl', {
|
||||||
value: url => sleep().then(() => {
|
value: url =>
|
||||||
function attachUrl(videoUrl) {
|
sleep().then(() => {
|
||||||
const typeName = type || getExt(videoUrl);
|
function attachUrl(videoUrl) {
|
||||||
const typeCallback = customType[typeName];
|
const typeName = type || getExt(videoUrl);
|
||||||
if (typeName && typeCallback) {
|
const typeCallback = customType[typeName];
|
||||||
art.loading.show();
|
if (typeName && typeCallback) {
|
||||||
art.emit('beforeCustomType', typeName);
|
art.loading.show();
|
||||||
typeCallback.call(art, $video, videoUrl, art);
|
art.emit('beforeCustomType', typeName);
|
||||||
art.emit('afterCustomType', typeName);
|
typeCallback.call(art, $video, videoUrl, art);
|
||||||
} else {
|
art.emit('afterCustomType', typeName);
|
||||||
art.emit('beforeAttachUrl');
|
} else {
|
||||||
$video.src = videoUrl;
|
art.emit('beforeAttachUrl');
|
||||||
art.emit('afterAttachUrl');
|
$video.src = videoUrl;
|
||||||
|
art.emit('afterAttachUrl');
|
||||||
|
}
|
||||||
|
return Promise.resolve(videoUrl);
|
||||||
}
|
}
|
||||||
return Promise.resolve(videoUrl);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof url === 'function') {
|
if (typeof url === 'function') {
|
||||||
return url.call(art).then(videoUrl => {
|
const result = url.call(art);
|
||||||
art.loading.show();
|
errorHandle(
|
||||||
return attachUrl(videoUrl);
|
typeof result.then === 'function',
|
||||||
});
|
'If url is a function, it needs to return a promise.',
|
||||||
}
|
);
|
||||||
|
return result.then(videoUrl => {
|
||||||
|
art.loading.show();
|
||||||
|
return attachUrl(videoUrl);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return attachUrl(url);
|
return attachUrl(url);
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
describe('Constructor', function() {
|
||||||
|
it('Constructor is a global variable', function() {
|
||||||
|
expect(Artplayer).to.be.an('function');
|
||||||
|
expect(Artplayer.instances).to.be.an('array');
|
||||||
|
expect(Artplayer.instances.length).to.be.equal(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Instance state', function() {
|
||||||
|
var sample1 = new Artplayer({ ...artBaseOption, container: '.sample1' });
|
||||||
|
expect(sample1.id).to.equal(1);
|
||||||
|
var sample2 = new Artplayer({ ...artBaseOption, container: '.sample2' });
|
||||||
|
expect(sample2.id).to.equal(2);
|
||||||
|
var sample3 = new Artplayer({ ...artBaseOption, container: '.sample3' });
|
||||||
|
expect(sample3.id).to.equal(3);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Throw error when multiple instances on the same dom element', function() {
|
||||||
|
expect(function() {
|
||||||
|
new Artplayer({ ...artBaseOption, container: '.sample1' });
|
||||||
|
}).to.throw(/Cannot mount multiple instances on the same dom element/);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Throw error when container is not a dom element or selector', function() {
|
||||||
|
expect(function() {
|
||||||
|
new Artplayer(
|
||||||
|
Object.assign({}, artBaseOption, {
|
||||||
|
container: null,
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}).to.throw(/option.container require \'string\' or \'Element\' type, but got \'null\'/);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Destroy all instances', function() {
|
||||||
|
expect(Artplayer.instances.length).to.equal(3);
|
||||||
|
[...Artplayer.instances].forEach(art => {
|
||||||
|
art.destroy(true);
|
||||||
|
});
|
||||||
|
expect(Artplayer.instances.length).to.equal(0);
|
||||||
|
});
|
||||||
|
});
|
||||||
+22
-7
@@ -6,25 +6,40 @@
|
|||||||
<link href="../dist/artplayer.css" rel="stylesheet" />
|
<link href="../dist/artplayer.css" rel="stylesheet" />
|
||||||
<style>
|
<style>
|
||||||
.artplayer-app {
|
.artplayer-app {
|
||||||
width: 400px;
|
display: flex;
|
||||||
height: 300px;
|
height: 300px;
|
||||||
margin: 20px auto;
|
border-bottom: 1px solid #999;
|
||||||
opacity: 0.1;
|
}
|
||||||
background: #000;
|
|
||||||
|
.artplayer-app > div {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
flex: 1;
|
||||||
|
padding: 10px;
|
||||||
|
border-right: 1px solid #999;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="artplayer-app"></div>
|
<div class="artplayer-app">
|
||||||
|
<div class="sample1">sample1</div>
|
||||||
|
<div class="sample2">sample2</div>
|
||||||
|
<div class="sample3">sample3</div>
|
||||||
|
</div>
|
||||||
<div id="mocha"></div>
|
<div id="mocha"></div>
|
||||||
<script src="https://unpkg.com/chai/chai.js"></script>
|
<script src="https://unpkg.com/chai/chai.js"></script>
|
||||||
<script src="https://unpkg.com/mocha@5.2.0/mocha.js"></script>
|
<script src="https://unpkg.com/mocha@5.2.0/mocha.js"></script>
|
||||||
<script>
|
<script>
|
||||||
window.mocha.setup('bdd');
|
window.mocha.setup('bdd');
|
||||||
window.expect = window.chai.expect;
|
window.expect = window.chai.expect;
|
||||||
|
window.artBaseOption = {
|
||||||
|
url: 'https://blog.zhw-island.com/assets-cdn/video/one-more-time-one-more-chance-480p.mp4',
|
||||||
|
autoSize: true,
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
<script src="../dist/artplayer.js"></script>
|
<script src="../docs/uncompiled/artplayer.js"></script>
|
||||||
<script src="./index.test.js"></script>
|
<script src="./constructor.test.js"></script>
|
||||||
<script>
|
<script>
|
||||||
mocha.checkLeaks();
|
mocha.checkLeaks();
|
||||||
mocha.run();
|
mocha.run();
|
||||||
|
|||||||
@@ -1,31 +0,0 @@
|
|||||||
var artBaseOption = {
|
|
||||||
container: document.querySelector('.artplayer-app'),
|
|
||||||
url: 'https://blog.zhw-island.com/assets-cdn/video/one-more-time-one-more-chance-480p.mp4',
|
|
||||||
};
|
|
||||||
|
|
||||||
describe('Detect registration status', function() {
|
|
||||||
it('Constructor is a global variable', function() {
|
|
||||||
expect(Artplayer).to.be.an('function');
|
|
||||||
expect(Artplayer.instances).to.be.an('array');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Instance state', function() {
|
|
||||||
var art = new Artplayer(artBaseOption);
|
|
||||||
expect(art).to.be.an('object');
|
|
||||||
expect(art.id).to.equal(1);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Throw error when multiple instances on the same dom element', function() {
|
|
||||||
expect(function() {
|
|
||||||
new Artplayer(artBaseOption);
|
|
||||||
}).to.throw(/Cannot mount multiple instances on the same dom element/);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Destroy all instances', function() {
|
|
||||||
expect(Artplayer.instances.length).to.equal(1);
|
|
||||||
Artplayer.instances.forEach(art => {
|
|
||||||
art.destroy(true);
|
|
||||||
});
|
|
||||||
expect(Artplayer.instances.length).to.equal(0);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
Reference in new issue
Block a user