@flowplayer/player
Version:
video player for the future
2 lines (1 loc) • 1.57 kB
JavaScript
!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):((n="undefined"!=typeof globalThis?globalThis:n||self).flowplayer=n.flowplayer||{},n.flowplayer.audio=e())}(this,function(){"use strict";function n(n,e,o){const t=function(n){return Array.isArray(n)?n.slice(0):n.split(".")}(e);for(;t.length;){if(null==n)return o;const e=t.shift();if("string"!=typeof e)return o;n=n[e]}return null==n?o:n}class Audio{constructor(n){this.umd=n}init(e,o,t){var i,r;let u=e.poster,s=!1,d=!1;function l(){t.setState("is-audio-player",s),t.setState("show-controls-only",!u)}function a(){var o,i;!1!==n(e,"audio")&&e.is_native&&!d&&(s=0===(null===(o=t.videoTracks)||void 0===o?void 0:o.length)&&(null===(i=t.audioTracks)||void 0===i?void 0:i.length)>0,l())}t.on("config",function(e){u=n(e,"data.poster",u);const o=n(e,"data.ui",{});d=!!(8192&o)}),t.on("audioonlysource",function(){!1!==n(e,"audio")&&(t.setOpts({muted:!1}),s=!0,l())}),t.on("src",function(){!1!==n(e,"audio")&&(s=d,l())}),null===(i=t.videoTracks)||void 0===i||i.addEventListener("addtrack",a),null===(r=t.audioTracks)||void 0===r||r.addEventListener("addtrack",a)}}Audio.pluginName="audio";return function(n,e){if("object"==typeof exports&&"undefined"!=typeof module)return e;if(null===document.currentScript)return e;"flowplayer"in n||(n.flowplayer={extensions:[]});const o=n.flowplayer;return"function"==typeof o?(o(e),e):(Array.isArray(o.extensions)||(o.extensions=[]),~o.extensions.indexOf(e)||o.extensions.push(e),e)}(window,Audio)});