UNPKG

@flowplayer/player

Version:
2 lines (1 loc) 1.67 kB
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):((e="undefined"!=typeof globalThis?globalThis:e||self).flowplayer=e.flowplayer||{},e.flowplayer.iframe=n())}(this,(function(){"use strict";var e;const n=((e=class Iframe{constructor(n,t){e.ATTACHED||(t.setState("is-iframe",!0),e.ATTACHED=!0,window.addEventListener("message",(function(t){if(!e.is_flowplayer_message(t.data))return;const i=n.instances||[],o=i[0];if(!o)return;i.length>1&&console.warn("Multiple player instances in iframe. Messaging supported with first instance only.");switch(e.message_body(t.data)){case"pause":return o.togglePlay(!1);case"play":return o.togglePlay(!0)}})))}init(e,n,t){t.on("fullscreenenter",(function(){document.fullscreenEnabled||"function"==typeof t.webkitEnterFullscreen&&(t.webkitEnterFullscreen(),t.once("webkitendfullscreen",(function(){t.emit("fullscreenexit")})),t.on("ended",(function(){t.webkitExitFullscreen()})))}))}}).pluginName="iframe",e.FLOWPLAYER_RPC_PROTOCOL="flowplayer://",e.ATTACHED=!1,e.is_flowplayer_message=function(n){return"string"==typeof n&&n.startsWith(e.FLOWPLAYER_RPC_PROTOCOL)},e.message_body=function(n){return n.slice(e.FLOWPLAYER_RPC_PROTOCOL.length)},e);(function(){try{return window.self!==window.top}catch(e){return!0}})()&&function(e,n){if("object"==typeof exports&&"undefined"!=typeof module)return n;if(null===document.currentScript)return n;"flowplayer"in e||(e.flowplayer={extensions:[]});const t=e.flowplayer;"function"==typeof t?t(n):(Array.isArray(t.extensions)||(t.extensions=[]),~t.extensions.indexOf(n)||t.extensions.push(n))}(window,n);return n}));