artplayer-plugin-hls-control
Version:
Hls control plugin for ArtPlayer
8 lines (7 loc) • 5.24 kB
JavaScript
/*!
* artplayer-plugin-hls-control.js v1.0.1
* Github: https://github.com/zhw2590582/ArtPlayer
* (c) 2017-2024 Harvey Zack
* Released under the MIT License.
*/
!function(e,t,n,o,r){var l="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},i="function"==typeof l[o]&&l[o],u=i.cache||{},a="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function c(t,n){if(!u[t]){if(!e[t]){var r="function"==typeof l[o]&&l[o];if(!n&&r)return r(t,!0);if(i)return i(t,!0);if(a&&"string"==typeof t)return a(t);var f=Error("Cannot find module '"+t+"'");throw f.code="MODULE_NOT_FOUND",f}d.resolve=function(n){var o=e[t][1][n];return null!=o?o:n},d.cache={};var s=u[t]=new c.Module(t);e[t][0].call(s.exports,d,s,s.exports,this)}return u[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=u,c.parent=i,c.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(c,"root",{get:function(){return l[o]}}),l[o]=c;for(var f=0;f<t.length;f++)c(t[f]);if(n){var s=c(n);"object"==typeof exports&&"undefined"!=typeof module?module.exports=s:"function"==typeof define&&define.amd&&define(function(){return s})}}({"6nh0Z":[function(e,t,n){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(n),o.export(n,"default",function(){return c});var r=e("bundle-text:./quality.svg"),l=o.interopDefault(r),i=e("bundle-text:./audio.svg"),u=o.interopDefault(i);function a(e,t){var n=new Map;return e.filter(function(e){var o=e[t];return void 0===o||!n.has(o)&&n.set(o,1)})}function c(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(t){var n=t.template.$video,o=t.constructor.utils.errorHandle;function r(){var r;o((null===(r=t.hls)||void 0===r?void 0:r.media)===n,'Cannot find instance of HLS from "art.hls"'),function(n){if(n.levels.length){var o=e.quality||{},r=o.auto||"Auto",i=o.title||"Quality",u=o.getName||function(e){return e.name||e.height+"P"},c=n.levels[n.currentLevel],f=c?u(c):r,s=a(n.levels.map(function(e,t){return{html:u(e,t),value:t,default:n.currentLevel===t}}),"html").sort(function(e,t){return t.value-e.value});s.push({html:r,value:-1,default:-1===n.currentLevel});var d=function(e){return n.currentLevel=e.value,t.notice.show="".concat(i,": ").concat(e.html),o.control&&t.controls.check(e),o.setting&&t.setting.check(e),e.html};o.control&&t.controls.update({name:"hls-quality",position:"right",html:f,style:{padding:"0 10px"},selector:s,onSelect:d}),o.setting&&t.setting.update({name:"hls-quality",tooltip:f,html:i,icon:l.default,width:200,selector:s,onSelect:d})}}(t.hls),function(n){if(n.audioTracks.length){var o=e.audio||{},r=o.auto||"Auto",l=o.title||"Audio",i=o.getName||function(e){return e.name||e.lang||e.language},c=n.audioTracks[n.audioTrack],f=c?i(c):r,s=a(n.audioTracks.map(function(e,t){return{html:i(e,t),value:e.id,default:n.audioTrack===e.id}}),"html"),d=function(e){return n.audioTrack=e.value,t.notice.show="".concat(l,": ").concat(e.html),o.control&&t.controls.check(e),o.setting&&t.setting.check(e),e.html};o.control&&t.controls.update({name:"hls-audio",position:"right",html:f,style:{padding:"0 10px"},selector:s,onSelect:d}),o.setting&&t.setting.update({name:"hls-audio",tooltip:f,html:l,icon:u.default,width:200,selector:s,onSelect:d})}}(t.hls)}return t.on("ready",r),t.on("restart",r),{name:"artplayerPluginHlsControl",update:r}}}"undefined"!=typeof window&&(window.artplayerPluginHlsControl=c)},{"bundle-text:./quality.svg":"ghIYQ","bundle-text:./audio.svg":"cPSEW","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],ghIYQ:[function(e,t,n){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" height="18"><path fill="#fff" d="M0 96c0-35.3 28.7-64 64-64h384c35.3 0 64 28.7 64 64v320c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V96zm323.8 106.5c-4.5-6.6-11.9-10.5-19.8-10.5s-15.4 3.9-19.8 10.5l-87 127.6-26.5-33.1c-4.6-5.7-11.5-9-18.7-9s-14.2 3.3-18.7 9l-64 80c-5.8 7.2-6.9 17.1-2.9 25.4S78.8 416 88 416h336c8.9 0 17.1-4.9 21.2-12.8s3.6-17.4-1.4-24.7l-120-176zM112 192a48 48 0 1 0 0-96 48 48 0 1 0 0 96z"/></svg>'},{}],cPSEW:[function(e,t,n){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" height="18"><path fill="#fff" d="M256 80C149.9 80 62.4 159.4 49.6 262c9.4-3.8 19.6-6 30.4-6 26.5 0 48 21.5 48 48v128c0 26.5-21.5 48-48 48-44.2 0-80-35.8-80-80V288C0 146.6 114.6 32 256 32s256 114.6 256 256v112c0 44.2-35.8 80-80 80-26.5 0-48-21.5-48-48V304c0-26.5 21.5-48 48-48 10.8 0 21 2.1 30.4 6C449.6 159.4 362.1 80 256 80z"/></svg>'},{}],iWrD0:[function(e,t,n){n.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},n.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},n.exportAll=function(e,t){return Object.keys(e).forEach(function(n){"default"===n||"__esModule"===n||Object.prototype.hasOwnProperty.call(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[n]}})}),t},n.export=function(e,t,n){Object.defineProperty(e,t,{enumerable:!0,get:n})}},{}]},["6nh0Z"],"6nh0Z","parcelRequire4dc0");