@flowplayer/player 3.14.1 → 3.15.0-rc.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/core/events.d.ts +575 -68
  2. package/core/events.js +286 -34
  3. package/core.js +1 -1
  4. package/default.js +1 -1
  5. package/embed.js +2 -2
  6. package/flowplayer.css +1 -1
  7. package/index.d.ts +1480 -91
  8. package/package.json +1 -1
  9. package/plugins/ads.d.ts +3744 -112
  10. package/plugins/ads.js +1 -1
  11. package/plugins/airplay.d.ts +1440 -116
  12. package/plugins/airplay.js +1 -1
  13. package/plugins/analytics.d.ts +1409 -82
  14. package/plugins/analytics.js +1 -1
  15. package/plugins/asel.d.ts +1409 -82
  16. package/plugins/asel.js +1 -1
  17. package/plugins/audio.d.ts +1409 -82
  18. package/plugins/audio.js +1 -1
  19. package/plugins/chapters.d.ts +1409 -82
  20. package/plugins/chapters.js +1 -1
  21. package/plugins/chromecast.d.ts +1464 -80
  22. package/plugins/chromecast.js +1 -1
  23. package/plugins/comscore.d.ts +1409 -82
  24. package/plugins/consent.d.ts +1409 -82
  25. package/plugins/consent.js +1 -1
  26. package/plugins/context-menu.d.ts +1443 -116
  27. package/plugins/cuepoints.d.ts +1443 -116
  28. package/plugins/cuepoints.js +1 -1
  29. package/plugins/dash.d.ts +1445 -115
  30. package/plugins/dash.js +1 -1
  31. package/plugins/drm.d.ts +1409 -82
  32. package/plugins/drm.js +1 -1
  33. package/plugins/endscreen.d.ts +1442 -115
  34. package/plugins/endscreen.js +1 -1
  35. package/plugins/fas.d.ts +1409 -82
  36. package/plugins/float-on-scroll.d.ts +1443 -116
  37. package/plugins/float-on-scroll.js +1 -1
  38. package/plugins/ga4.d.ts +1409 -82
  39. package/plugins/gemius.d.ts +1439 -112
  40. package/plugins/google-analytics.d.ts +1409 -82
  41. package/plugins/health.d.ts +1435 -107
  42. package/plugins/health.js +1 -1
  43. package/plugins/hls.d.ts +1431 -104
  44. package/plugins/hls.js +1 -1
  45. package/plugins/id3.d.ts +1409 -82
  46. package/plugins/id3.js +1 -1
  47. package/plugins/iframe.d.ts +1440 -116
  48. package/plugins/iframe.js +1 -1
  49. package/plugins/keyboard.d.ts +1409 -82
  50. package/plugins/media-session.d.ts +1409 -82
  51. package/plugins/message.d.ts +1409 -82
  52. package/plugins/message.js +1 -1
  53. package/plugins/ovp.d.ts +1435 -110
  54. package/plugins/ovp.js +1 -1
  55. package/plugins/playlist.d.ts +1409 -82
  56. package/plugins/playlist.js +1 -1
  57. package/plugins/preview.d.ts +1409 -82
  58. package/plugins/preview.js +1 -1
  59. package/plugins/qsel.d.ts +1409 -82
  60. package/plugins/qsel.js +1 -1
  61. package/plugins/qul.d.ts +1441 -114
  62. package/plugins/qul.js +1 -1
  63. package/plugins/rts.d.ts +1409 -82
  64. package/plugins/rts.js +1 -1
  65. package/plugins/share.d.ts +1409 -82
  66. package/plugins/share.js +1 -1
  67. package/plugins/speed.d.ts +1434 -107
  68. package/plugins/speed.js +1 -1
  69. package/plugins/ssai.d.ts +1412 -82
  70. package/plugins/ssai.js +1 -1
  71. package/plugins/subtitles.d.ts +1426 -102
  72. package/plugins/thumbnails.d.ts +1434 -107
  73. package/plugins/thumbnails.js +1 -1
  74. package/plugins/tizen.d.ts +1409 -82
  75. package/plugins/tizen.js +1 -1
  76. package/plugins/vtsel.d.ts +1409 -82
  77. package/plugins/vtsel.js +1 -1
  78. package/plugins/webos.d.ts +1409 -82
  79. package/plugins/webos.js +1 -1
  80. package/util/loader.d.ts +1436 -101
  81. package/util/loader.js +13 -2
package/plugins/health.js CHANGED
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):((e="undefined"!=typeof globalThis?globalThis:e||self).flowplayer=e.flowplayer||{},e.flowplayer.health=t())}(this,(function(){"use strict";const e="rebuffer";var t=Object.freeze({__proto__:null,RECORD:"health:record",REBUFFER:e,REBUFFER_ENDED:"rebuffer:ended",DISPLAY:"display"});const n="load",i="fullscreenenter",o="fullscreenexit",r="loadedmetadata",s="loadeddata",a="progress",d="loadstart",c="pause",l="playing",u="waiting",_="canplay",f="ended",h="seeked",p="seeking";function y(e){try{return!!new URL(e)}catch(e){return!1}}function E(e,t){const n=function(){try{return localStorage.getItem("flowplayer/debug")}catch(e){return""}}(),i=(i,...o)=>{try{const r=(null==t?void 0:t.debug)||n;r&&e.match(r)&&console.log(`flowplayer/${e} -- ${i}`,...o)}catch(e){console.warn(e)}};return i.log=i,i}const v=navigator;function g(e){var t,n;const i=null===(t=e.hls)||void 0===t?void 0:t.bandwidthEstimate;return i?1e-6*i:(null===(n=v.connection)||void 0===n?void 0:n.downlink)||-1}function m(e,t){return async function(e,t){try{await fetch(e,{body:t,method:"POST",mode:"no-cors"})}catch(e){}}(e,JSON.stringify({events:t}))}var R;!function(e){e[e.OFF=0]="OFF",e[e.ON=1]="ON",e[e.AUDIO_REQUIRED=2]="AUDIO_REQUIRED"}(R||(R={}));const I=e=>{switch(e){case!0:return R.ON;case!1:return R.OFF;default:return e}};function O(){try{const e=window.location!==window.parent.location?document.referrer:document.location.href;return"string"==typeof e&&e.slice(0,200)}catch(e){return!1}}const w=[],D="https://ihi.flowplayer.com/v1/health/events";function N(e){if(e.suspended)return;const t=w.slice(0);w.length=0,0!=t.length&&(e.logger.log(`:dispatch events={${t.length}}`),m(function(){try{return"undefined"==typeof window?D:window.__FLOWPLAYER_INSIGHTS_URL?window.__FLOWPLAYER_INSIGHTS_URL:D}catch(e){return D}}(),t))}async function A(e,t,n){const i=await b();w.push(Object.assign(t,i)),e.logger.log(":enqueue",t.event,t),w.length<10&&!n||N(e)}const T=()=>{var e,t;try{const n=window;return null===(t=null===(e=null==n?void 0:n.google)||void 0===e?void 0:e.ima)||void 0===t?void 0:t.VERSION}catch(e){return}},b=async()=>({client_time:Date.now()}),S=(e,t)=>Object.assign(e,{detail:t}),L=(e,{event:t,media_session_id:n,session_id:i,play_range_id:o})=>({event:t,media_session_id:n,session_id:i,play_range_id:o,device_id:e.deviceId(),version:"3.14.1",commit:"fdc2d02da52c1b1c1f231bc8c940582a3a26866e",ima_sdk_version:T(),preload:e.opt("preload"),autoplay:I(e.opt("autoplay")),live:e.opt("live"),dvr:!!e.live_state.dvr,source:e.original_src,downlink_mbs:g(e),page_url:O(),player_id:e.opt("metadata.player_id"),media_id:e.opt("metadata.media_id"),site_id:e.opt("metadata.site_id"),category_id:e.opt("metadata.category_id"),sitegroup_id:e.opt("metadata.sitegroup_id"),token:e.token,plugins:e.plugins.map(e=>e.constructor.name).sort((e,t)=>e.localeCompare(t)),current_time:e.currentTime,external_media_id:e.opt("external_media_id")}),U=e=>({bitrate:null==e?void 0:e.bitrate,resolution:null==e?void 0:e.attrs.RESOLUTION,frame_rate:null==e?void 0:e.attrs["FRAME-RATE"]});function C(e,t,n,i){const o=L(t,e.eventInfo(n)),{before:r,after:s}=i;A(e,((e,t,n)=>Object.assign(e,{state:{before:t,after:n}}))(o,U(r),U(s)))}const F=[1e7]+""+-1e3+-4e3+-8e3+-1e11,M=()=>"undefined"==typeof crypto?"":F.replace(/[018]/g,e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16));var k;function x(e){switch(e){case k.MEDIA_PLAYBACK_ABORTED:return"media playback was aborted";case k.MEDIA_ERR_NETWORK:return"a network error occurred";case k.MEDIA_ERR_DECODE:return"unable to decode media content";case k.MEDIA_ERR_SRC_NOT_SUPPORTED:return"unsupported media type";case k.NO_INTERNET:return"no internet connection detected";case k.MIXED_CONTENT:return"cannot load insecure content in a secure context";default:return"an unknown error occurred"}}!function(e){e[e.UNKNOWN=-1]="UNKNOWN",e[e.MEDIA_PLAYBACK_ABORTED=1]="MEDIA_PLAYBACK_ABORTED",e[e.MEDIA_ERR_NETWORK=2]="MEDIA_ERR_NETWORK",e[e.MEDIA_ERR_DECODE=3]="MEDIA_ERR_DECODE",e[e.MEDIA_ERR_SRC_NOT_SUPPORTED=4]="MEDIA_ERR_SRC_NOT_SUPPORTED",e[e.MIXED_CONTENT=1001]="MIXED_CONTENT",e[e.NO_INTERNET=1002]="NO_INTERNET"}(k||(k={}));const B=(e,t)=>{let n=null;return(...i)=>{null!==n&&(clearTimeout(n),n=null),n=setTimeout(()=>t(...i),e)}},P=M();class Health{constructor(e,t){this.session_id=P,this.suspended=!1,this.logger=E("health",t.opts),this.media_session_id=M(),this.play_range_id=M(),this.analyticsLoop=setInterval(()=>N(this),2e3),t.on("reap",()=>clearInterval(this.analyticsLoop)),t.on(l,()=>{this.play_range_id=M()});const n=this;if(t.health={get media_session_id(){return n.media_session_id},set media_session_id(e){n.media_session_id=e},get session_id(){return n.session_id},set session_id(e){n.session_id=e},toggle(e){e?n.resume():n.suspend()}},!Health._UNLOAD_SUBSCRIBED){Health._UNLOAD_SUBSCRIBED=!0;const t=t=>e.instances.forEach(e=>e.emit(t.type));document.addEventListener("visibilitychange",e=>{"hidden"==document.visibilityState&&t(e)}),window.addEventListener("pagehide",t)}}eventInfo(e){return{event:e,media_session_id:this.media_session_id,session_id:this.session_id,play_range_id:this.play_range_id}}suspend(){this.suspended=!0,clearInterval(this.analyticsLoop)}resume(){this.suspended=!1,this.analyticsLoop=setInterval(()=>N(this),2e3)}init(t,E,v){if(O().toString().startsWith("data:"))return this.suspend();!function(t){t.on(u,(function(n){if(t.seeking)return;if(t.networkState!==t.NETWORK_LOADING)return;if(t.readyState===t.HAVE_NOTHING)return;const i=Date.now(),o=e=>{t.off(_,o),t.off("src",o),t.off("error",o),e.type===_&&t.emit("rebuffer:ended",{rebuffer_duration:(Date.now()-i)/1e3})};t.on([_,"error","src"],o),t.emit(e)}))}(v),v.on("display",e=>{A(this,L(v,this.eventInfo(e.type)),!0)}),v.on("health:record",({detail:e})=>{const t=L(v,this.eventInfo(e.event));Object.assign(t,e.detail||{}),A(this,t)}),[_,d,n,r,s,a,u,e].forEach(e=>{v.on(e,e=>{A(this,L(v,this.eventInfo(e.type)))})}),v.on("rebuffer:ended",e=>{const t=L(v,this.eventInfo(e.type));A(this,Object.assign(t,e.detail))}),[l,c,p,h,f,i,o].forEach(e=>{v.on(e,e=>{A(this,L(v,this.eventInfo(e.type)))})}),v.on("volumechange",B(800,e=>{const t=L(v,this.eventInfo(e.type));A(this,S(t,{volume:parseFloat(v.volume.toFixed(2)),muted:v.muted}))})),v.on("resize",B(800,e=>{const t=L(v,this.eventInfo(e.type));A(this,S(t,{height:E.clientHeight,width:E.clientWidth}))})),v.on("hls/failover",e=>{const t=L(v,this.eventInfo(e.type)),n=e.detail,{reason:i,from:o}=n;A(this,S(t,{reason:i,from:o}))}),v.on("qualitychange",({type:e,detail:t})=>{switch(t.kind){case"hls":return C(this,v,e,t)}});let g=Date.now()-1e3;v.on("timeupdate",e=>{if(Date.now()<g)return;g=Date.now()+5e3;const t=L(v,this.eventInfo(e.type));var n;A(this,S(t,{duration:(n=v.duration,Number.isFinite(n)?n:n===1/0?-1:void 0)}))}),v.addEventListener("error",e=>{const t=L(v,this.eventInfo(e.type)),n=e.error||v.error;if(!n)return A(this,t,!0);const i=n.code,o={error_message:n.message||x(i),error_code:i,error_stack:n.stack||""};return A(this,S(t,o),!0)}),v.on("src",e=>{var t;const n=null===(t=e.detail)||void 0===t?void 0:t.src;if("string"!=typeof n)return;if(!y(v.original_src))return;if(!y(n))return;if(n==v.original_src)return;this.media_session_id=M();A(this,L(v,this.eventInfo(e.type))),N(this)}),v.on("visibilitychange",e=>{A(this,L(v,this.eventInfo(e.type))),N(this)})}}return Health.events=t,Health._UNLOAD_SUBSCRIBED=!1,function(e,t){if("object"==typeof exports&&"undefined"!=typeof module)return t;if(null===document.currentScript)return t;"flowplayer"in e||(e.flowplayer={extensions:[]});const n=e.flowplayer;return"function"==typeof n?(n(t),t):(Array.isArray(n.extensions)||(n.extensions=[]),~n.extensions.indexOf(t)||n.extensions.push(t),t)}(window,Health)}));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):((e="undefined"!=typeof globalThis?globalThis:e||self).flowplayer=e.flowplayer||{},e.flowplayer.health=t())}(this,(function(){"use strict";const e="rebuffer",t="rebuffer:ended",i="insights:ttff",n="insights:time_to_first_frag_loaded";var r=Object.freeze({__proto__:null,RECORD:"health:record",REBUFFER:e,REBUFFER_ENDED:t,DISPLAY:"display",TIME_TO_FIRST_FRAME:i,TIME_TO_FIRST_FRAGMENT_LOADED:n});const s="content:loadstart",o="fullscreenenter",a="fullscreenexit",d="loadedmetadata",c="loadeddata",l="progress",u="loadstart",_="pause",h="playing",f="waiting",p="canplay",m="ended",y="seeked",g="seeking";function E(e){try{return!!new URL(e)}catch(e){return!1}}function v(e,t){const i=function(){try{return localStorage.getItem("flowplayer/debug")}catch(e){return""}}(),n=(n,...r)=>{try{const s=(null==t?void 0:t.debug)||i;s&&e.match(s)&&console.log(`flowplayer/${e} -- ${n}`,...r)}catch(e){console.warn(e)}};return n.log=n,n}const T=navigator;function R(e){var t,i;const n=null===(t=e.hls)||void 0===t?void 0:t.bandwidthEstimate;return n?1e-6*n:(null===(i=T.connection)||void 0===i?void 0:i.downlink)||-1}function A(e,t){return async function(e,t){try{await fetch(e,{body:t,method:"POST",mode:"no-cors"})}catch(e){}}(e,JSON.stringify({events:t}))}var O;!function(e){e[e.OFF=0]="OFF",e[e.ON=1]="ON",e[e.AUDIO_REQUIRED=2]="AUDIO_REQUIRED"}(O||(O={}));const I=e=>{switch(e){case!0:return O.ON;case!1:return O.OFF;default:return e}};function w(){try{const e=window.location!==window.parent.location?document.referrer:document.location.href;return"string"==typeof e&&e.slice(0,200)}catch(e){return!1}}const S=[],D="https://ihi.flowplayer.com/v1/health/events";function N(e){if(e.suspended)return;const t=S.slice(0);S.length=0,0!=t.length&&(e.logger.log(`:dispatch events={${t.length}}`),A(function(){try{return"undefined"==typeof window?D:window.__FLOWPLAYER_INSIGHTS_URL?window.__FLOWPLAYER_INSIGHTS_URL:D}catch(e){return D}}(),t))}async function b(e,t,i){const n=await F();S.push(Object.assign(t,n)),e.logger.log(":enqueue",t.event,t),S.length<10&&!i||N(e)}const U=()=>{var e,t;try{const i=window;return null===(t=null===(e=null==i?void 0:i.google)||void 0===e?void 0:e.ima)||void 0===t?void 0:t.VERSION}catch(e){return}},F=async()=>({client_time:Date.now()}),C=(e,t)=>Object.assign(e,{detail:t}),L=(e,{event:t,media_session_id:i,session_id:n,play_range_id:r})=>({event:t,media_session_id:i,session_id:n,play_range_id:r,device_id:e.deviceId(),version:"3.15.0-rc.10",commit:"8d8bc0f7d20c543eca3a2dddffe273f2a82ccc12",ima_sdk_version:U(),preload:e.opt("preload"),autoplay:I(e.opt("autoplay")),live:e.opt("live"),dvr:!!e.live_state.dvr,source:e.original_src,downlink_mbs:R(e),page_url:w(),player_id:e.opt("metadata.player_id"),media_id:e.opt("metadata.media_id"),site_id:e.opt("metadata.site_id"),category_id:e.opt("metadata.category_id"),sitegroup_id:e.opt("metadata.sitegroup_id"),token:e.token,plugins:e.plugins.map(e=>e.constructor.name).sort((e,t)=>e.localeCompare(t)),current_time:e.currentTime,external_media_id:e.opt("external_media_id")}),M=e=>({bitrate:null==e?void 0:e.bitrate,resolution:null==e?void 0:e.attrs.RESOLUTION,frame_rate:null==e?void 0:e.attrs["FRAME-RATE"]});function W(e,t,i,n){const r=L(t,e.eventInfo(i)),{before:s,after:o}=n;b(e,((e,t,i)=>Object.assign(e,{state:{before:t,after:i}}))(r,M(s),M(o)))}const k=[1e7]+""+-1e3+-4e3+-8e3+-1e11,x=()=>"undefined"==typeof crypto?"":k.replace(/[018]/g,e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16));var B;function G(e){switch(e){case B.MEDIA_PLAYBACK_ABORTED:return"media playback was aborted";case B.MEDIA_ERR_NETWORK:return"a network error occurred";case B.MEDIA_ERR_DECODE:return"unable to decode media content";case B.MEDIA_ERR_SRC_NOT_SUPPORTED:return"unsupported media type";case B.NO_INTERNET:return"no internet connection detected";case B.MIXED_CONTENT:return"cannot load insecure content in a secure context";default:return"an unknown error occurred"}}!function(e){e[e.UNKNOWN=-1]="UNKNOWN",e[e.MEDIA_PLAYBACK_ABORTED=1]="MEDIA_PLAYBACK_ABORTED",e[e.MEDIA_ERR_NETWORK=2]="MEDIA_ERR_NETWORK",e[e.MEDIA_ERR_DECODE=3]="MEDIA_ERR_DECODE",e[e.MEDIA_ERR_SRC_NOT_SUPPORTED=4]="MEDIA_ERR_SRC_NOT_SUPPORTED",e[e.MIXED_CONTENT=1001]="MIXED_CONTENT",e[e.NO_INTERNET=1002]="NO_INTERNET"}(B||(B={}));const H=(e,t)=>{let i=null;return(...n)=>{null!==i&&(clearTimeout(i),i=null),i=setTimeout(()=>t(...n),e)}};var P;!function(e){e[e.Starting=0]="Starting",e[e.ConfigFinalized=1]="ConfigFinalized",e[e.TimerStartedWithAdsAutoplay=2]="TimerStartedWithAdsAutoplay",e[e.TimerStartedWithContentAutoplay=3]="TimerStartedWithContentAutoplay",e[e.TimerStartedWithUserGesture=4]="TimerStartedWithUserGesture",e[e.MetricReported=5]="MetricReported"}(P||(P={}));class TimeToFirstFrame{constructor(e=P.Starting,t=!1,i=!1){this.state=e,this.loadedAd=t,this.requiresUserGesture=i}reset(){this.state=P.Starting,this.loadedAd=!1,this.elapsed=void 0}toJSON(){var e;return{ad_was_requested:this.loadedAd,ms_to_first_frame:Math.round((null===(e=this.elapsed)||void 0===e?void 0:e.duration)||-1)}}startTimer(e){this.state==P.ConfigFinalized&&(this.state=e,performance.mark("ttff:start"))}hasStarted(){return[P.TimerStartedWithAdsAutoplay,P.TimerStartedWithContentAutoplay,P.TimerStartedWithUserGesture].includes(this.state)}stopTimer(e){if(this.hasStarted()){performance.mark("ttff:end");const t=this.elapsed=performance.measure("ttff","ttff:start","ttff:end");this.state=P.MetricReported,e(t)}}}const j=x();class Health{constructor(e,t){let i;this.session_id=j,this.suspended=!1,this.logger=v("health",t.opts),this.media_session_id=x(),this.play_range_id=x(),this.analyticsLoop=setInterval(()=>N(this),2e3),t.on("reap",()=>clearInterval(this.analyticsLoop)),t.on(h,()=>{i!==this.media_session_id&&(i=this.media_session_id,this.first_playing_event_timestamp=Date.now()),this.play_range_id=x()});let n=Date.now()-1e3;t.on("timeupdate",e=>{if(i!==this.media_session_id)return;const r=Date.now();if(r<n)return;n=Date.now()+5e3;const s=L(t,this.eventInfo(e.type)),o=C(s,{duration:(a=t.duration,Number.isFinite(a)?a:a===1/0?-1:void 0)});var a;this.first_playing_event_timestamp&&(Object.assign(o,{ms_since_first_playing:r-this.first_playing_event_timestamp}),this.first_playing_event_timestamp=void 0),b(this,o)});const r=this;if(t.health={get media_session_id(){return r.media_session_id},set media_session_id(e){r.media_session_id=e},get session_id(){return r.session_id},set session_id(e){r.session_id=e},toggle(e){e?r.resume():r.suspend()}},!Health._UNLOAD_SUBSCRIBED){Health._UNLOAD_SUBSCRIBED=!0;const t=t=>e.instances.forEach(e=>e.emit(t.type));document.addEventListener("visibilitychange",e=>{"hidden"==document.visibilityState&&t(e)}),window.addEventListener("pagehide",t)}}eventInfo(e){return{event:e,media_session_id:this.media_session_id,session_id:this.session_id,play_range_id:this.play_range_id}}suspend(){this.suspended=!0,clearInterval(this.analyticsLoop)}resume(){this.suspended=!1,this.analyticsLoop=setInterval(()=>N(this),2e3)}init(r,v,T){if(w().toString().startsWith("data:"))return this.suspend();!function(i){i.on(f,(function(n){if(i.seeking)return;if(i.networkState!==i.NETWORK_LOADING)return;if(i.readyState===i.HAVE_NOTHING)return;const r=Date.now(),s=e=>{i.off(p,s),i.off("src",s),i.off("error",s),e.type===p&&i.emit(t,{rebuffer_duration:(Date.now()-r)/1e3})};i.on([p,"error","src"],s),i.emit(e)}))}(T),function(e){let t;[p,s].forEach(i=>{e.on(i,i=>{const r=Date.now();switch(i.type){case s:return t=r;case p:if(t)return e.emit(n,{ms_since_loading_started:r-t}),t=null}})})}(T),function(e){if(void 0===window.performance)return;const t=new TimeToFirstFrame;e.on("ovp:config:finalized",e=>{t.reset(),t.state=P.ConfigFinalized,t.requiresUserGesture=!e.detail.autoplay}),e.on(s,()=>{e.root.classList.contains("ad-hide-first-frame")&&t.startTimer(P.TimerStartedWithAdsAutoplay),e.opt("autoplay")&&t.startTimer(P.TimerStartedWithContentAutoplay)}),e.on("click",()=>{e.opt("autoplay")||t.startTimer(P.TimerStartedWithUserGesture)}),e.on("ad-requested",()=>{t.loadedAd=!0}),e.on("timeupdate",()=>{if(!(e.readyState<HTMLMediaElement.HAVE_CURRENT_DATA))switch(t.state){case P.TimerStartedWithContentAutoplay:case P.TimerStartedWithUserGesture:return t.stopTimer(()=>e.emit(i,t.toJSON()))}}),e.on("ad-started",()=>{switch(t.state){case P.TimerStartedWithAdsAutoplay:case P.TimerStartedWithUserGesture:return t.stopTimer(()=>e.emit(i,t.toJSON()))}})}(T),T.on("display",e=>{b(this,L(T,this.eventInfo(e.type)),!0)}),T.on("health:record",({detail:e})=>{const t=L(T,this.eventInfo(e.event));Object.assign(t,e.detail||{}),b(this,t)}),[u,d,c,l,f,e].forEach(e=>{T.on(e,e=>{b(this,L(T,this.eventInfo(e.type)))})}),[t,i,n].forEach(e=>{T.on(e,e=>{const t=L(T,this.eventInfo(e.type));b(this,Object.assign(t,e.detail))})}),[h,_,g,y,m,o,a,p,s].forEach(e=>{T.on(e,e=>{b(this,L(T,this.eventInfo(e.type)))})}),T.on("volumechange",H(800,e=>{const t=L(T,this.eventInfo(e.type));b(this,C(t,{volume:parseFloat(T.volume.toFixed(2)),muted:T.muted}))})),T.on("resize",H(800,e=>{const t=L(T,this.eventInfo(e.type));b(this,C(t,{height:v.clientHeight,width:v.clientWidth}))})),T.on("hls/failover",e=>{const t=L(T,this.eventInfo(e.type)),i=e.detail,{reason:n,from:r}=i;b(this,C(t,{reason:n,from:r}))}),T.on("qualitychange",({type:e,detail:t})=>{switch(t.kind){case"hls":return W(this,T,e,t)}}),T.addEventListener("error",e=>{const t=L(T,this.eventInfo(e.type)),i=e.error||T.error;if(!i)return b(this,t,!0);const n=i.code,r={error_message:i.message||G(n),error_code:n,error_stack:i.stack||""};return b(this,C(t,r),!0)}),T.on("src",e=>{var t;const i=null===(t=e.detail)||void 0===t?void 0:t.src;if("string"!=typeof i)return;if(!E(T.original_src))return;if(!E(i))return;if(i==T.original_src)return;this.media_session_id=x();b(this,L(T,this.eventInfo(e.type))),N(this)}),T.on("visibilitychange",e=>{b(this,L(T,this.eventInfo(e.type))),N(this)})}}return Health.events=r,Health._UNLOAD_SUBSCRIBED=!1,function(e,t){if("object"==typeof exports&&"undefined"!=typeof module)return t;if(null===document.currentScript)return t;"flowplayer"in e||(e.flowplayer={extensions:[]});const i=e.flowplayer;return"function"==typeof i?(i(t),t):(Array.isArray(i.extensions)||(i.extensions=[]),~i.extensions.indexOf(t)||i.extensions.push(t),t)}(window,Health)}));