/*! * artplayer-plugin-playlist.js v3.1.9 * 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(h){return function(e){var t=e.constructor.utils,n=t.append,r=t.errorHandle,i=t.sleep,a=t.inverseClass,l=e.player,o=e.events.proxy,s=e.template,u=s.$player,c=s.$video,y=n(u,'\n
\n
\n
\n ');r(Array.isArray(h),"Playlist is not an array type"),r(0').concat(t.title,"")}).join(""),o(p,"click",function(t){var n=t.target.dataset.optionIndex;n&&Number(n)<=f.length-1&&d(n)}),o(y,"click",function(t){t.target===y&&u.classList.remove("artplayer-playlist-show")}),e.on("video:ended",function(){v().then(function(){i(1e3).then(function(){l.play=!0})})}),e.on("afterAttachUrl",function(){var t=f.findIndex(function(t){return t.url===c.src}),n=Array.from(p.children)[t];-1!==t&&n&&a(n,"active")}),{name:"artplayerPluginPlaylist",show:function(){u.classList.add("artplayer-playlist-show")},hide:function(){u.classList.remove("artplayer-playlist-show")},next:function(){v()},prev:function(){!function(){var t=f.findIndex(function(t){return t.url===c.src});r(-1!==t,"Can't find Playlist item"),1===f.length?d(0):d(t-1==-1?f.length-1:t-1)}()}}}}});