mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-10 12:46:15 -08:00
移除播放列表插件
This commit is contained in:
1 parent
4722226658
commit
904e214727
18 files changed
+3
-429
No files matched your search
Vendored
-1
@@ -1 +0,0 @@
|
||||
.art-video-player .art-playlist{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;position:absolute;z-index:120;left:0;top:0;height:100%;width:100%;opacity:0;visibility:hidden;pointer-events:none;overflow:hidden}.art-video-player .art-playlist .art-playlist-inner{position:absolute;top:0;right:-300px;bottom:0;width:300px;height:100%;font-size:12px;background:rgba(0,0,0,.8);-webkit-transition:all .2s ease-in-out;transition:all .2s ease-in-out;overflow:auto}.art-video-player .art-playlist .art-playlist-inner .art-playlist-item{cursor:pointer;border-bottom:1px solid hsla(0,0%,100%,.1);padding:12px 20px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.art-video-player .art-playlist .art-playlist-inner .art-playlist-item.active,.art-video-player .art-playlist .art-playlist-inner .art-playlist-item:hover{color:#00a1d6;background:hsla(0,0%,100%,.1)}.art-video-player.art-playlist-show .art-playlist{opacity:1;visibility:visible;pointer-events:auto}.art-video-player.art-playlist-show .art-playlist .art-playlist-inner{right:0}
|
||||
Vendored
-8
@@ -1,8 +0,0 @@
|
||||
/*!
|
||||
* artplayer-plugin-playlist.js v3.2.4
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer#readme
|
||||
* (c) 2017-2019 Harvey Zack
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
|
||||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(t=t||self).artplayerPluginPlaylist=n()}(this,(function(){"use strict";return function(t){return function(n){var e=n.constructor.utils,i=e.append,r=e.errorHandle,a=e.sleep,l=e.inverseClass,o=n.player,s=n.events.proxy,u=n.template,c=u.$player,f=u.$video,d=i(c,'<div class="art-playlist"><div class="art-playlist-inner art-backdrop-filter"></div></div>');r(Array.isArray(t),"Playlist is not an array type"),r(t.length>0,"Playlist cannot be empty");var y=t.map((function(t){return r(t.url,"Playlist items require url attribute"),r(t.title,"Playlist items require title attribute"),t})),p=d.querySelector(".art-playlist-inner");function v(t){var e=y[t],i=o.playing;return o.switchUrl(e.url,e.title).then((function(){i&&(o.play=!0),n.emit("artplayerPluginPlaylist:change",e)}))}function h(){var t=y.findIndex((function(t){return t.url===f.src}));return r(-1!==t,"Can't find Playlist item"),1===y.length?v(0):v(t+1===y.length?0:t+1)}return p.innerHTML=y.map((function(t,n){return'<div class="art-playlist-item" data-option-index="'.concat(n,'">').concat(t.title,"</div>")})).join(""),s(p,"click",(function(t){var n=t.target.dataset.optionIndex;n&&Number(n)<=y.length-1&&v(n)})),s(d,"click",(function(t){t.target===d&&c.classList.remove("art-playlist-show")})),n.on("video:ended",(function(){h().then((function(){a(1e3).then((function(){o.play=!0}))}))})),n.on("afterAttachUrl",(function(){var t=y.findIndex((function(t){return t.url===f.src})),n=Array.from(p.children)[t];-1!==t&&n&&l(n,"active")})),{name:"artplayerPluginPlaylist",show:function(){c.classList.add("art-playlist-show")},hide:function(){c.classList.remove("art-playlist-show")},next:function(){h()},prev:function(){var t;t=y.findIndex((function(t){return t.url===f.src})),r(-1!==t,"Can't find Playlist item"),1===y.length?v(0):v(t-1==-1?y.length-1:t-1)}}}}}));
|
||||
@@ -37,9 +37,6 @@
|
||||
<li>
|
||||
<a href="./?libs=.%2Funcompiled%2Fartplayer-plugin-danmuku.js&example=danmuku">artplayer-plugin-danmuku</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="./?libs=.%2Funcompiled%2Fartplayer-plugin-playlist.js%0A.%2Funcompiled%2Fartplayer-plugin-playlist.css&example=playlist">artplayer-plugin-playlist</a>
|
||||
</li>
|
||||
</ul>
|
||||
<ul>
|
||||
<li class="title">Tools</li>
|
||||
|
||||
@@ -2920,7 +2920,7 @@
|
||||
position: 'absolute',
|
||||
top: '0',
|
||||
left: '0',
|
||||
height: '3px',
|
||||
height: '2px',
|
||||
width: '0%',
|
||||
'background-color': theme
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"artplayer-plugin-gif.js","sources":["../../node_modules/_@babel_runtime@7.7.4@@babel/runtime/helpers/defineProperty.js","../../packages/artplayer-plugin-gif/node_modules/gifshot/dist/gifshot.js","../../packages/artplayer-plugin-gif/node_modules/b64-to-blob/b64toBlob.js","../../packages/artplayer-plugin-gif/src/index.js"],"sourcesContent":["function _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nmodule.exports = _defineProperty;","/*Copyrights for code authored by Yahoo Inc. is licensed under the following terms:\nMIT License\nCopyright 2017 Yahoo Inc.\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n*/\n;(function(window, document, navigator, undefined) {\n\"use strict\";\n\n/*\n utils.js\n ========\n*/\n\n/* Copyright 2017 Yahoo Inc.\n * Copyrights licensed under the MIT License. See the accompanying LICENSE file for terms.\n*/\n\nvar utils = {\n URL: window.URL || window.webkitURL || window.mozURL || window.msURL,\n getUserMedia: function () {\n var getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia;\n\n return getUserMedia ? getUserMedia.bind(navigator) : getUserMedia;\n }(),\n requestAnimFrame: window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame,\n requestTimeout: function requestTimeout(callback, delay) {\n callback = callback || utils.noop;\n delay = delay || 0;\n\n if (!utils.requestAnimFrame) {\n return setTimeout(callback, delay);\n }\n\n var start = new Date().getTime();\n var handle = new Object();\n var requestAnimFrame = utils.requestAnimFrame;\n\n var loop = function loop() {\n var current = new Date().getTime();\n var delta = current - start;\n\n delta >= delay ? callback.call() : handle.value = requestAnimFrame(loop);\n };\n\n handle.value = requestAnimFrame(loop);\n\n return handle;\n },\n Blob: window.Blob || window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder || window.MSBlobBuilder,\n btoa: function () {\n var btoa = window.btoa || function (input) {\n var output = '';\n var i = 0;\n var l = input.length;\n var key = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';\n var chr1 = void 0;\n var chr2 = void 0;\n var chr3 = void 0;\n var enc1 = void 0;\n var enc2 = void 0;\n var enc3 = void 0;\n var enc4 = void 0;\n\n while (i < l) {\n chr1 = input.charCodeAt(i++);\n chr2 = input.charCodeAt(i++);\n chr3 = input.charCodeAt(i++);\n enc1 = chr1 >> 2;\n enc2 = (chr1 & 3) << 4 | chr2 >> 4;\n enc3 = (chr2 & 15) << 2 | chr3 >> 6;\n enc4 = chr3 & 63;\n\n if (isNaN(chr2)) {\n enc3 = enc4 = 64;\n } else if (isNaN(chr3)) {\n enc4 = 64;\n }\n\n output = output + key.charAt(enc1) + key.charAt(enc2) + key.charAt(enc3) + key.charAt(enc4);\n }\n\n return output;\n };\n\n return btoa ? btoa.bind(window) : utils.noop;\n }(),\n isObject: function isObject(obj) {\n return obj && Object.prototype.toString.call(obj) === '[object Object]';\n },\n isEmptyObject: function isEmptyObject(obj) {\n return utils.isObject(obj) && !Object.keys(obj).length;\n },\n isArray: function isArray(arr) {\n return arr && Array.isArray(arr);\n Line truncated
|
||||
{"version":3,"file":"artplayer-plugin-gif.js","sources":["../../node_modules/_@babel_runtime@7.7.4@@babel/runtime/helpers/defineProperty.js","../../packages/artplayer-plugin-gif/node_modules/gifshot/dist/gifshot.js","../../packages/artplayer-plugin-gif/node_modules/b64-to-blob/b64toBlob.js","../../packages/artplayer-plugin-gif/src/index.js"],"sourcesContent":["function _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nmodule.exports = _defineProperty;","/*Copyrights for code authored by Yahoo Inc. is licensed under the following terms:\nMIT License\nCopyright 2017 Yahoo Inc.\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n*/\n;(function(window, document, navigator, undefined) {\n\"use strict\";\n\n/*\n utils.js\n ========\n*/\n\n/* Copyright 2017 Yahoo Inc.\n * Copyrights licensed under the MIT License. See the accompanying LICENSE file for terms.\n*/\n\nvar utils = {\n URL: window.URL || window.webkitURL || window.mozURL || window.msURL,\n getUserMedia: function () {\n var getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia;\n\n return getUserMedia ? getUserMedia.bind(navigator) : getUserMedia;\n }(),\n requestAnimFrame: window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame,\n requestTimeout: function requestTimeout(callback, delay) {\n callback = callback || utils.noop;\n delay = delay || 0;\n\n if (!utils.requestAnimFrame) {\n return setTimeout(callback, delay);\n }\n\n var start = new Date().getTime();\n var handle = new Object();\n var requestAnimFrame = utils.requestAnimFrame;\n\n var loop = function loop() {\n var current = new Date().getTime();\n var delta = current - start;\n\n delta >= delay ? callback.call() : handle.value = requestAnimFrame(loop);\n };\n\n handle.value = requestAnimFrame(loop);\n\n return handle;\n },\n Blob: window.Blob || window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder || window.MSBlobBuilder,\n btoa: function () {\n var btoa = window.btoa || function (input) {\n var output = '';\n var i = 0;\n var l = input.length;\n var key = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';\n var chr1 = void 0;\n var chr2 = void 0;\n var chr3 = void 0;\n var enc1 = void 0;\n var enc2 = void 0;\n var enc3 = void 0;\n var enc4 = void 0;\n\n while (i < l) {\n chr1 = input.charCodeAt(i++);\n chr2 = input.charCodeAt(i++);\n chr3 = input.charCodeAt(i++);\n enc1 = chr1 >> 2;\n enc2 = (chr1 & 3) << 4 | chr2 >> 4;\n enc3 = (chr2 & 15) << 2 | chr3 >> 6;\n enc4 = chr3 & 63;\n\n if (isNaN(chr2)) {\n enc3 = enc4 = 64;\n } else if (isNaN(chr3)) {\n enc4 = 64;\n }\n\n output = output + key.charAt(enc1) + key.charAt(enc2) + key.charAt(enc3) + key.charAt(enc4);\n }\n\n return output;\n };\n\n return btoa ? btoa.bind(window) : utils.noop;\n }(),\n isObject: function isObject(obj) {\n return obj && Object.prototype.toString.call(obj) === '[object Object]';\n },\n isEmptyObject: function isEmptyObject(obj) {\n return utils.isObject(obj) && !Object.keys(obj).length;\n },\n isArray: function isArray(arr) {\n return arr && Array.isArray(arr);\n Line truncated
|
||||
@@ -1,2 +0,0 @@
|
||||
.art-video-player .art-playlist{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;position:absolute;z-index:120;left:0;top:0;height:100%;width:100%;opacity:0;visibility:hidden;pointer-events:none;overflow:hidden}.art-video-player .art-playlist .art-playlist-inner{position:absolute;top:0;right:-300px;bottom:0;width:300px;height:100%;font-size:12px;background:rgba(0,0,0,.8);-webkit-transition:all .2s ease-in-out;transition:all .2s ease-in-out;overflow:auto}.art-video-player .art-playlist .art-playlist-inner .art-playlist-item{cursor:pointer;border-bottom:1px solid hsla(0,0%,100%,.1);padding:12px 20px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.art-video-player .art-playlist .art-playlist-inner .art-playlist-item.active,.art-video-player .art-playlist .art-playlist-inner .art-playlist-item:hover{color:#00a1d6;background:hsla(0,0%,100%,.1)}.art-video-player.art-playlist-show .art-playlist{opacity:1;visibility:visible;pointer-events:auto}.art-video-player.art-playlist-show .art-playlist .art-playlist-inner{right:0}
|
||||
/*# sourceMappingURL=artplayer-plugin-playlist.css.map */
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"sources":["index.scss"],"names":[],"mappings":"AAAA,gCACE,mBAAa,CAAb,mBAAa,CAAb,YAAa,CACb,wBAAmB,CAAnB,qBAAmB,CAAnB,kBAAmB,CACnB,uBAAuB,CAAvB,oBAAuB,CAAvB,sBAAuB,CACvB,iBAAkB,CAClB,WAAY,CACZ,MAAO,CACP,KAAM,CACN,WAAY,CACZ,UAAW,CACX,SAAU,CACV,iBAAkB,CAClB,mBAAoB,CACpB,eAAkB,CAClB,oDACE,iBAAkB,CAClB,KAAM,CACN,YAAa,CACb,QAAS,CACT,WAAY,CACZ,WAAY,CACZ,cAAe,CACf,yBAA8B,CAC9B,sCAAgC,CAAhC,8BAAgC,CAChC,aAAgB,CAChB,uEACE,cAAe,CACf,0CAAiD,CACjD,iBAA4B,CAC5B,sBAAuB,CACvB,eAAgB,CAChB,kBAAqB,CACrB,2JACE,aAAc,CACd,6BAAsC,CAE9C,kDACE,SAAU,CACV,kBAAmB,CACnB,mBAAsB,CACtB,sEACE,OAAU","file":"artplayer-plugin-playlist.css","sourcesContent":[".art-video-player .art-playlist {\n display: flex;\n align-items: center;\n justify-content: center;\n position: absolute;\n z-index: 120;\n left: 0;\n top: 0;\n height: 100%;\n width: 100%;\n opacity: 0;\n visibility: hidden;\n pointer-events: none;\n overflow: hidden; }\n .art-video-player .art-playlist .art-playlist-inner {\n position: absolute;\n top: 0;\n right: -300px;\n bottom: 0;\n width: 300px;\n height: 100%;\n font-size: 12px;\n background: rgba(0, 0, 0, 0.8);\n transition: all 0.2s ease-in-out;\n overflow: auto; }\n .art-video-player .art-playlist .art-playlist-inner .art-playlist-item {\n cursor: pointer;\n border-bottom: 1px solid rgba(255, 255, 255, 0.1);\n padding: 12px 20px 12px 20px;\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap; }\n .art-video-player .art-playlist .art-playlist-inner .art-playlist-item:hover, .art-video-player .art-playlist .art-playlist-inner .art-playlist-item.active {\n color: #00a1d6;\n background: rgba(255, 255, 255, 0.1); }\n\n.art-video-player.art-playlist-show .art-playlist {\n opacity: 1;\n visibility: visible;\n pointer-events: auto; }\n .art-video-player.art-playlist-show .art-playlist .art-playlist-inner {\n right: 0; }\n"]}
|
||||
@@ -1,122 +0,0 @@
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
||||
typeof define === 'function' && define.amd ? define(factory) :
|
||||
(global = global || self, global.artplayerPluginPlaylist = factory());
|
||||
}(this, (function () { 'use strict';
|
||||
|
||||
function artplayerPluginPlaylist(list) {
|
||||
return function (art) {
|
||||
var _art$constructor$util = art.constructor.utils,
|
||||
append = _art$constructor$util.append,
|
||||
errorHandle = _art$constructor$util.errorHandle,
|
||||
sleep = _art$constructor$util.sleep,
|
||||
inverseClass = _art$constructor$util.inverseClass;
|
||||
var player = art.player,
|
||||
proxy = art.events.proxy,
|
||||
_art$template = art.template,
|
||||
$player = _art$template.$player,
|
||||
$video = _art$template.$video;
|
||||
var $playlist = append($player, "\n <div class=\"art-playlist\">\n <div class=\"art-playlist-inner art-backdrop-filter\"></div>\n </div>\n ");
|
||||
errorHandle(Array.isArray(list), 'Playlist is not an array type');
|
||||
errorHandle(list.length > 0, 'Playlist cannot be empty');
|
||||
var playlist = list.map(function (item) {
|
||||
errorHandle(item.url, 'Playlist items require url attribute');
|
||||
errorHandle(item.title, 'Playlist items require title attribute');
|
||||
return item;
|
||||
});
|
||||
var $playlistInner = $playlist.querySelector('.art-playlist-inner');
|
||||
$playlistInner.innerHTML = playlist.map(function (item, index) {
|
||||
return "<div class=\"art-playlist-item\" data-option-index=\"".concat(index, "\">").concat(item.title, "</div>");
|
||||
}).join('');
|
||||
|
||||
function switchUrl(index) {
|
||||
var itemOption = playlist[index];
|
||||
var isPlaying = player.playing;
|
||||
return player.switchUrl(itemOption.url, itemOption.title).then(function () {
|
||||
if (isPlaying) {
|
||||
player.play = true;
|
||||
}
|
||||
|
||||
art.emit('artplayerPluginPlaylist:change', itemOption);
|
||||
});
|
||||
}
|
||||
|
||||
function prevVideo() {
|
||||
var index = playlist.findIndex(function (item) {
|
||||
return item.url === $video.src;
|
||||
});
|
||||
errorHandle(index !== -1, "Can't find Playlist item");
|
||||
|
||||
if (playlist.length === 1) {
|
||||
return switchUrl(0);
|
||||
}
|
||||
|
||||
var prevIndex = index - 1 === -1 ? playlist.length - 1 : index - 1;
|
||||
return switchUrl(prevIndex);
|
||||
}
|
||||
|
||||
function nextVideo() {
|
||||
var index = playlist.findIndex(function (item) {
|
||||
return item.url === $video.src;
|
||||
});
|
||||
errorHandle(index !== -1, "Can't find Playlist item");
|
||||
|
||||
if (playlist.length === 1) {
|
||||
return switchUrl(0);
|
||||
}
|
||||
|
||||
var nextIndex = index + 1 === playlist.length ? 0 : index + 1;
|
||||
return switchUrl(nextIndex);
|
||||
}
|
||||
|
||||
proxy($playlistInner, 'click', function (e) {
|
||||
var optionIndex = e.target.dataset.optionIndex;
|
||||
|
||||
if (optionIndex && Number(optionIndex) <= playlist.length - 1) {
|
||||
switchUrl(optionIndex);
|
||||
}
|
||||
});
|
||||
proxy($playlist, 'click', function (e) {
|
||||
if (e.target === $playlist) {
|
||||
$player.classList.remove('art-playlist-show');
|
||||
}
|
||||
});
|
||||
art.on('video:ended', function () {
|
||||
nextVideo().then(function () {
|
||||
sleep(1000).then(function () {
|
||||
player.play = true;
|
||||
});
|
||||
});
|
||||
});
|
||||
art.on('afterAttachUrl', function () {
|
||||
var index = playlist.findIndex(function (item) {
|
||||
return item.url === $video.src;
|
||||
});
|
||||
var $item = Array.from($playlistInner.children)[index];
|
||||
|
||||
if (index !== -1 && $item) {
|
||||
inverseClass($item, 'active');
|
||||
}
|
||||
});
|
||||
return {
|
||||
name: 'artplayerPluginPlaylist',
|
||||
show: function show() {
|
||||
$player.classList.add('art-playlist-show');
|
||||
},
|
||||
hide: function hide() {
|
||||
$player.classList.remove('art-playlist-show');
|
||||
},
|
||||
next: function next() {
|
||||
nextVideo();
|
||||
},
|
||||
prev: function prev() {
|
||||
prevVideo();
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
return artplayerPluginPlaylist;
|
||||
|
||||
})));
|
||||
//# sourceMappingURL=artplayer-plugin-playlist.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"artplayer-plugin-playlist.js","sources":["../../packages/artplayer-plugin-playlist/src/index.js"],"sourcesContent":["import './index.scss';\n\nfunction artplayerPluginPlaylist(list) {\n return art => {\n const {\n utils: { append, errorHandle, sleep, inverseClass },\n } = art.constructor;\n const {\n player,\n events: { proxy },\n template: { $player, $video },\n } = art;\n\n const $playlist = append(\n $player,\n `\n <div class=\"art-playlist\">\n <div class=\"art-playlist-inner art-backdrop-filter\"></div>\n </div>\n `,\n );\n\n errorHandle(Array.isArray(list), 'Playlist is not an array type');\n errorHandle(list.length > 0, 'Playlist cannot be empty');\n const playlist = list.map(item => {\n errorHandle(item.url, 'Playlist items require url attribute');\n errorHandle(item.title, 'Playlist items require title attribute');\n return item;\n });\n\n const $playlistInner = $playlist.querySelector('.art-playlist-inner');\n $playlistInner.innerHTML = playlist\n .map((item, index) => {\n return `<div class=\"art-playlist-item\" data-option-index=\"${index}\">${item.title}</div>`;\n })\n .join('');\n\n function switchUrl(index) {\n const itemOption = playlist[index];\n const isPlaying = player.playing;\n return player.switchUrl(itemOption.url, itemOption.title).then(() => {\n if (isPlaying) {\n player.play = true;\n }\n art.emit('artplayerPluginPlaylist:change', itemOption);\n });\n }\n\n function prevVideo() {\n const index = playlist.findIndex(item => item.url === $video.src);\n errorHandle(index !== -1, \"Can't find Playlist item\");\n if (playlist.length === 1) {\n return switchUrl(0);\n }\n const prevIndex = index - 1 === -1 ? playlist.length - 1 : index - 1;\n return switchUrl(prevIndex);\n }\n\n function nextVideo() {\n const index = playlist.findIndex(item => item.url === $video.src);\n errorHandle(index !== -1, \"Can't find Playlist item\");\n if (playlist.length === 1) {\n return switchUrl(0);\n }\n const nextIndex = index + 1 === playlist.length ? 0 : index + 1;\n return switchUrl(nextIndex);\n }\n\n proxy($playlistInner, 'click', e => {\n const { optionIndex } = e.target.dataset;\n if (optionIndex && Number(optionIndex) <= playlist.length - 1) {\n switchUrl(optionIndex);\n }\n });\n\n proxy($playlist, 'click', e => {\n if (e.target === $playlist) {\n $player.classList.remove('art-playlist-show');\n }\n });\n\n art.on('video:ended', () => {\n nextVideo().then(() => {\n sleep(1000).then(() => {\n player.play = true;\n });\n });\n });\n\n art.on('afterAttachUrl', () => {\n const index = playlist.findIndex(item => item.url === $video.src);\n const $item = Array.from($playlistInner.children)[index];\n if (index !== -1 && $item) {\n inverseClass($item, 'active');\n }\n });\n\n return {\n name: 'artplayerPluginPlaylist',\n show() {\n $player.classList.add('art-playlist-show');\n },\n hide() {\n $player.classList.remove('art-playlist-show');\n },\n next() {\n nextVideo();\n },\n prev() {\n prevVideo();\n },\n };\n };\n}\n\nexport default artplayerPluginPlaylist;\n"],"names":["artplayerPluginPlaylist","list","art","constructor","utils","append","errorHandle","sleep","inverseClass","player","proxy","events","template","$player","$video","$playlist","Array","isArray","length","playlist","map","item","url","title","$playlistInner","querySelector","innerHTML","index","join","switchUrl","itemOption","isPlaying","playing","then","play","emit","prevVideo","findIndex","src","prevIndex","nextVideo","nextIndex","e","optionIndex","target","dataset","Number","classList","remove","on","$item","from","children","name","show","add","hide","next","prev"],"mappings":";;;;;;IAEA,SAASA,uBAAT,CAAiCC,IAAjC,EAAuC;IACnC,SAAO,UAAAC,GAAG,EAAI;IAAA,gCAGNA,GAAG,CAACC,WAHE,CAENC,KAFM;IAAA,QAEGC,MAFH,yBAEGA,MAFH;IAAA,QAEWC,WAFX,yBAEWA,WAFX;IAAA,QAEwBC,KAFxB,yBAEwBA,KAFxB;IAAA,QAE+BC,YAF/B,yBAE+BA,YAF/B;IAAA,QAKNC,MALM,GAQNP,GARM,CAKNO,MALM;IAAA,QAMIC,KANJ,GAQNR,GARM,CAMNS,MANM,CAMID,KANJ;IAAA,wBAQNR,Line truncated
|
||||
@@ -41,7 +41,7 @@ function artplayerPluginGif(art) {
|
||||
position: 'absolute',
|
||||
top: '0',
|
||||
left: '0',
|
||||
height: '3px',
|
||||
height: '2px',
|
||||
width: '0%',
|
||||
'background-color': theme,
|
||||
},
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
node_modules
|
||||
.DS_Store
|
||||
yarn.lock
|
||||
package-lock.json
|
||||
test
|
||||
coverage
|
||||
.nyc_output
|
||||
.cache
|
||||
docs
|
||||
@@ -1 +0,0 @@
|
||||
package-lock=false
|
||||
@@ -1,72 +0,0 @@
|
||||
# artplayer-plugin-playlist
|
||||
|
||||
Playlist plugin for ArtPlayer
|
||||
|
||||
## Demo
|
||||
|
||||
[Checkout the demo](https://artplayer.org/?libs=.%2Funcompiled%2Fartplayer-plugin-playlist.js%0A.%2Funcompiled%2Fartplayer-plugin-playlist.css&example=playlist) from Github Pages
|
||||
|
||||
## Install
|
||||
|
||||
Install with `npm`
|
||||
|
||||
```bash
|
||||
$ npm install artplayer-plugin-playlist
|
||||
```
|
||||
|
||||
Or install with `yarn`
|
||||
|
||||
```bash
|
||||
$ yarn add artplayer-plugin-playlist
|
||||
```
|
||||
|
||||
```js
|
||||
import artplayerPluginPlaylist from 'artplayer-plugin-playlist';
|
||||
import 'artplayer-plugin-playlist/dist/artplayer-plugin-playlist.css';
|
||||
```
|
||||
|
||||
Or umd builds are also available
|
||||
|
||||
```html
|
||||
<link rel="stylesheet" href="path/to/artplayer-plugin-playlist.css" />
|
||||
<script src="artplayer-plugin-playlist.js"></script>
|
||||
```
|
||||
|
||||
Will expose the global variable to `window.artplayerPluginPlaylist`.
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var art = new Artplayer({
|
||||
container: '.artplayer-app',
|
||||
url: 'path/to/video.mp4',
|
||||
plugins: [
|
||||
artplayerPluginPlaylist([
|
||||
{
|
||||
title: 'video01',
|
||||
url: 'path/to/video01.mp4',
|
||||
},
|
||||
{
|
||||
title: 'video02',
|
||||
url: 'path/to/video02.mp4',
|
||||
},
|
||||
]),
|
||||
],
|
||||
});
|
||||
|
||||
// Show Playlist
|
||||
art.plugins.artplayerPluginPlaylist.show();
|
||||
|
||||
// Hide Playlist
|
||||
art.plugins.artplayerPluginPlaylist.hide();
|
||||
|
||||
// Next Playlist item
|
||||
art.plugins.artplayerPluginPlaylist.next();
|
||||
|
||||
// Prev Playlist item
|
||||
art.plugins.artplayerPluginPlaylist.prev();
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Harvey Zack](https://sleepy.im/)
|
||||
@@ -1 +0,0 @@
|
||||
.art-video-player .art-playlist{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;position:absolute;z-index:120;left:0;top:0;height:100%;width:100%;opacity:0;visibility:hidden;pointer-events:none;overflow:hidden}.art-video-player .art-playlist .art-playlist-inner{position:absolute;top:0;right:-300px;bottom:0;width:300px;height:100%;font-size:12px;background:rgba(0,0,0,.8);-webkit-transition:all .2s ease-in-out;transition:all .2s ease-in-out;overflow:auto}.art-video-player .art-playlist .art-playlist-inner .art-playlist-item{cursor:pointer;border-bottom:1px solid hsla(0,0%,100%,.1);padding:12px 20px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.art-video-player .art-playlist .art-playlist-inner .art-playlist-item.active,.art-video-player .art-playlist .art-playlist-inner .art-playlist-item:hover{color:#00a1d6;background:hsla(0,0%,100%,.1)}.art-video-player.art-playlist-show .art-playlist{opacity:1;visibility:visible;pointer-events:auto}.art-video-player.art-playlist-show .art-playlist .art-playlist-inner{right:0}
|
||||
@@ -1,8 +0,0 @@
|
||||
/*!
|
||||
* artplayer-plugin-playlist.js v3.2.4
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer#readme
|
||||
* (c) 2017-2019 Harvey Zack
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
|
||||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(t=t||self).artplayerPluginPlaylist=n()}(this,(function(){"use strict";return function(t){return function(n){var e=n.constructor.utils,i=e.append,r=e.errorHandle,a=e.sleep,l=e.inverseClass,o=n.player,s=n.events.proxy,u=n.template,c=u.$player,f=u.$video,d=i(c,'<div class="art-playlist"><div class="art-playlist-inner art-backdrop-filter"></div></div>');r(Array.isArray(t),"Playlist is not an array type"),r(t.length>0,"Playlist cannot be empty");var y=t.map((function(t){return r(t.url,"Playlist items require url attribute"),r(t.title,"Playlist items require title attribute"),t})),p=d.querySelector(".art-playlist-inner");function v(t){var e=y[t],i=o.playing;return o.switchUrl(e.url,e.title).then((function(){i&&(o.play=!0),n.emit("artplayerPluginPlaylist:change",e)}))}function h(){var t=y.findIndex((function(t){return t.url===f.src}));return r(-1!==t,"Can't find Playlist item"),1===y.length?v(0):v(t+1===y.length?0:t+1)}return p.innerHTML=y.map((function(t,n){return'<div class="art-playlist-item" data-option-index="'.concat(n,'">').concat(t.title,"</div>")})).join(""),s(p,"click",(function(t){var n=t.target.dataset.optionIndex;n&&Number(n)<=y.length-1&&v(n)})),s(d,"click",(function(t){t.target===d&&c.classList.remove("art-playlist-show")})),n.on("video:ended",(function(){h().then((function(){a(1e3).then((function(){o.play=!0}))}))})),n.on("afterAttachUrl",(function(){var t=y.findIndex((function(t){return t.url===f.src})),n=Array.from(p.children)[t];-1!==t&&n&&l(n,"active")})),{name:"artplayerPluginPlaylist",show:function(){c.classList.add("art-playlist-show")},hide:function(){c.classList.remove("art-playlist-show")},next:function(){h()},prev:function(){var t;t=y.findIndex((function(t){return t.url===f.src})),r(-1!==t,"Can't find Playlist item"),1===y.length?v(0):v(t-1==-1?y.length-1:t-1)}}}}}));
|
||||
@@ -1,26 +0,0 @@
|
||||
{
|
||||
"name": "artplayer-plugin-playlist",
|
||||
"version": "3.2.4",
|
||||
"expose": "artplayerPluginPlaylist",
|
||||
"description": "Playlist plugin for ArtPlayer",
|
||||
"main": "dist/artplayer-plugin-playlist.js",
|
||||
"style": "dist/artplayer-plugin-playlist.css",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/zhw2590582/ArtPlayer.git"
|
||||
},
|
||||
"keywords": [
|
||||
"video",
|
||||
"player"
|
||||
],
|
||||
"author": "Harvey Zack <laozhaochaguan@gmail.com>",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/zhw2590582/ArtPlayer/issues"
|
||||
},
|
||||
"homepage": "https://github.com/zhw2590582/ArtPlayer#readme",
|
||||
"gitHead": "0a3a20568e37f99972eefb01d4b1dcf4036a46db"
|
||||
}
|
||||
@@ -1,116 +0,0 @@
|
||||
import './index.scss';
|
||||
|
||||
function artplayerPluginPlaylist(list) {
|
||||
return art => {
|
||||
const {
|
||||
utils: { append, errorHandle, sleep, inverseClass },
|
||||
} = art.constructor;
|
||||
const {
|
||||
player,
|
||||
events: { proxy },
|
||||
template: { $player, $video },
|
||||
} = art;
|
||||
|
||||
const $playlist = append(
|
||||
$player,
|
||||
`
|
||||
<div class="art-playlist">
|
||||
<div class="art-playlist-inner art-backdrop-filter"></div>
|
||||
</div>
|
||||
`,
|
||||
);
|
||||
|
||||
errorHandle(Array.isArray(list), 'Playlist is not an array type');
|
||||
errorHandle(list.length > 0, 'Playlist cannot be empty');
|
||||
const playlist = list.map(item => {
|
||||
errorHandle(item.url, 'Playlist items require url attribute');
|
||||
errorHandle(item.title, 'Playlist items require title attribute');
|
||||
return item;
|
||||
});
|
||||
|
||||
const $playlistInner = $playlist.querySelector('.art-playlist-inner');
|
||||
$playlistInner.innerHTML = playlist
|
||||
.map((item, index) => {
|
||||
return `<div class="art-playlist-item" data-option-index="${index}">${item.title}</div>`;
|
||||
})
|
||||
.join('');
|
||||
|
||||
function switchUrl(index) {
|
||||
const itemOption = playlist[index];
|
||||
const isPlaying = player.playing;
|
||||
return player.switchUrl(itemOption.url, itemOption.title).then(() => {
|
||||
if (isPlaying) {
|
||||
player.play = true;
|
||||
}
|
||||
art.emit('artplayerPluginPlaylist:change', itemOption);
|
||||
});
|
||||
}
|
||||
|
||||
function prevVideo() {
|
||||
const index = playlist.findIndex(item => item.url === $video.src);
|
||||
errorHandle(index !== -1, "Can't find Playlist item");
|
||||
if (playlist.length === 1) {
|
||||
return switchUrl(0);
|
||||
}
|
||||
const prevIndex = index - 1 === -1 ? playlist.length - 1 : index - 1;
|
||||
return switchUrl(prevIndex);
|
||||
}
|
||||
|
||||
function nextVideo() {
|
||||
const index = playlist.findIndex(item => item.url === $video.src);
|
||||
errorHandle(index !== -1, "Can't find Playlist item");
|
||||
if (playlist.length === 1) {
|
||||
return switchUrl(0);
|
||||
}
|
||||
const nextIndex = index + 1 === playlist.length ? 0 : index + 1;
|
||||
return switchUrl(nextIndex);
|
||||
}
|
||||
|
||||
proxy($playlistInner, 'click', e => {
|
||||
const { optionIndex } = e.target.dataset;
|
||||
if (optionIndex && Number(optionIndex) <= playlist.length - 1) {
|
||||
switchUrl(optionIndex);
|
||||
}
|
||||
});
|
||||
|
||||
proxy($playlist, 'click', e => {
|
||||
if (e.target === $playlist) {
|
||||
$player.classList.remove('art-playlist-show');
|
||||
}
|
||||
});
|
||||
|
||||
art.on('video:ended', () => {
|
||||
nextVideo().then(() => {
|
||||
sleep(1000).then(() => {
|
||||
player.play = true;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
art.on('afterAttachUrl', () => {
|
||||
const index = playlist.findIndex(item => item.url === $video.src);
|
||||
const $item = Array.from($playlistInner.children)[index];
|
||||
if (index !== -1 && $item) {
|
||||
inverseClass($item, 'active');
|
||||
}
|
||||
});
|
||||
|
||||
return {
|
||||
name: 'artplayerPluginPlaylist',
|
||||
show() {
|
||||
$player.classList.add('art-playlist-show');
|
||||
},
|
||||
hide() {
|
||||
$player.classList.remove('art-playlist-show');
|
||||
},
|
||||
next() {
|
||||
nextVideo();
|
||||
},
|
||||
prev() {
|
||||
prevVideo();
|
||||
},
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
export default artplayerPluginPlaylist;
|
||||
@@ -1,55 +0,0 @@
|
||||
.art-video-player {
|
||||
.art-playlist {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
position: absolute;
|
||||
z-index: 120;
|
||||
left: 0;
|
||||
top: 0;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
opacity: 0;
|
||||
visibility: hidden;
|
||||
pointer-events: none;
|
||||
overflow: hidden;
|
||||
|
||||
.art-playlist-inner {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: -300px;
|
||||
bottom: 0;
|
||||
width: 300px;
|
||||
height: 100%;
|
||||
font-size: 12px;
|
||||
background: rgba(0, 0, 0, 0.8);
|
||||
transition: all 0.2s ease-in-out;
|
||||
overflow: auto;
|
||||
|
||||
.art-playlist-item {
|
||||
cursor: pointer;
|
||||
border-bottom: 1px solid rgba(255,255,255,.1);
|
||||
padding: 12px 20px 12px 20px;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
|
||||
&:hover, &.active {
|
||||
color: #00a1d6;
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.art-playlist-show {
|
||||
.art-playlist {
|
||||
opacity: 1;
|
||||
visibility: visible;
|
||||
pointer-events: auto;
|
||||
.art-playlist-inner {
|
||||
right: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user