rx-player 4.4.1-dev.2025120800 → 4.4.1

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.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Changelog
2
2
 
3
- ## Current dev build: v4.4.1-dev.2025120800
3
+ ## v4.4.1 (2025-12-10)
4
4
 
5
5
  ### Bug fixes
6
6
 
package/VERSION CHANGED
@@ -1 +1 @@
1
- 4.4.1-dev.2025120800
1
+ 4.4.1
@@ -190,7 +190,7 @@ var Player = /** @class */ (function (_super) {
190
190
  // Workaround to support Firefox autoplay on FF 42.
191
191
  // See: https://bugzilla.mozilla.org/show_bug.cgi?id=1194624
192
192
  videoElement.preload = "auto";
193
- _this.version = /* PLAYER_VERSION */ "4.4.1-dev.2025120800";
193
+ _this.version = /* PLAYER_VERSION */ "4.4.1";
194
194
  _this.log = log_1.default;
195
195
  _this.state = "STOPPED";
196
196
  _this.videoElement = videoElement;
@@ -2904,5 +2904,5 @@ var Player = /** @class */ (function (_super) {
2904
2904
  Player._priv_currentlyUsedVideoElements = new WeakSet();
2905
2905
  return Player;
2906
2906
  }(event_emitter_1.default));
2907
- Player.version = /* PLAYER_VERSION */ "4.4.1-dev.2025120800";
2907
+ Player.version = /* PLAYER_VERSION */ "4.4.1";
2908
2908
  exports.default = Player;
@@ -172,7 +172,7 @@ class Player extends EventEmitter {
172
172
  // Workaround to support Firefox autoplay on FF 42.
173
173
  // See: https://bugzilla.mozilla.org/show_bug.cgi?id=1194624
174
174
  videoElement.preload = "auto";
175
- this.version = /* PLAYER_VERSION */ "4.4.1-dev.2025120800";
175
+ this.version = /* PLAYER_VERSION */ "4.4.1";
176
176
  this.log = log;
177
177
  this.state = "STOPPED";
178
178
  this.videoElement = videoElement;
@@ -2680,5 +2680,5 @@ class Player extends EventEmitter {
2680
2680
  * Use of a WeakSet ensure the object is garbage collected if it's not used anymore.
2681
2681
  */
2682
2682
  Player._priv_currentlyUsedVideoElements = new WeakSet();
2683
- Player.version = /* PLAYER_VERSION */ "4.4.1-dev.2025120800";
2683
+ Player.version = /* PLAYER_VERSION */ "4.4.1";
2684
2684
  export default Player;
package/dist/rx-player.js CHANGED
@@ -39984,7 +39984,7 @@ ${event}`
39984
39984
  } = parseConstructorOptions(options);
39985
39985
  videoElement.preload = "auto";
39986
39986
  this.version = /* PLAYER_VERSION */
39987
- "4.4.1-dev.2025120800";
39987
+ "4.4.1";
39988
39988
  this.log = log_default;
39989
39989
  this.state = "STOPPED";
39990
39990
  this.videoElement = videoElement;
@@ -42712,7 +42712,7 @@ ${event}`
42712
42712
  _Player._priv_currentlyUsedVideoElements = /* @__PURE__ */ new WeakSet();
42713
42713
  var Player = _Player;
42714
42714
  Player.version = /* PLAYER_VERSION */
42715
- "4.4.1-dev.2025120800";
42715
+ "4.4.1";
42716
42716
  var public_api_default = Player;
42717
42717
 
42718
42718
  // src/main_thread/api/index.ts
@@ -20,4 +20,4 @@ Char: `+n[t])}return t!==-1&&(t+=1),I}else if(n.charCodeAt(t+1)===by){if(n.charC
20
20
  `+Jb(t.buffered,t.position.getPolled()),`
21
21
  ${e}`),this._observationRef.setValue(t)}_restartInterval(){let{SAMPLING_INTERVAL_MEDIASOURCE:e,SAMPLING_INTERVAL_LOW_LATENCY:t,SAMPLING_INTERVAL_NO_MEDIASOURCE:r}=O.getCurrent(),i;this._lowLatencyMode?i=t:this._withMediaSource?i=e:i=r,this._observationIntervalId!==null&&clearInterval(this._observationIntervalId),this._observationIntervalId=setInterval(()=>this._generateObservationForEvent("timeupdate"),i)}_registerMediaElementEvents(e){Qb.map(t=>{let r=()=>{this._restartInterval(),this._generateObservationForEvent(t)};e.addEventListener(t,r),this._canceller.signal.register(()=>{e.removeEventListener(t,r)})})}_registerLoadedMetadataEvent(e){let t=this._onLoadedMetadataEvent.bind(this);e.addEventListener("loadedmetadata",t),this._canceller.signal.register(()=>{e.removeEventListener("loadedmetadata",t)})}_onLoadedMetadataEvent(){let e=this._mediaElementRef.getValue();if(e!==null&&this._pendingSeek!==null&&!this._isSeekBlocked){let{position:t,isInternal:r}=this._pendingSeek;this._pendingSeek=null,this._actuallySetCurrentTime(e,t,r)}}};function kp(n,e){if(n===null)return 0;let t=e?"LOW_LATENCY":"DEFAULT",{RESUME_GAP_AFTER_SEEKING:r,RESUME_GAP_AFTER_NOT_ENOUGH_DATA:i,RESUME_GAP_AFTER_BUFFERING:o}=O.getCurrent();switch(n.reason){case"seeking":return r[t];case"not-ready":return i[t];case"buffering":return o[t]}}function $b(n,e,t,r,i){let{REBUFFERING_GAP:o}=O.getCurrent(),a=i?"LOW_LATENCY":"DEFAULT";return e===void 0?t&&Math.abs(r-n)<=o[a]:e!==null&&r-e.end<=o[a]}function Pp(){return{buffered:new Io,position:0,duration:NaN,ended:!1,paused:!0,playbackRate:1,readyState:0,seeking:!1}}function Cp(n){let{buffered:e,currentTime:t,duration:r,ended:i,paused:o,playbackRate:a,readyState:s,seeking:d}=n;return{buffered:e,position:t,duration:r,ended:i,paused:o,playbackRate:a,readyState:s,seeking:d}}function Xb({previousObservation:n,currentObservation:e,basePosition:t,observationEvent:r,withMediaSource:i,lowLatencyMode:o,bufferGap:a,fullyLoaded:s}){let{REBUFFERING_GAP:d}=O.getCurrent(),{position:u,paused:c,readyState:l,ended:f}=e,{rebuffering:p,event:g,position:I}=n,h=p===null&&!(s||f),S=null,T,v,E=o?d.LOW_LATENCY:d.DEFAULT;if(i){if(h)a===1/0?(T=!0,S=t):a===void 0?l<3&&(T=!0,S=void 0):a<=E&&(T=!0,S=t+a);else if(p!==null){let R=kp(p,o);T!==!0&&p!==null&&l>1&&(s||f||a!==void 0&&isFinite(a)&&a>R)||a===void 0&&l>=3?v=!0:a===void 0?S=void 0:a===1/0?S=t:a<=R&&(S=t+a)}}else h&&(!c&&r==="timeupdate"&&g==="timeupdate"&&u===I.getPolled()||r==="seeking"&&(a===1/0||a===void 0&&l<3))?T=!0:p!==null&&(r!=="seeking"&&u!==I.getPolled()||r==="canplay"||a===void 0&&l>=3||a!==void 0&&a<1/0&&(a>kp(p,o)||s||f))&&(v=!0);if(v===!0)return null;if(T===!0||p!==null){let R;return r==="seeking"||p!==null&&p.reason==="seeking"||e.seeking?R="seeking":l===1?R="not-ready":R="buffering",p!==null&&p.reason===R?{reason:p.reason,timestamp:p.timestamp,position:S}:{reason:R,timestamp:z(),position:S}}return null}function Zb(n,e,t,r){let{MINIMUM_BUFFER_AMOUNT_BEFORE_FREEZING:i}=O.getCurrent();return n.freezing!==null?e.ended||e.paused||e.readyState===0||e.playbackRate===0||n.position.getPolled()!==e.position?null:n.freezing:t==="timeupdate"&&r!==void 0&&r>i&&!e.ended&&!e.paused&&e.readyState>=1&&e.playbackRate!==0&&e.position===n.position.getPolled()?{timestamp:z()}:null}function Jb(n,e){let t="",r="";for(let i=0;i<n.length;i++){let o=n.start(i),a=n.end(i),s=o.toFixed(2),d=a.toFixed(2),u=(a-o).toFixed(2),c=`${s}|==${u}==|${d}`;if(t+=c,r.length===0&&a>e){let l=t.length-Math.floor(c.length/2);r=" ".repeat(l)+`^${e}`}if(i<n.length-1){let l=n.start(i+1),p=` ~${(l-a).toFixed(2)}~ `;if(t+=p,r.length===0&&e<l){let g=t.length-Math.floor(p.length/2);r=" ".repeat(g)+`^${e}`}}}return r.length===0&&(r=" ".repeat(t.length)+`^${e}`),t+`
22
22
  `+r}function eS(n){let e=n===null?Pp():Cp(n);return Y(e,{rebuffering:null,event:"init",seeking:0,position:new or(e.position,null),freezing:null,bufferGap:0,currentRange:null,fullyLoaded:!1})}async function Hl(n,e){let{time:t,container:r}=e;if(n===null||n.fetchThumbnailDataCallback===null||n.manifest===null)return Promise.reject(new ht("NO_CONTENT","Cannot get thumbnail: no content loaded"));let{thumbnailRequestsInfo:i,currentContentCanceller:o}=n,a=new U,s=a.linkToSignal(o.signal),d,u=i.pendingRequests.get(r);u==null||u.cancel(),i.pendingRequests.set(r,a);let c=()=>{s(),a.cancel(),i.pendingRequests.delete(r),setTimeout(()=>{d!==void 0&&URL.revokeObjectURL(d)},0)};try{let f=Hn(n.manifest,t);if(f===void 0)throw new ht("NO_THUMBNAIL","Wanted Period not found.");let p=f.thumbnailTracks,g=e.thumbnailTrackId!==void 0?Q(p,k=>k.id===e.thumbnailTrackId):p[0];if(g===void 0)throw e.thumbnailTrackId!==void 0?new ht("NO_THUMBNAIL","Given `thumbnailTrackId` not found"):new ht("NO_THUMBNAIL","Wanted Period has no thumbnail track.");let{lastResponse:I}=i,h;if(I!==null&&I.thumbnailTrackId===g.id&&I.periodId===f.id){let k=I.response.thumbnails;k.length>0&&t>=k[0].start&&t<k[k.length-1].end&&(h=I.response)}if(h===void 0&&(h=await n.fetchThumbnailDataCallback(f.id,g.id,t),i.lastResponse={response:h,periodId:f.id,thumbnailTrackId:g.id}),a.signal.cancellationError!==null)throw a.signal.cancellationError;let S=document.createElement("canvas"),T=S.getContext("2d");if(T===null)throw new ht("RENDERING","Cannot display thumbnail: cannot create canvas context");let v=Ie(h.thumbnails,k=>k.start<=t&&k.end>t);if(v<0)throw new Error("Cannot display thumbnail: time not found in fetched data");let E=new Image,R=new Blob([h.data],{type:h.mimeType});return d=URL.createObjectURL(R),E.src=d,S.height=h.thumbnails[v].height,S.width=h.thumbnails[v].width,new Promise((k,x)=>{E.onload=()=>{if(a.signal.cancellationError!==null){x(a.signal.cancellationError),c();return}try{T.drawImage(E,h.thumbnails[v].offsetX,h.thumbnails[v].offsetY,h.thumbnails[v].width,h.thumbnails[v].height,0,0,h.thumbnails[v].width,h.thumbnails[v].height),S.style.width="100%",S.style.height="100%",S.className="__rx-thumbnail__",l(),r.appendChild(S),k()}catch(P){x(new ht("RENDERING","Could not draw the image in a canvas:"+(P instanceof Error?P.toString():"Unknown Error")))}c()},E.onerror=()=>{if(a.signal.cancellationError!==null){x(a.signal.cancellationError),c();return}e.keepPreviousThumbnailOnError!==!0&&l(),x(new ht("RENDERING","Could not load the corresponding image in the DOM")),c()}})}catch(f){if(e.keepPreviousThumbnailOnError!==!0&&l(),f!==null&&f===a.signal.cancellationError)throw new ht("ABORTED","Thumbnail rendering has been aborted");let p=Me(f,{defaultCode:"NONE",defaultReason:"Unknown error"}),g;throw p.type==="NETWORK_ERROR"?g=new ht("LOADING",p.message):g=new ht("NOT_FOUND",p.message),c(),g}function l(){for(let f=r.children.length-1;f>=0;f--){let p=r.children[f];p.className==="__rx-thumbnail__"&&r.removeChild(p)}}}var ht=class n extends Error{constructor(e,t){super(nt(e,t)),Object.setPrototypeOf(this,n.prototype),this.name="ThumbnailRenderingError",this.code=e}};var So=class extends se{constructor(e){super(),this._canceller=new U,this._adaptationRef=e,this._updateToken=!1,this._lastEmitted=void 0,this.refresh=ne}hasSetTrack(){return this._adaptationRef.getValue()!==void 0}updateTrack(e){if(this._updateToken=!0,e===null){if(this._lastEmitted===null)return;this._updateToken=!1,this._canceller.cancel(),this._canceller=new U,this._lastEmitted=null,this._adaptationRef.setValue(null);return}let{adaptation:t,switchingMode:r,relativeResumingPosition:i}=e;this._canceller.cancel(),this._canceller=new U;let o=this._constructLockedRepresentationsReference(e);this._updateToken&&(this._lastEmitted={adaptation:t,switchingMode:r,lockedRepresentations:null},this._updateToken=!1,this._adaptationRef.setValue({adaptationId:t.id,switchingMode:r,representations:o,relativeResumingPosition:i}))}_constructLockedRepresentationsReference(e){let t=new j({representationIds:[],switchingMode:"lazy"}),r=this;return this.refresh=i,this._canceller.signal.register(o),e.lockedRepresentations.onUpdate(i,{clearSignal:this._canceller.signal,emitCurrentValue:!1}),i(),t;function i(){let a=e.lockedRepresentations.getValue(),s,d;if(a===null)d=e.adaptation.representations.filter(l=>Rt(l)===!0),s="lazy";else{let{representationIds:l}=a;if(s=a.switchingMode,d=e.adaptation.representations.filter(p=>$(l,p.id)).filter(p=>Rt(p)===!0),d.length===0){r.trigger("noPlayableLockedRepresentation",null);return}}if(d.length<=0){r.trigger("noPlayableRepresentation",null);return}let u=t.getValue(),c=d.map(l=>l.id).slice().sort();if(c.length!==u.representationIds.length){t.setValue({representationIds:c,switchingMode:s});return}for(let l=0;l<c.length;l++)if(u.representationIds[l]!==c[l]){t.setValue({representationIds:c,switchingMode:s});return}}function o(){r.refresh=ne}}dispose(){this.removeEventListener(),this._canceller.cancel(),this._adaptationRef.finish()}};var To=class extends se{constructor(e){var t;super(),this._storedPeriodInfo=[],this._isDisposed=!1,this._cachedPeriodInfo=new WeakMap,this._isTrickModeTrackEnabled=e.preferTrickModeTracks,this._defaultAudioTrackSwitchingMode=(t=e.defaultAudioTrackSwitchingMode)!=null?t:O.getCurrent().DEFAULT_AUDIO_TRACK_SWITCHING_MODE,this.onTracksNotPlayableForType=e.onTracksNotPlayableForType}getAvailablePeriods(){return this._storedPeriodInfo.reduce((e,t)=>(t.isPeriodAdvertised&&e.push(jt(t.period)),e),[])}onManifestCodecSupportUpdate(){this._selectInitialTrackIfNeeded()}checkPeriodHasSupportedTrack(e,t){var d,u;let r=e.adaptations[t],i=[...(d=e.adaptations.audio)!=null?d:[],...(u=e.adaptations.video)!=null?u:[]];if(!(r!==void 0&&r.length>0))return;let a=r.every(c=>c.supportStatus.hasSupportedCodec===!1),s=i.every(c=>c.supportStatus.hasSupportedCodec===!1);if(a){let c=new re("MANIFEST_INCOMPATIBLE_CODECS_ERROR","No supported "+t+" adaptations",{tracks:void 0});if(s){if(this.trigger("error",c),this._isDisposed)return;this.dispose();return}else if(this.onTracksNotPlayableForType[t]==="continue")this.trigger("warning",c);else{if(this.trigger("error",c),this._isDisposed)return;this.dispose();return}}}onManifestUpdate(e){var o,a,s;let{periods:t}=e;if(y.CURRENT_ENV===y.DEV)for(let d=1;d<t.length;d++)J(t[d-1].start<=t[d].start);let r=[];for(let d of t)if(["audio","video"].forEach(u=>{this.checkPeriodHasSupportedTrack(d,u)}),this._isDisposed)return;let i=0;for(let d=0;d<this._storedPeriodInfo.length;d++){let u=this._storedPeriodInfo[d].period,c=t[i];if(c===void 0)for(let l=this._storedPeriodInfo.length-1;l>=d;l--)this._storedPeriodInfo[l].inManifest=!1,ql(this._storedPeriodInfo[l])&&this._removePeriodObject(l);else if(u===c)i++,this.resetSelectedTrackIfNotAvailableAnymore(this._storedPeriodInfo[d],c,"video"),this.resetSelectedTrackIfNotAvailableAnymore(this._storedPeriodInfo[d],c,"audio"),this.resetSelectedTrackIfNotAvailableAnymore(this._storedPeriodInfo[d],c,"text");else if(u.start<=c.start)this._storedPeriodInfo[d].inManifest=!1,ql(this._storedPeriodInfo[d])&&(this._removePeriodObject(d),d--);else{let l=Gl(c,!0);this._storedPeriodInfo.splice(d,0,l),r.push(l),i++}}if(i<t.length){let d=t.slice(i).map(u=>Gl(u,!0));this._storedPeriodInfo.push(...d),r.push(...d)}for(let d of this._storedPeriodInfo)(o=d.audio.dispatcher)==null||o.refresh(),(a=d.video.dispatcher)==null||a.refresh(),(s=d.text.dispatcher)==null||s.refresh()}onDecipherabilityUpdates(){var e,t,r;for(let i of this._storedPeriodInfo)(e=i.audio.dispatcher)==null||e.refresh(),(t=i.video.dispatcher)==null||t.refresh(),(r=i.text.dispatcher)==null||r.refresh()}resetSelectedTrackIfNotAvailableAnymore(e,t,r){var d;let i=e[r].storedSettings;if(_(i))return;let o=Ot(t,r);if(o.some(u=>u.id===i.adaptation.id)||(m.warn("Track",`Chosen ${r} Adaptation not available anymore`),r==="video"?e.video.storedSettings=this.getDefaultStoredSettingsForAdaptation(o,"video"):r==="audio"?e.audio.storedSettings=this.getDefaultStoredSettingsForAdaptation(o,"audio"):r==="text"&&(e.text.storedSettings=this.getDefaultStoredSettingsForAdaptation(o,"text")),this.trigger("trackUpdate",{period:jt(t),trackType:r,reason:"missing"}),this._isDisposed))return;let s=xt(this._storedPeriodInfo,e.period.id);s!==void 0&&s.isPeriodAdvertised&&s[r].storedSettings===null&&((d=s[r].dispatcher)==null||d.updateTrack(null))}getDefaultStoredSettingsForAdaptation(e,t){let{DEFAULT_VIDEO_TRACK_SWITCHING_MODE:r}=O.getCurrent();if(t==="text"||e.length===0)return null;switch(t){case"text":return null;case"video":{let i=e[0],o=ts(i,this._isTrickModeTrackEnabled),a=new j(null);return{adaptationBase:i,adaptation:o,switchingMode:r,lockedRepresentations:a}}case"audio":return{adaptation:e[0],switchingMode:this._defaultAudioTrackSwitchingMode,lockedRepresentations:new j(null)};default:ze(t)}}addTrackReference(e,t,r){m.debug("Track","Adding Track Reference",{bufferType:e,periodId:t.id});let i=xt(this._storedPeriodInfo,t.id);if(i===void 0){i=Gl(t,!1);let s=!1;for(let d=0;d<this._storedPeriodInfo.length;d++)this._storedPeriodInfo[d].period.start>t.start&&(this._storedPeriodInfo.splice(d,0,i),s=!0);s||this._storedPeriodInfo.push(i)}i[e].dispatcher!==null&&(m.error("Track","Subject already added for type and Period",{bufferType:e,periodId:t.id}),i[e].dispatcher.dispose());let o=new So(r);if(i[e].dispatcher=o,o.addEventListener("noPlayableRepresentation",()=>{this.handleMissingOrUnplayableTrack(t,e,!1)}),o.addEventListener("noPlayableLockedRepresentation",()=>{i!==void 0&&(this.unlockVideoRepresentations(i),this.trigger("brokenRepresentationsLock",{period:{id:t.id,start:t.start,end:t.end},trackType:e}))}),this._selectInitialTrackIfNeeded(),this._shouldAdvertisePeriod(i)&&(i.isPeriodAdvertised=!0,this.trigger("newAvailablePeriods",[{id:t.id,start:t.start,end:t.end}]),this._isDisposed))return;let a=["audio","video","text"];for(let s of a){let d=i[s];if(i.isPeriodAdvertised&&d.dispatcher!==null&&!d.dispatcher.hasSetTrack()&&d.storedSettings!==void 0&&d.dispatcher.updateTrack(d.storedSettings),this._isDisposed)return}}throwIfTracksAreNotSetForPeriod(e){let t=xt(this._storedPeriodInfo,e.id);if(t!==void 0&&["audio","video"].every(i=>t[i].storedSettings===null)){let i=new re("NO_AUDIO_VIDEO_TRACKS","No audio and no video tracks are set.");this.trigger("error",i),this.dispose()}}handleMissingOrUnplayableTrack(e,t,r){var u,c,l,f;let{fallbackTrack:i,noSourceMedia:o}=tS(e,t),a=(u=xt(this._storedPeriodInfo,e.id))==null?void 0:u[t];if(a===void 0){m.warn("Track","Could not find period",{periodId:e.id});return}let s=a.storedSettings,d=()=>a.storedSettings!==s;if(i!==null){let p;t==="audio"?p=this._defaultAudioTrackSwitchingMode:t==="text"?p="direct":p="reload";let g={adaptation:i,switchingMode:p,lockedRepresentations:new j(null)};if(a.storedSettings=g,r||this.trigger("trackUpdate",{period:jt(e),trackType:t,reason:"no-playable-representation"}),this._isDisposed)return;a.storedSettings===g&&((c=a.dispatcher)==null||c.updateTrack(g))}else if(i===null&&!o){if(this.trigger("noPlayableTrack",{trackType:t,period:{id:e.id,start:e.start,end:e.end}}),this._isDisposed)return;let p=this.onTracksNotPlayableForType[t];if(!d()){if(p==="continue")m.warn("Track",`No playable ${t}, continuing without ${t}`),a.storedSettings=null,r||this.trigger("trackUpdate",{period:jt(e),trackType:t,reason:"no-playable-representation"}),a.storedSettings!==null||this._isDisposed||(l=a.dispatcher)==null||l.updateTrack(null);else if(p==="error"){let g=new re("NO_PLAYABLE_REPRESENTATION",`No ${t} Representation can be played`,{tracks:void 0});this.trigger("error",g)}}}else i===null&&o&&(m.debug("Track",`The period does not have adaptation for ${t} there is no track to choose`),a.storedSettings=null,r||this.trigger("trackUpdate",{period:jt(e),trackType:t,reason:"no-playable-representation"}),a.storedSettings!==null||this._isDisposed||(f=a.dispatcher)==null||f.updateTrack(null));this._isDisposed||t!=="text"&&this.throwIfTracksAreNotSetForPeriod(e)}removeTrackReference(e,t){m.debug("Track","Removing Track Reference",{bufferType:e,periodId:t});let r;for(let a=0;a<this._storedPeriodInfo.length;a++)if(this._storedPeriodInfo[a].period.id===t){r=a;break}if(r===void 0){m.warn("Track","type not found for period",{bufferType:e,periodId:t});return}let i=this._storedPeriodInfo[r],o=i[e];if((o==null?void 0:o.dispatcher)===null){m.warn("Track","TrackDispatcher already removed for type and Period",{bufferType:e,periodId:t});return}o.dispatcher.dispose(),o.dispatcher=null,ql(i)&&this._removePeriodObject(r)}getPeriodObjectFromPeriod(e){let t=xt(this._storedPeriodInfo,e.id);return t===void 0&&e!==void 0?this._cachedPeriodInfo.get(e):t}getPeriodObjectFromId(e){return xt(this._storedPeriodInfo,e)}disableVideoTrickModeTracks(){this._isTrickModeTrackEnabled&&(this._isTrickModeTrackEnabled=!1,this._resetVideoTrackChoices("trickmode-disabled"))}enableVideoTrickModeTracks(){this._isTrickModeTrackEnabled||(this._isTrickModeTrackEnabled=!0,this._resetVideoTrackChoices("trickmode-enabled"))}resetPeriodObjects(){var e,t,r;m.debug("Track","Resetting Period Objects");for(let i=this._storedPeriodInfo.length-1;i>=0;i--){let o=this._storedPeriodInfo[i];(e=o.audio.dispatcher)==null||e.dispose(),o.audio.dispatcher=null,(t=o.video.dispatcher)==null||t.dispose(),o.video.dispatcher=null,(r=o.text.dispatcher)==null||r.dispose(),o.text.dispatcher=null,o.inManifest||this._removePeriodObject(i)}}isTrickModeEnabled(){return this._isTrickModeTrackEnabled}setAudioTrack(e){let{periodRef:t,trackId:r,switchingMode:i,lockedRepresentations:o,relativeResumingPosition:a}=e;return this._setAudioOrTextTrack({bufferType:"audio",periodRef:t,trackId:r,switchingMode:i!=null?i:this._defaultAudioTrackSwitchingMode,lockedRepresentations:o,relativeResumingPosition:a})}setTextTrack(e,t){return this._setAudioOrTextTrack({bufferType:"text",periodRef:e,trackId:t,switchingMode:"direct",lockedRepresentations:null,relativeResumingPosition:void 0})}_setAudioOrTextTrack({bufferType:e,periodRef:t,trackId:r,switchingMode:i,lockedRepresentations:o,relativeResumingPosition:a}){var p,g;if(!t.isPeriodAdvertised)throw new Error("Wanted Period not yet advertised.");let s=t.period,d=Q((p=s.adaptations[e])!=null?p:[],({id:I,supportStatus:h})=>h.hasSupportedCodec!==!1&&h.isDecipherable!==!1&&I===r);if(d===void 0)throw new Error(`Wanted ${e} track not found.`);let u=t[e],c;if(o===null)c=new j(null);else{let I=this._getRepresentationsToLock(d,o),h=e==="audio"?this._defaultAudioTrackSwitchingMode:"direct";c=new j({representationIds:I,switchingMode:h})}let l={adaptation:d,switchingMode:i,lockedRepresentations:c,relativeResumingPosition:a};if(u.storedSettings=l,this.trigger("trackUpdate",{period:jt(s),trackType:e,reason:"manual"}),this._isDisposed)return;let f=xt(this._storedPeriodInfo,s.id);f!==void 0&&f[e].storedSettings===l&&((g=f[e].dispatcher)==null||g.updateTrack(l))}setVideoTrack(e){var I,h;let{periodRef:t,trackId:r,switchingMode:i,lockedRepresentations:o,relativeResumingPosition:a}=e;if(!t.isPeriodAdvertised)throw new Error("Wanted Period not yet advertised.");let s=t.period,d=Q((I=s.adaptations.video)!=null?I:[],({id:S,supportStatus:T})=>T.isDecipherable!==!1&&T.hasSupportedCodec!==!1&&S===r);if(d===void 0)throw new Error("Wanted video track not found.");let{DEFAULT_VIDEO_TRACK_SWITCHING_MODE:u}=O.getCurrent(),c=t.video,l=ts(d,this._isTrickModeTrackEnabled),f;if(o===null)f=new j(null);else{let S=this._getRepresentationsToLock(d,o),T=u;f=new j({representationIds:S,switchingMode:T})}let p={adaptationBase:d,switchingMode:i!=null?i:u,adaptation:l,relativeResumingPosition:a,lockedRepresentations:f};if(c.storedSettings=p,this.trigger("trackUpdate",{period:jt(s),trackType:"video",reason:"manual"}),this._isDisposed)return;let g=xt(this._storedPeriodInfo,s.id);g!==void 0&&g.video.storedSettings===p&&((h=g.video.dispatcher)==null||h.updateTrack(p))}disableTrack(e,t){var o,a;if(!e.isPeriodAdvertised)throw new Error("Wanted Period not yet advertised.");let r=e[t];if(r.storedSettings===null||(t!=="text"&&((o=e[t].storedSettings)==null||o.lockedRepresentations.finish()),r.storedSettings=null,this.trigger("trackUpdate",{period:jt(e.period),trackType:t,reason:"manual"}),this._isDisposed))return;let i=xt(this._storedPeriodInfo,e.period.id);if(i!==void 0&&i[t].storedSettings===null&&((a=i[t].dispatcher)==null||a.updateTrack(null)),i!==void 0&&["audio","video"].every(d=>i[d].storedSettings===null)){let d=new re("NO_AUDIO_VIDEO_TRACKS","No audio and no video tracks are set.");this.trigger("error",d),this.dispose();return}}getChosenAudioTrack(e,t){return _(e.audio.storedSettings)?null:Uo(e.audio.storedSettings.adaptation,t)}getChosenTextTrack(e){return _(e.text.storedSettings)?null:Bo(e.text.storedSettings.adaptation)}getChosenVideoTrack(e,t){return _(e.video.storedSettings)?null:Fo(e.video.storedSettings.adaptation,t)}getAvailableAudioTracks(e,t){let r=e.audio.storedSettings,i=_(r)?null:r.adaptation.id;return Ot(e.period,"audio").map(a=>{let s=i===null?!1:i===a.id;return Y(Uo(a,t),{active:s})})}getAvailableTextTracks(e){let t=e.text.storedSettings,r=_(t)?null:t.adaptation.id;return Ot(e.period,"text").map(o=>{let a=r===null?!1:r===o.id;return Y(Bo(o),{active:a})})}getAvailableVideoTracks(e,t){let r=e.video.storedSettings,i=_(r)?void 0:r.adaptation.id;return Ot(e.period,"video").map(a=>{let s=i===null?!1:i===a.id,d=Fo(a,t),u=d.trickModeTracks!==void 0?d.trickModeTracks.map(l=>{let f=i===null?!1:i===l.id;return Y(l,{active:f})}):[],c=Y(d,{active:s});return u!==void 0&&(c.trickModeTracks=u),c})}getLockedAudioRepresentations(e){let{storedSettings:t}=e.audio;if(_(t))return null;let r=t.lockedRepresentations.getValue();return r===null?null:r.representationIds}getLockedVideoRepresentations(e){let{storedSettings:t}=e.video;if(_(t))return null;let r=t.lockedRepresentations.getValue();return r===null?null:r.representationIds}lockAudioRepresentations(e,t){var s;let{storedSettings:r}=e.audio;if(_(r))return;let{DEFAULT_AUDIO_REPRESENTATIONS_SWITCHING_MODE:i}=O.getCurrent(),o=this._getRepresentationsToLock(r.adaptation,t.representations),a=(s=t.switchingMode)!=null?s:i;r.lockedRepresentations.setValue({representationIds:o,switchingMode:a})}lockVideoRepresentations(e,t){var s;let{storedSettings:r}=e.video;if(_(r))return;let{DEFAULT_VIDEO_REPRESENTATIONS_SWITCHING_MODE:i}=O.getCurrent(),o=this._getRepresentationsToLock(r.adaptation,t.representations),a=(s=t.switchingMode)!=null?s:i;r.lockedRepresentations.setValue({representationIds:o,switchingMode:a})}unlockAudioRepresentations(e){let{storedSettings:t}=e.audio;_(t)||t.lockedRepresentations.getValue()===null||t.lockedRepresentations.setValue(null)}unlockVideoRepresentations(e){let{storedSettings:t}=e.video;_(t)||t.lockedRepresentations.getValue()===null||t.lockedRepresentations.setValue(null)}dispose(){for(this._isDisposed=!0;;){let e=this._storedPeriodInfo.pop();if(e===void 0)return;e.isRemoved=!0}}_resetVideoTrackChoices(e){var r;for(let i=0;i<this._storedPeriodInfo.length;i++){let o=this._storedPeriodInfo[i];if(!_(o.video.storedSettings)){let a=o.video.storedSettings.adaptationBase;if(a!==null){let s=ts(a,this._isTrickModeTrackEnabled);o.video.storedSettings.adaptationBase=a,o.video.storedSettings.adaptation=s}}}let t=this._storedPeriodInfo.slice();for(let i=0;i<t.length;i++){let o=t[i].period,s=t[i].video.storedSettings;if(s!==void 0){if(this.trigger("trackUpdate",{period:jt(o),trackType:"video",reason:e}),this._isDisposed)return;let d=xt(this._storedPeriodInfo,o.id);d!==void 0&&d.isPeriodAdvertised&&d.video.storedSettings===s&&((r=d.video.dispatcher)==null||r.updateTrack(s))}}}_removePeriodObject(e){J(e<this._storedPeriodInfo.length);let t=this._storedPeriodInfo[e];this._storedPeriodInfo[e].isRemoved=!0,this._storedPeriodInfo.splice(e,1),this._cachedPeriodInfo.set(t.period,t)}_getRepresentationsToLock(e,t){let r=t.reduce((i,o)=>{let a=Q(e.representations,s=>s.id===o);return a===void 0?m.warn("Track","Wanted locked Representation not found."):i.push(a.id),i},[]);if(r.length===0)throw new Error("Cannot lock Representations: None of the given Representation id are found");return r}_selectInitialTrackIfNeeded(){var i,o,a,s;let{DEFAULT_VIDEO_TRACK_SWITCHING_MODE:e}=O.getCurrent(),t=[],r=[];for(let d of this._storedPeriodInfo){let{period:u}=d;if(d.audio.storedSettings!==void 0&&d.video.storedSettings!==void 0&&d.text.storedSettings!==void 0)continue;let c=[...(i=u.adaptations.audio)!=null?i:[],...(o=u.adaptations.video)!=null?o:[]],l=c.every(h=>h.supportStatus.hasCodecWithUndefinedSupport);if(c.length>0&&l)continue;let f=Ot(u,"audio")[0];if(f===void 0){if(d.audio.storedSettings=null,this.handleMissingOrUnplayableTrack(u,"audio",!0),this._isDisposed)return}else d.audio.storedSettings={adaptation:f,switchingMode:this._defaultAudioTrackSwitchingMode,lockedRepresentations:new j(null)};let p=Ot(u,"video")[0];if(p===void 0){if(d.video.storedSettings=null,this.handleMissingOrUnplayableTrack(u,"video",!0),this._isDisposed)return}else{let h=ts(p,this._isTrickModeTrackEnabled);d.video.storedSettings={adaptation:h,adaptationBase:p,switchingMode:e,lockedRepresentations:new j(null)}}let g=null,I=((a=u.adaptations.text)!=null?a:[]).filter(h=>h.isForcedSubtitles===!0);if(I.length>0){if(f!=null){let h=Q(I,S=>S.normalizedLanguage===f.normalizedLanguage);h!==void 0&&(g=h)}g===null&&(g=(s=Q(I,h=>h.normalizedLanguage===void 0))!=null?s:null)}d.text.storedSettings=g===null?null:{adaptation:g,switchingMode:"direct",lockedRepresentations:new j(null)},r.push(d),this._shouldAdvertisePeriod(d)&&(d.isPeriodAdvertised=!0,t.push({id:u.id,start:u.start,end:u.end}))}if(!(t.length>0&&(this.trigger("newAvailablePeriods",t),this._isDisposed)))for(let d of r){if(!d.isPeriodAdvertised)continue;let u=["audio","video","text"];for(let c of u){let l=d[c];if(l.dispatcher!==null&&l.storedSettings!==void 0&&!l.dispatcher.hasSetTrack()&&(l.dispatcher.updateTrack(l.storedSettings),this._isDisposed))return}}}_shouldAdvertisePeriod(e){return!e.isPeriodAdvertised&&e.text.dispatcher!==null&&e.video.dispatcher!==null&&e.audio.dispatcher!==null}};function xt(n,e){for(let t=0;t<n.length;t++){let r=n[t];if(r.period.id===e)return r}}function ql(n){var e,t,r;return!n.inManifest&&((e=n.text)==null?void 0:e.dispatcher)===null&&((t=n.audio)==null?void 0:t.dispatcher)===null&&((r=n.video)==null?void 0:r.dispatcher)===null}function ts(n,e){var t;return e&&((t=n.trickModeTracks)==null?void 0:t[0])!==void 0?n.trickModeTracks[0]:n}function Gl(n,e){return{period:n,inManifest:e,isPeriodAdvertised:!1,isRemoved:!1,audio:{storedSettings:void 0,dispatcher:null},video:{storedSettings:void 0,dispatcher:null},text:{storedSettings:void 0,dispatcher:null}}}function jt(n){return{start:n.start,end:n.end,id:n.id}}function tS(n,e){if(!(n.adaptations[e]!==void 0&&n.adaptations[e].length>0))return{fallbackTrack:null,noSourceMedia:!0};let r=nS(n,e);return{fallbackTrack:r!=null?r:null,noSourceMedia:!1}}function nS(n,e){var r;return Q((r=n.adaptations[e])!=null?r:[],i=>i.supportStatus.hasSupportedCodec===!1||i.supportStatus.isDecipherable===!1?!1:i.representations.filter(a=>Rt(a)===!0).length>0)}var Ap=To;function Mp(n){let e,t,r,i,o,a,{DEFAULT_BASE_BANDWIDTH:s,DEFAULT_VIDEO_RESOLUTION_LIMIT:d,DEFAULT_MAX_BUFFER_AHEAD:u,DEFAULT_MAX_BUFFER_BEHIND:c,DEFAULT_MAX_VIDEO_BUFFER_SIZE:l,DEFAULT_THROTTLE_VIDEO_BITRATE_WHEN_HIDDEN:f,DEFAULT_WANTED_BUFFER_AHEAD:p}=O.getCurrent();if(_(n.maxBufferAhead))e=u;else if(e=Number(n.maxBufferAhead),isNaN(e))throw new Error("Invalid maxBufferAhead parameter. Should be a number.");if(_(n.maxBufferBehind))t=c;else if(t=Number(n.maxBufferBehind),isNaN(t))throw new Error("Invalid maxBufferBehind parameter. Should be a number.");if(_(n.wantedBufferAhead))r=p;else if(r=Number(n.wantedBufferAhead),isNaN(r))throw new Error("Invalid wantedBufferAhead parameter. Should be a number.");if(_(n.maxVideoBufferSize))i=l;else if(i=Number(n.maxVideoBufferSize),isNaN(i))throw new Error("Invalid maxVideoBufferSize parameter. Should be a number.");let g=_(n.videoResolutionLimit)?d:n.videoResolutionLimit,I=_(n.throttleVideoBitrateWhenHidden)?f:!!n.throttleVideoBitrateWhenHidden;if(_(n.videoElement))o=document.createElement("video");else if(n.videoElement.nodeName.toLowerCase()==="video"||n.videoElement.nodeName.toLowerCase()==="audio")o=n.videoElement;else throw new Error("Invalid videoElement parameter. Should be a HTMLMediaElement.");if(_(n.baseBandwidth))a=s;else if(a=Number(n.baseBandwidth),isNaN(a))throw new Error("Invalid baseBandwidth parameter. Should be a number.");return{maxBufferAhead:e,maxBufferBehind:t,videoResolutionLimit:g,videoElement:o,wantedBufferAhead:r,maxVideoBufferSize:i,throttleVideoBitrateWhenHidden:I,baseBandwidth:a}}function xp(n){var e,t,r,i;if(n===null||typeof n!="object"&&n!==void 0)throw new Error("API: reload - Invalid options format.");if((n==null?void 0:n.reloadAt)===null||typeof(n==null?void 0:n.reloadAt)!="object"&&(n==null?void 0:n.reloadAt)!==void 0)throw new Error("API: reload - Invalid 'reloadAt' option format.");if(typeof((e=n==null?void 0:n.reloadAt)==null?void 0:e.position)!="number"&&((t=n==null?void 0:n.reloadAt)==null?void 0:t.position)!==void 0)throw new Error("API: reload - Invalid 'reloadAt.position' option format.");if(typeof((r=n==null?void 0:n.reloadAt)==null?void 0:r.relative)!="number"&&((i=n==null?void 0:n.reloadAt)==null?void 0:i.relative)!==void 0)throw new Error("API: reload - Invalid 'reloadAt.relative' option format.");if(!Array.isArray(n==null?void 0:n.keySystems)&&(n==null?void 0:n.keySystems)!==void 0)throw new Error("API: reload - Invalid 'keySystems' option format.");if((n==null?void 0:n.autoPlay)!==void 0&&typeof n.autoPlay!="boolean")throw new Error("API: reload - Invalid 'autoPlay' option format.")}function wp(n){var P,M,L,K;let e,t,r,i,o,a,s,{DEFAULT_AUTO_PLAY:d,DEFAULT_CODEC_SWITCHING_BEHAVIOR:u,DEFAULT_ENABLE_FAST_SWITCHING:c,DEFAULT_TEXT_TRACK_MODE:l,DEFAULT_AUDIO_TRACKS_NOT_PLAYABLE_BEHAVIOR:f,DEFAULT_VIDEO_TRACKS_NOT_PLAYABLE_BEHAVIOR:p}=O.getCurrent();if(_(n))throw new Error("No option set on loadVideo");if(!_(n.url))e=String(n.url);else if(_(n.initialManifest)&&_(n.manifestLoader))throw new Error("Unable to load a content: no url set on loadVideo.\nPlease provide at least either an `url` argument, a `initialManifest` option or a `manifestLoader` option so the RxPlayer can load the content.");if(_(n.transport))throw new Error("No transport set on loadVideo");t=String(n.transport);let g=_(n.autoPlay)?d:!!n.autoPlay;if(_(n.keySystems))r=[];else{r=Array.isArray(n.keySystems)?n.keySystems:[n.keySystems];for(let D of r)if(typeof D.type!="string"||typeof D.getLicense!="function")throw new Error("Invalid key system given: Missing type string or getLicense callback")}let I=n.lowLatencyMode===void 0?!1:!!n.lowLatencyMode,h=n.initialManifest,S=(P=n.minimumManifestUpdateInterval)!=null?P:0,T=(M=n.defaultAudioTrackSwitchingMode)!=null?M:void 0;T!==void 0&&!$(["seamless","direct","reload"],T)&&(m.warn("API","The `defaultAudioTrackSwitchingMode` loadVideo option must match one of the following strategy name:\n- `seamless`\n- `direct`\n- `reload`"),T=void 0);let v=_(n.onCodecSwitch)?u:n.onCodecSwitch;$(["continue","reload"],v)||(m.warn("API","The `onCodecSwitch` loadVideo option must match one of the following string:\n- `continue`\n- `reload`\nIf badly set, "+u+" will be used as default"),v=u);let E=_(n.onAudioTracksNotPlayable)?f:n.onAudioTracksNotPlayable;$(["continue","error"],E)||(m.warn("API","The `onAudioTracksNotPlayable` loadVideo option must match one of the following string:\n- `continue`\n- `error`\nIf badly set, "+f+" will be used as default"),E=f);let R=_(n.onVideoTracksNotPlayable)?p:n.onVideoTracksNotPlayable;if($(["continue","error"],R)||(m.warn("API","The `onVideoTracksNotPlayable` loadVideo option must match one of the following string:\n- `continue`\n- `error`\nIf badly set, "+p+" will be used as default"),R=p),_(n.textTrackMode))i=l;else{if(n.textTrackMode!=="native"&&n.textTrackMode!=="html")throw new Error("Invalid textTrackMode.");i=n.textTrackMode}if(i==="html"){if(_(n.textTrackElement))throw new Error('You have to provide a textTrackElement in "html" textTrackMode.');if(n.textTrackElement instanceof HTMLElement)a=n.textTrackElement;else throw new Error("textTrackElement should be an HTMLElement.")}else _(n.textTrackElement)||m.warn("API",'You have set a textTrackElement without being in an "html" textTrackMode. It will be ignored.');if(_(n.mode))o="auto";else{if(!$(["auto","multithread","main"],n.mode))throw new Error("Invalid `mode` option.");o=n.mode}let k=_(n.enableFastSwitching)?c:n.enableFastSwitching;if(!_(n.startAt))if("wallClockTime"in n.startAt&&n.startAt.wallClockTime instanceof Date){let D=n.startAt.wallClockTime.getTime()/1e3;s=Y({},n.startAt,{wallClockTime:D})}else s=n.startAt;let x=(L=n.requestConfig)!=null?L:{};return{__priv_patchLastSegmentInSidx:n.__priv_patchLastSegmentInSidx,__priv_manifestUpdateUrl:n.__priv_manifestUpdateUrl,checkMediaSegmentIntegrity:n.checkMediaSegmentIntegrity,checkManifestIntegrity:n.checkManifestIntegrity,autoPlay:g,defaultAudioTrackSwitchingMode:T,enableFastSwitching:k,initialManifest:h,keySystems:r,lowLatencyMode:I,manifestLoader:n.manifestLoader,minimumManifestUpdateInterval:S,requestConfig:x,onCodecSwitch:v,onAudioTracksNotPlayable:E,onVideoTracksNotPlayable:R,referenceDateTime:n.referenceDateTime,representationFilter:n.representationFilter,segmentLoader:n.segmentLoader,serverSyncInfos:n.serverSyncInfos,startAt:s,textTrackElement:a,textTrackMode:i,transport:t,mode:o,url:e,cmcd:n.cmcd,experimentalOptions:{enableRepresentationAvoidance:((K=n.experimentalOptions)==null?void 0:K.enableRepresentationAvoidance)===!0}}}function jl(n){return!(n&&(V.browser===V.BROWSERS.SafariMobile||V.browser===V.BROWSERS.SafariDesktop))}function Op(n,e,t,r){if(r.isCancelled())return;let i=n.getReference().getValue().seeking===2;i&&(e(),r.isCancelled())||n.listen(o=>{o.event==="seeking"?(i=!0,e()):i&&o.event==="seeked"&&(i=!1,t())},{includeLastObservation:!0,clearSignal:r})}function Dp(n,e,t,r){r.isCancelled()||n===null||(n.addEventListener("play",e),n.addEventListener("pause",t),r.register(()=>{n.removeEventListener("play",e),n.removeEventListener("pause",t)}))}function Lp(n,e,t,r,i){let o=new j("LOADING",i);n.addEventListener("loaded",()=>{if(o.getValue()==="LOADING"){if(o.setValue("LOADED"),!i.isCancelled()){let d=Yl(e,null,r,o.getValue());d!=="PAUSED"&&o.setValue(d)}}else o.getValue()==="RELOADING"?o.setValue(Yl(e,null,r,o.getValue())):s(null)},i),n.addEventListener("reloadingMediaSource",()=>{yr(o.getValue())&&o.setValueIfChanged("RELOADING")},i);let a=null;return n.addEventListener("stalled",d=>{d!==a&&(s(d),a=d)},i),n.addEventListener("unstalled",()=>{a!==null&&(s(null),a=null)},i),t.listen(d=>{$(["seeking","ended","play","pause"],d.event)&&s(a)},{clearSignal:i}),o;function s(d){if(!yr(o.getValue()))return;let u=Yl(e,d,r,o.getValue());o.getValue()==="LOADED"&&u==="PAUSED"||o.setValueIfChanged(u)}}function Yl(n,e,t,r){let{FORCED_ENDED_THRESHOLD:i}=O.getCurrent();if(n.ended)return"ENDED";if(e!==null){let o=Math.abs(n.duration-n.currentTime);return!_(i)&&o<i?"ENDED":e==="seeking"?"SEEKING":e==="freezing"?"FREEZING":r==="LOADED"&&!jl(t)?"LOADED":"BUFFERING"}return n.paused?"PAUSED":"PLAYING"}function yr(n){return n!=="LOADING"&&n!=="RELOADING"&&n!=="STOPPED"}var Ql=Z,_o=typeof Ql.__RX_PLAYER_DEBUG_MODE__=="boolean"&&Ql.__RX_PLAYER_DEBUG_MODE__;try{Object.defineProperty(Ql,"__RX_PLAYER_DEBUG_MODE__",{get(){return _o},set(n){_o=n,n&&(Ir.LogLevel="DEBUG",Ir.LogFormat="full")}})}catch(n){}_o?m.setLevel("DEBUG","full"):y.CURRENT_ENV===y.DEV&&m.setLevel(b.CURRENT_LEVEL,"standard");var rS=rt(),iS=["manifestLoader","segmentLoader"],Yt=class Yt extends se{static get ErrorTypes(){return tt}static get ErrorCodes(){return ys}static get LogLevel(){return m.getLevel()}static set LogLevel(e){m.setLevel(e,m.getFormat())}static get LogFormat(){return m.getFormat()}static set LogFormat(e){m.setLevel(m.getLevel(),e)}static addFeatures(e){ba(e)}static _priv_registerVideoElement(e){Yt._priv_currentlyUsedVideoElements.has(e)&&console.warn(`The video element is already attached to another RxPlayer instance.
23
- Make sure to dispose the previous instance with player.dispose() before creating a new player instance attaching that video element.`),Yt._priv_currentlyUsedVideoElements.add(e)}static _priv_deregisterVideoElement(e){Yt._priv_currentlyUsedVideoElements.has(e)&&Yt._priv_currentlyUsedVideoElements.delete(e)}constructor(e={}){super();let{baseBandwidth:t,videoResolutionLimit:r,maxBufferAhead:i,maxBufferBehind:o,throttleVideoBitrateWhenHidden:a,videoElement:s,wantedBufferAhead:d,maxVideoBufferSize:u}=Mp(e);s.preload="auto",this.version="4.4.1-dev.2025120800",this.log=m,this.state="STOPPED",this.videoElement=s,Yt._priv_registerVideoElement(this.videoElement);let c=new U;this._destroyCanceller=c,this._priv_pictureInPictureRef=Nc(s,c.signal),this._priv_speed=new j(s.playbackRate,this._destroyCanceller.signal),this._priv_preferTrickModeTracks=!1,this._priv_contentLock=new j(!1,this._destroyCanceller.signal),this._priv_bufferOptions={wantedBufferAhead:new j(d,this._destroyCanceller.signal),maxBufferAhead:new j(i,this._destroyCanceller.signal),maxBufferBehind:new j(o,this._destroyCanceller.signal),maxVideoBufferSize:new j(u,this._destroyCanceller.signal)},this._priv_bitrateInfos={lastBitrates:{audio:t,video:t}},this._priv_throttleVideoBitrateWhenHidden=a,this._priv_videoResolutionLimit=r,this._priv_currentError=null,this._priv_contentInfos=null,this._priv_contentEventsMemory={},this._priv_reloadingMetadata={},this._priv_lastAutoPlay=!1,this._priv_worker=null;let l=()=>{this.trigger("volumeChange",{volume:s.volume,muted:s.muted})};s.addEventListener("volumechange",l),c.signal.register(()=>{s.removeEventListener("volumechange",l)})}attachWorker(e){return new Promise((t,r)=>{var a;if(!Wl())return m.warn("API","Cannot rely on a WebWorker: Worker API unavailable"),r(new mn("INCOMPATIBLE_ERROR","Worker unavailable"));if(this._priv_worker!==null){if(this.state!=="STOPPED")return m.warn("API","Cannot attach a new worker while a content is playing, please stop the player first."),r(new mn("SETUP_ERROR","Cannot attach a new worker while a content is playing"));this._priv_worker.terminate()}if(typeof e.workerUrl=="string")this._priv_worker=new Worker(e.workerUrl);else{let s=URL.createObjectURL(e.workerUrl);this._priv_worker=new Worker(s),URL.revokeObjectURL(s)}this._priv_worker.onerror=s=>{this._priv_worker!==null&&(this._priv_worker.terminate(),this._priv_worker=null),m.error("API","Unexpected worker error",s.error instanceof Error?s.error:void 0),r(new mn("UNKNOWN_ERROR",'Unexpected Worker "error" event'))};let i=s=>{let d=s.data;d.type==="init-error"?(m.warn("API","Processing InitError worker message: detaching worker"),this._priv_worker!==null&&(this._priv_worker.removeEventListener("message",i),this._priv_worker.terminate(),this._priv_worker=null),r(new mn("SETUP_ERROR","Worker parser initialization failed: "+d.value.errorMessage))):d.type==="init-success"&&(m.info("API","InitSuccess received from worker."),this._priv_worker!==null&&this._priv_worker.removeEventListener("message",i),t())};this._priv_worker.addEventListener("message",i),m.debug("M-->C","Sending message",{name:"init"}),this._priv_worker.postMessage({type:"init",value:{dashWasmUrl:e.dashWasmUrl,logLevel:m.getLevel(),logFormat:m.getFormat(),sendBackLogs:_o,date:Date.now(),timestamp:z(),hasVideo:((a=this.videoElement)==null?void 0:a.nodeName.toLowerCase())==="video"}}),m.addEventListener("onLogLevelChange",s=>{this._priv_worker!==null&&(m.debug("M-->C","Sending message",{name:"log-level-update"}),this._priv_worker.postMessage({type:"log-level-update",value:{logLevel:s.level,logFormat:s.format,sendBackLogs:_o}}))},this._destroyCanceller.signal);let o=s=>{this._priv_worker!==null&&(m.debug("M-->C","Sending message:",{name:"config-update"}),this._priv_worker.postMessage({type:"config-update",value:s}))};O.updated&&o(O.getCurrent()),O.addEventListener("update",o,this._destroyCanceller.signal)})}getCurrentModeInformation(){return this._priv_contentInfos===null?null:{isDirectFile:this._priv_contentInfos.isDirectFile,useWorker:this._priv_contentInfos.useWorker}}addEventListener(e,t){return super.addEventListener(e,t)}stop(){this._priv_contentInfos!==null&&this._priv_contentInfos.currentContentCanceller.cancel(),this._priv_cleanUpCurrentContentState(),this.state!=="STOPPED"&&this._priv_setPlayerState("STOPPED")}dispose(){this.stop(),this.videoElement!==null&&(Yt._priv_deregisterVideoElement(this.videoElement),qn(this.videoElement).catch(e=>{let t=e instanceof Error?e.message:"Unknown error";m.error("API","Could not dispose decryption resources: "+t)})),this._destroyCanceller.cancel(),this._priv_reloadingMetadata={},this.videoElement=null,this._priv_worker!==null&&(this._priv_worker.terminate(),this._priv_worker=null)}loadVideo(e){let t=wp(e);m.info("API","Calling loadvideo",{url:t.url,transport:t.transport}),this._priv_reloadingMetadata={options:t},this._priv_initializeContentPlayback(t),this._priv_lastAutoPlay=t.autoPlay}reload(e){var c,l,f;let{options:t,manifest:r,reloadPosition:i,reloadInPause:o}=this._priv_reloadingMetadata;if(t===void 0)throw new Error("API: Can't reload without having previously loaded a content.");xp(e);let a;if(((c=e==null?void 0:e.reloadAt)==null?void 0:c.position)!==void 0)a={position:e.reloadAt.position};else if(((l=e==null?void 0:e.reloadAt)==null?void 0:l.relative)!==void 0){if(i===void 0)throw new Error("Can't reload to a relative position when previous content was not loaded.");a={position:e.reloadAt.relative+i}}else i!==void 0&&(a={position:i});let s;(e==null?void 0:e.autoPlay)!==void 0?s=e.autoPlay:o!==void 0&&(s=!o);let d;(e==null?void 0:e.keySystems)!==void 0?d=e.keySystems:((f=this._priv_reloadingMetadata.options)==null?void 0:f.keySystems)!==void 0&&(d=this._priv_reloadingMetadata.options.keySystems);let u=ue(ae({},t),{initialManifest:r});a!==void 0&&(u.startAt=a),s!==void 0&&(u.autoPlay=s),d!==void 0&&(u.keySystems=d),this._priv_initializeContentPlayback(u)}createDebugElement(e){if(pe.createDebugElement===null)throw new Error("Feature `DEBUG_ELEMENT` not added to the RxPlayer");let t=new U;return pe.createDebugElement(e,this,t.signal),{dispose(){t.cancel()}}}getAvailableThumbnailTracks({time:e,periodId:t}={}){if(this._priv_contentInfos===null||this._priv_contentInfos.manifest===null)return[];let{manifest:r}=this._priv_contentInfos,i;if(e!==void 0){if(i=Hn(this._priv_contentInfos.manifest,e),i===void 0||i.thumbnailTracks.length===0)return[]}else if(t!==void 0){if(i=Q(r.periods,o=>o.id===t),i===void 0)return m.error("API","getAvailableThumbnailTracks: periodId not found",{periodId:t}),[]}else{let{currentPeriod:o}=this._priv_contentInfos;if(o===null)return[];i=o}return i.thumbnailTracks.map(o=>({id:o.id,width:Math.floor(o.width/o.horizontalTiles),height:Math.floor(o.height/o.verticalTiles),mimeType:o.mimeType}))}async renderThumbnail(e){if(_(e.time))throw new Error("You have to provide a `time` property to `renderThumbnail`, indicating the wanted thumbnail time in seconds.");if(_(e.container))throw new Error("You have to provide a `container` property to `renderThumbnail`, specifying the HTML Element in which the thumbnail should be inserted.");return Hl(this._priv_contentInfos,e)}_priv_initializeContentPlayback(e){var oe,fe,Re,ge,he,vt;let{autoPlay:t,cmcd:r,defaultAudioTrackSwitchingMode:i,enableFastSwitching:o,initialManifest:a,keySystems:s,lowLatencyMode:d,minimumManifestUpdateInterval:u,requestConfig:c,onCodecSwitch:l,startAt:f,transport:p,checkMediaSegmentIntegrity:g,checkManifestIntegrity:I,manifestLoader:h,referenceDateTime:S,segmentLoader:T,serverSyncInfos:v,mode:E,experimentalOptions:R,__priv_manifestUpdateUrl:k,__priv_patchLastSegmentInSidx:x,url:P,onAudioTracksNotPlayable:M,onVideoTracksNotPlayable:L}=e;if(this.videoElement===null)throw new Error("the attached video element is disposed");let K=p==="directfile",D=new U,B=this.videoElement,A,C=!1,N=null;if(K){if(pe.directfile===null)throw this.stop(),this._priv_currentError=null,new Error("DirectFile feature not activated in your build.");if(_(P))throw new Error("No URL for a DirectFile content");if(m.info("API","Initializing DirectFile mode in the main thread"),N=this._priv_initializeMediaElementTracksStore(D.signal),D.isUsed())return;A=new pe.directfile.initDirectFile({autoPlay:t,keySystems:s,speed:this._priv_speed,startAt:f,url:P})}else{let te={lowLatencyMode:d,maxRetry:(oe=c.manifest)==null?void 0:oe.maxRetry,requestTimeout:(fe=c.manifest)==null?void 0:fe.timeout,connectionTimeout:(Re=c.manifest)==null?void 0:Re.connectionTimeout,minimumManifestUpdateInterval:u,initialManifest:a},ye=zl(),ot={throttleBitrate:{},limitResolution:{}};this._priv_throttleVideoBitrateWhenHidden&&(ye?ot.throttleBitrate={video:gn(Uc(this._priv_pictureInPictureRef,D.signal),Qt=>Qt?1/0:0,D.signal)}:m.warn("API","Can't apply throttleVideoBitrateWhenHidden because browser can't be trusted for visibility.")),this._priv_videoResolutionLimit==="videoElement"?ye?ot.limitResolution={video:Fc(B,this._priv_pictureInPictureRef,D.signal)}:m.warn("API","Can't apply videoResolutionLimit because browser can't be trusted for video size."):this._priv_videoResolutionLimit==="screen"&&(ot.limitResolution={video:Bc(D.signal)});let pn={initialBitrates:this._priv_bitrateInfos.lastBitrates,lowLatencyMode:d,throttlers:ot},yt=e.textTrackMode==="native"?{textTrackMode:"native"}:{textTrackMode:"html",textTrackElement:e.textTrackElement},It=Y({enableFastSwitching:o,onCodecSwitch:l},this._priv_bufferOptions),$l={lowLatencyMode:d,maxRetry:(ge=c.segment)==null?void 0:ge.maxRetry,requestTimeout:(he=c.segment)==null?void 0:he.timeout,connectionTimeout:(vt=c.segment)==null?void 0:vt.connectionTimeout},Up=pe.multithread!==null&&this._priv_worker!==null&&this.videoElement.FORCED_MEDIA_SOURCE===void 0&&p==="dash"&&iS.every(Qt=>_(e[Qt]))&&typeof e.representationFilter!="function";if(E==="main"||E==="auto"&&!Up){if(pe.mainThreadMediaSourceInit===null)throw new Error("Cannot load video, neither in a WebWorker nor with the `MEDIA_SOURCE_MAIN` feature");let Qt=pe.transports[p];if(typeof Qt!="function")throw this.stop(),this._priv_currentError=null,new Error(`transport "${p}" not supported`);let Bp=typeof e.representationFilter=="string"?xc(e.representationFilter):e.representationFilter;m.info("API","Initializing MediaSource mode in the main thread");let Fp=Qt({lowLatencyMode:d,checkMediaSegmentIntegrity:g,checkManifestIntegrity:I,manifestLoader:h,referenceDateTime:S,representationFilter:Bp,segmentLoader:T,serverSyncInfos:v,__priv_manifestUpdateUrl:k,__priv_patchLastSegmentInSidx:x});A=new pe.mainThreadMediaSourceInit({adaptiveOptions:pn,autoPlay:t,bufferOptions:It,cmcd:r,enableRepresentationAvoidance:R.enableRepresentationAvoidance,keySystems:s,lowLatencyMode:d,transport:Fp,manifestRequestSettings:te,segmentRequestOptions:$l,speed:this._priv_speed,startAt:f,textTrackOptions:yt,url:P})}else{if(pe.multithread===null)throw new Error("Cannot load video in multithread mode: `MULTI_THREAD` feature not imported.");if(this._priv_worker===null)throw new Error("Cannot load video in multithread mode: `attachWorker` method not called.");J(typeof e.representationFilter!="function"),C=!0,m.info("API","Initializing MediaSource mode in a WebWorker");let Qt={lowLatencyMode:d,checkMediaSegmentIntegrity:g,checkManifestIntegrity:I,referenceDateTime:S,serverSyncInfos:v,manifestLoader:void 0,segmentLoader:void 0,representationFilter:e.representationFilter,__priv_manifestUpdateUrl:k,__priv_patchLastSegmentInSidx:x};A=new pe.multithread.init({adaptiveOptions:pn,autoPlay:t,bufferOptions:It,cmcd:r,enableRepresentationAvoidance:R.enableRepresentationAvoidance,keySystems:s,lowLatencyMode:d,transportOptions:Qt,manifestRequestSettings:te,segmentRequestOptions:$l,speed:this._priv_speed,startAt:f,textTrackOptions:yt,worker:this._priv_worker,url:P,useMseInWorker:Rm})}}let F=new bo({withMediaSource:!K,lowLatencyMode:d});F.blockSeeking(),D.signal.register(()=>{F.stop()});let G={contentId:rS(),originalUrl:P,playbackObserver:F,currentContentCanceller:D,defaultAudioTrackSwitchingMode:i,initializer:A,isDirectFile:K,manifest:null,currentPeriod:null,activeAdaptations:null,activeRepresentations:null,tracksStore:null,mediaElementTracksStore:N,useWorker:C,segmentSinkMetricsCallback:null,fetchThumbnailDataCallback:null,thumbnailRequestsInfo:{pendingRequests:new WeakMap,lastResponse:null},onAudioTracksNotPlayable:M,onVideoTracksNotPlayable:L};A.addEventListener("error",te=>{this._priv_onFatalError(te,G)}),A.addEventListener("warning",te=>{let ye=Me(te,{defaultCode:"NONE",defaultReason:"An unknown error happened."});m.warn("API","Sending warning:",ye),this.trigger("warning",ye)}),A.addEventListener("reloadingMediaSource",te=>{G.tracksStore!==null&&G.tracksStore.resetPeriodObjects(),this._priv_contentInfos!==null&&(this._priv_contentInfos.segmentSinkMetricsCallback=null),this._priv_lastAutoPlay=te.autoPlay}),A.addEventListener("inbandEvents",te=>this.trigger("inbandEvents",te)),A.addEventListener("streamEvent",te=>this.trigger("streamEvent",te)),A.addEventListener("streamEventSkip",te=>this.trigger("streamEventSkip",te)),A.addEventListener("activePeriodChanged",te=>this._priv_onActivePeriodChanged(G,te)),A.addEventListener("periodStreamReady",te=>this._priv_onPeriodStreamReady(G,te)),A.addEventListener("periodStreamCleared",te=>this._priv_onPeriodStreamCleared(G,te)),A.addEventListener("representationChange",te=>this._priv_onRepresentationChange(G,te)),A.addEventListener("adaptationChange",te=>this._priv_onAdaptationChange(G,te)),A.addEventListener("bitrateEstimateChange",te=>this._priv_onBitrateEstimateChange(te)),A.addEventListener("manifestReady",te=>this._priv_onManifestReady(G,te)),A.addEventListener("manifestUpdate",te=>this._priv_onManifestUpdate(G,te)),A.addEventListener("codecSupportUpdate",()=>this._priv_onCodecSupportUpdate(G)),A.addEventListener("decipherabilityUpdate",te=>this._priv_onDecipherabilityUpdate(G,te)),A.addEventListener("loaded",te=>{this._priv_contentInfos!==null&&(this._priv_contentInfos.segmentSinkMetricsCallback=te.getSegmentSinkMetrics,this._priv_contentInfos.fetchThumbnailDataCallback=te.getThumbnailData)}),A.prepare(),this.stop(),F.attachMediaElement(B);let X=Lp(A,B,F,K,D.signal);D.signal.register(()=>{A.dispose()});let W=te=>{switch(te){case"STOPPED":case"RELOADING":case"LOADING":break;case"ENDED":this._priv_reloadingMetadata.reloadInPause=!0,this._priv_reloadingMetadata.reloadPosition=F.getReference().getValue().position.getPolled();break;default:{let ye=F.getReference().getValue();this._priv_reloadingMetadata.reloadInPause=ye.paused,this._priv_reloadingMetadata.reloadPosition=ye.position.getWanted();break}}},q=null,H=te=>{q!==null&&(q.cancel(),q=null),X.onUpdate((ye,ot)=>{yr(ye)&&(ot(),q!==null&&q.cancel(),q=new U,q.linkToSignal(D.signal),te!==!B.paused&&(B.paused?this.trigger("pause",null):this.trigger("play",null)),Dp(B,()=>this.trigger("play",null),()=>this.trigger("pause",null),D.signal))},{emitCurrentValue:!1,clearSignal:D.signal})};H(t),A.addEventListener("reloadingMediaSource",te=>{H(te.autoPlay)}),this._priv_currentError=null,this._priv_contentInfos=G;let ie=null;X.onUpdate(te=>{W(te),this._priv_setPlayerState(te),!D.isUsed()&&(ie!==null?yr(this.state)||(ie.cancel(),ie=null):yr(this.state)&&(ie=new U,ie.linkToSignal(D.signal),Op(F,()=>this.trigger("seeking",null),()=>this.trigger("seeked",null),ie.signal)))},{emitCurrentValue:!0,clearSignal:D.signal}),F.listen(te=>{W(this.state),this._priv_triggerPositionUpdate(G,te)},{clearSignal:D.signal}),D.signal.register(()=>{A.removeEventListener()}),this._priv_contentLock.onUpdate((te,ye)=>{te||(ye(),A.start(B,F))},{emitCurrentValue:!0,clearSignal:D.signal})}getError(){return this._priv_currentError}getVideoElement(){return this.videoElement}getPlayerState(){return this.state}isContentLoaded(){return!$(["LOADING","RELOADING","STOPPED"],this.state)}isBuffering(){return $(["BUFFERING","SEEKING","LOADING","RELOADING"],this.state)}isPaused(){return this.videoElement!==null?$(["LOADING","RELOADING"],this.state)?!this._priv_lastAutoPlay:this.videoElement.paused:!0}isLive(){if(this._priv_contentInfos===null)return!1;let{isDirectFile:e,manifest:t}=this._priv_contentInfos;return e||t===null?!1:t.isLive}areTrickModeTracksEnabled(){return this._priv_preferTrickModeTracks}getContentUrls(){if(this._priv_contentInfos===null)return;let{isDirectFile:e,manifest:t,originalUrl:r}=this._priv_contentInfos;if(e)return r===void 0?void 0:[r];if(t!==null)return t.uris}updateContentUrls(e,t){if(this._priv_contentInfos===null)throw new Error("No content loaded");let r=(t==null?void 0:t.refresh)===!0;this._priv_contentInfos.initializer.updateContentUrls(e,r)}getMediaDuration(){if(this.videoElement===null)throw new Error("Disposed player");return this.videoElement.duration}getCurrentBufferGap(){if(this.videoElement===null)throw new Error("Disposed player");let e=this.videoElement,t=hc(e.buffered,e.currentTime);return t===1/0?0:t}getWallClockTime(){if(this.videoElement===null)throw new Error("Disposed player");if(this._priv_contentInfos===null)return this.videoElement.currentTime;let e=this.getWallClockOffset();return this.videoElement.currentTime+e}getWallClockOffset(){var r;if(this.videoElement===null||this._priv_contentInfos===null)return 0;let{isDirectFile:e,manifest:t}=this._priv_contentInfos;if(e){let i=yo(this.videoElement);return i!=null?i:0}return t!==null&&(r=t.availabilityStartTime)!=null?r:0}getPosition(){if(this.videoElement===null)throw new Error("Disposed player");return this.videoElement.currentTime}getLastStoredContentPosition(){return this._priv_reloadingMetadata.reloadPosition}getPlaybackRate(){return this._priv_speed.getValue()}setPlaybackRate(e,t){var o;e!==this._priv_speed.getValue()&&this._priv_speed.setValue(e);let r=t==null?void 0:t.preferTrickModeTracks;if(typeof r!="boolean")return;this._priv_preferTrickModeTracks=r;let i=(o=this._priv_contentInfos)==null?void 0:o.tracksStore;_(i)||(r&&!i.isTrickModeEnabled()?i.enableVideoTrickModeTracks():!r&&i.isTrickModeEnabled()&&i.disableVideoTrickModeTracks())}getVideoRepresentation(){let e=this.__priv_getCurrentRepresentations();if(e!==null)return _(e.video)?e.video:In(e.video)}getAudioRepresentation(){let e=this.__priv_getCurrentRepresentations();if(e!==null)return _(e.audio)?e.video:Ko(e.audio)}play(){if(this.videoElement===null)throw new Error("Disposed player");let e=this.videoElement.play();return _(e)||typeof e.catch!="function"?Promise.resolve():e.catch(t=>{if(t.name==="NotAllowedError"){let r=new re("MEDIA_ERR_PLAY_NOT_ALLOWED",t.toString());this.trigger("warning",r)}throw t})}pause(){if(this.videoElement===null)throw new Error("Disposed player");this.videoElement.pause()}seekTo(e){var o;if(this.videoElement===null)throw new Error("Disposed player");if(this._priv_contentInfos===null)throw new Error("player: no content loaded");let{isDirectFile:t,manifest:r}=this._priv_contentInfos,i;if(typeof e=="number")i=e;else if(typeof e=="object"){let a=e,s=this.videoElement.currentTime;if(!_(a.relative))i=s+a.relative;else if(!_(a.position))i=a.position;else{if(_(a.wallClockTime))throw new Error('invalid time object. You must set one of the following properties: "relative", "position" or "wallClockTime"');if(r!==null)i=a.wallClockTime-((o=r.availabilityStartTime)!=null?o:0);else if(t){if(this.videoElement!==null){let d=yo(this.videoElement);d!==void 0&&(i=a.wallClockTime-d)}}else throw new Error("Cannot seek: wallClockTime asked but Manifest not yet loaded.");i===void 0&&(i=a.wallClockTime)}}if(i===void 0)throw new Error("invalid time given");return m.info("API","API seekTo",{positionWanted:i}),this._priv_contentInfos.playbackObserver.setCurrentTime(i,!1),i}getVolume(){if(this.videoElement===null)throw new Error("Disposed player");return this.videoElement.volume}setVolume(e){if(this.videoElement===null)throw new Error("Disposed player");let t=this.videoElement;e!==t.volume&&(t.volume=e)}isMute(){var e;return((e=this.videoElement)==null?void 0:e.muted)===!0}mute(){if(this.videoElement===null)throw new Error("Disposed player");this.videoElement.muted||(this.videoElement.muted=!0)}unMute(){if(this.videoElement===null)throw new Error("Disposed player");this.videoElement.muted&&(this.videoElement.muted=!1)}setMaxBufferBehind(e){this._priv_bufferOptions.maxBufferBehind.setValue(e)}setMaxBufferAhead(e){this._priv_bufferOptions.maxBufferAhead.setValue(e)}setWantedBufferAhead(e){this._priv_bufferOptions.wantedBufferAhead.setValue(e)}setMaxVideoBufferSize(e){this._priv_bufferOptions.maxVideoBufferSize.setValue(e)}getMaxBufferBehind(){return this._priv_bufferOptions.maxBufferBehind.getValue()}getMaxBufferAhead(){return this._priv_bufferOptions.maxBufferAhead.getValue()}getWantedBufferAhead(){return this._priv_bufferOptions.wantedBufferAhead.getValue()}getMaxVideoBufferSize(){return this._priv_bufferOptions.maxVideoBufferSize.getValue()}getCurrentPeriod(){var t;let e=(t=this._priv_contentInfos)==null?void 0:t.currentPeriod;return _(e)?null:{id:e.id,start:e.start,end:e.end}}getKeySystemConfiguration(){if(this.videoElement===null)throw new Error("Disposed player");let e=Zn(this.videoElement);return e===null?null:{keySystem:e[0],configuration:e[1]}}getAvailablePeriods(){if(this._priv_contentInfos===null)return[];let{isDirectFile:e,tracksStore:t}=this._priv_contentInfos;return e?[]:t===null?[]:t.getAvailablePeriods().slice()}getAvailableAudioTracks(e){var a,s;if(this._priv_contentInfos===null)return[];let{isDirectFile:t,mediaElementTracksStore:r}=this._priv_contentInfos;if(t)return(a=r==null?void 0:r.getAvailableAudioTracks())!=null?a:[];let i,o=!0;return typeof e=="string"?i=e:(i=e==null?void 0:e.periodId,o=(s=e==null?void 0:e.filterPlayableRepresentations)!=null?s:!0),this._priv_callTracksStoreGetterSetter(i,[],(d,u)=>{var c;return(c=d.getAvailableAudioTracks(u,o))!=null?c:[]})}getAvailableTextTracks(e){var i;if(this._priv_contentInfos===null)return[];let{isDirectFile:t,mediaElementTracksStore:r}=this._priv_contentInfos;return t?(i=r==null?void 0:r.getAvailableTextTracks())!=null?i:[]:this._priv_callTracksStoreGetterSetter(e,[],(o,a)=>{var s;return(s=o.getAvailableTextTracks(a))!=null?s:[]})}getAvailableVideoTracks(e){var a,s;if(this._priv_contentInfos===null)return[];let{isDirectFile:t,mediaElementTracksStore:r}=this._priv_contentInfos;if(t)return(a=r==null?void 0:r.getAvailableVideoTracks())!=null?a:[];let i,o=!0;return typeof e=="string"?i=e:(i=e==null?void 0:e.periodId,o=(s=e==null?void 0:e.filterPlayableRepresentations)!=null?s:!0),this._priv_callTracksStoreGetterSetter(i,[],(d,u)=>{var c;return(c=d.getAvailableVideoTracks(u,o))!=null?c:[]})}getAudioTrack(e){var a;if(this._priv_contentInfos===null)return;let{isDirectFile:t,mediaElementTracksStore:r}=this._priv_contentInfos;if(t)return r===null?void 0:r.getChosenAudioTrack();let i,o=!0;return typeof e=="string"?i=e:(i=e==null?void 0:e.periodId,o=(a=e==null?void 0:e.filterPlayableRepresentations)!=null?a:!0),this._priv_callTracksStoreGetterSetter(i,void 0,(s,d)=>s.getChosenAudioTrack(d,o))}getTextTrack(e){if(this._priv_contentInfos===null)return;let{isDirectFile:t,mediaElementTracksStore:r}=this._priv_contentInfos;return t?r===null?void 0:r.getChosenTextTrack():this._priv_callTracksStoreGetterSetter(e,void 0,(i,o)=>i.getChosenTextTrack(o))}getVideoTrack(e){var a;if(this._priv_contentInfos===null)return;let{isDirectFile:t,mediaElementTracksStore:r}=this._priv_contentInfos;if(t)return r===null?void 0:r.getChosenVideoTrack();let i,o=!0;return typeof e=="string"?i=e:(i=e==null?void 0:e.periodId,o=(a=e==null?void 0:e.filterPlayableRepresentations)!=null?a:!0),this._priv_callTracksStoreGetterSetter(i,void 0,(s,d)=>s.getChosenVideoTrack(d,o))}setAudioTrack(e){var u;if(this._priv_contentInfos===null)throw new Error("No content loaded");let{isDirectFile:t,mediaElementTracksStore:r}=this._priv_contentInfos;if(t)try{let c=typeof e=="string"?e:e.trackId;r==null||r.setAudioTrackById(c);return}catch(c){throw new Error("player: unknown audio track")}let i,o,a,s=null,d;return typeof e=="string"?o=e:(o=e.trackId,i=e.periodId,a=e.switchingMode,s=(u=e.lockedRepresentations)!=null?u:null,d=e.relativeResumingPosition),this._priv_callTracksStoreGetterSetter(i,void 0,(c,l)=>c.setAudioTrack({periodRef:l,trackId:o,switchingMode:a,lockedRepresentations:s,relativeResumingPosition:d}))}setTextTrack(e){if(this._priv_contentInfos===null)throw new Error("No content loaded");let{isDirectFile:t,mediaElementTracksStore:r}=this._priv_contentInfos;if(t)try{let a=typeof e=="string"?e:e.trackId;r==null||r.setTextTrackById(a);return}catch(a){throw new Error("player: unknown text track")}let i,o;return typeof e=="string"?o=e:(o=e.trackId,i=e.periodId),this._priv_callTracksStoreGetterSetter(i,void 0,(a,s)=>a.setTextTrack(s,o))}disableTextTrack(e){if(this._priv_contentInfos===null)return;let{isDirectFile:t,mediaElementTracksStore:r}=this._priv_contentInfos;if(t){r==null||r.disableTextTrack();return}return this._priv_callTracksStoreGetterSetter(e,void 0,(i,o)=>i.disableTrack(o,"text"))}setVideoTrack(e){var u;if(this._priv_contentInfos===null)throw new Error("No content loaded");let{isDirectFile:t,mediaElementTracksStore:r}=this._priv_contentInfos;if(t)try{let c=typeof e=="string"?e:e.trackId;r==null||r.setVideoTrackById(c);return}catch(c){throw new Error("player: unknown video track")}let i,o,a,s=null,d;return typeof e=="string"?o=e:(o=e.trackId,i=e.periodId,a=e.switchingMode,s=(u=e.lockedRepresentations)!=null?u:null,d=e.relativeResumingPosition),this._priv_callTracksStoreGetterSetter(i,void 0,(c,l)=>c.setVideoTrack({periodRef:l,trackId:o,switchingMode:a,lockedRepresentations:s,relativeResumingPosition:d}))}disableVideoTrack(e){if(this._priv_contentInfos===null)return;let{isDirectFile:t,mediaElementTracksStore:r}=this._priv_contentInfos;return t&&r!==null?r.disableVideoTrack():this._priv_callTracksStoreGetterSetter(e,void 0,(i,o)=>i.disableTrack(o,"video"))}lockVideoRepresentations(e){if(this._priv_contentInfos===null)throw new Error("No content loaded");let{isDirectFile:t}=this._priv_contentInfos;if(t)throw new Error("Cannot lock video Representations in directfile mode.");let r,i,o;return Array.isArray(e)?(r=e,i=void 0):(r=e.representations,i=e.periodId,o=e.switchingMode),this._priv_callTracksStoreGetterSetter(i,void 0,(a,s)=>a.lockVideoRepresentations(s,{representations:r,switchingMode:o}))}disableAudioTrack(e){if(this._priv_contentInfos===null)return;let{isDirectFile:t,mediaElementTracksStore:r}=this._priv_contentInfos;return t&&r!==null?r.disableAudioTrack():this._priv_callTracksStoreGetterSetter(e,void 0,(i,o)=>i.disableTrack(o,"audio"))}lockAudioRepresentations(e){if(this._priv_contentInfos===null)throw new Error("No content loaded");let{isDirectFile:t}=this._priv_contentInfos;if(t)throw new Error("Cannot lock audio Representations in directfile mode.");let r,i,o;return Array.isArray(e)?(r=e,i=void 0):(r=e.representations,i=e.periodId,o=e.switchingMode),this._priv_callTracksStoreGetterSetter(i,void 0,(a,s)=>a.lockAudioRepresentations(s,{representations:r,switchingMode:o}))}getLockedVideoRepresentations(e){if(this._priv_contentInfos===null)return null;let{isDirectFile:t}=this._priv_contentInfos;return t?null:this._priv_callTracksStoreGetterSetter(e,null,(r,i)=>r.getLockedVideoRepresentations(i))}getLockedAudioRepresentations(e){if(this._priv_contentInfos===null)return null;let{isDirectFile:t}=this._priv_contentInfos;return t?null:this._priv_callTracksStoreGetterSetter(e,null,(r,i)=>r.getLockedAudioRepresentations(i))}unlockVideoRepresentations(e){if(this._priv_contentInfos===null)return;let{isDirectFile:t}=this._priv_contentInfos;if(!t)return this._priv_callTracksStoreGetterSetter(e,void 0,(r,i)=>r.unlockVideoRepresentations(i))}unlockAudioRepresentations(e){if(this._priv_contentInfos===null)return;let{isDirectFile:t}=this._priv_contentInfos;if(!t)return this._priv_callTracksStoreGetterSetter(e,void 0,(r,i)=>r.unlockAudioRepresentations(i))}getMinimumPosition(){if(this._priv_contentInfos===null)return null;if(this._priv_contentInfos.isDirectFile)return 0;let{manifest:e}=this._priv_contentInfos;return e!==null?bn(e):null}getLivePosition(){if(this._priv_contentInfos===null)return null;let{isDirectFile:e,manifest:t}=this._priv_contentInfos;if(!e)return(t==null?void 0:t.isLive)!==!0?null:Sn(t)}getMaximumPosition(){if(this._priv_contentInfos===null)return null;let{isDirectFile:e,manifest:t}=this._priv_contentInfos;if(e){if(this.videoElement===null)throw new Error("Disposed player");return this.videoElement.duration}return t!==null?!t.isDynamic&&this.videoElement!==null?this.videoElement.duration:kt(t):null}async __priv_getSegmentSinkMetrics(){var e,t;return(t=(e=this._priv_contentInfos)==null?void 0:e.segmentSinkMetricsCallback)==null?void 0:t.call(e)}__priv_getManifest(){return this._priv_contentInfos===null?null:this._priv_contentInfos.manifest}__priv_getCurrentAdaptation(){if(this._priv_contentInfos===null)return null;let{currentPeriod:e,activeAdaptations:t}=this._priv_contentInfos;return e===null||t===null||_(t[e.id])?null:t[e.id]}__priv_getCurrentRepresentations(){if(this._priv_contentInfos===null)return null;let{currentPeriod:e,activeRepresentations:t}=this._priv_contentInfos;return e===null||t===null||_(t[e.id])?null:t[e.id]}_priv_cleanUpCurrentContentState(){var t,r,i,o;m.debug("API","Locking `contentLock` to clean-up the current content."),this._priv_contentLock.setValue(!0),(r=(t=this._priv_contentInfos)==null?void 0:t.tracksStore)==null||r.dispose(),(o=(i=this._priv_contentInfos)==null?void 0:i.mediaElementTracksStore)==null||o.dispose(),this._priv_contentInfos=null,this._priv_contentEventsMemory={};let e=()=>{this.videoElement!==null&&(m.debug("API","Unlocking `contentLock`. Next content can begin."),this._priv_contentLock.setValue(!1))};_(this.videoElement)?e():Ho(this.videoElement).then(()=>{m.debug("API","DRM session cleaned-up with success!"),e()},a=>{m.error("API","An error arised when trying to clean-up the DRM session:"+(a instanceof Error?a.toString():"Unknown Error")),e()})}_priv_onManifestReady(e,t){var i;if(e.contentId!==((i=this._priv_contentInfos)==null?void 0:i.contentId))return;e.manifest=t,t.manifestFormat===0&&(this._priv_reloadingMetadata.manifest=t);let r=new Ap({preferTrickModeTracks:this._priv_preferTrickModeTracks,defaultAudioTrackSwitchingMode:e.defaultAudioTrackSwitchingMode,onTracksNotPlayableForType:{audio:e.onAudioTracksNotPlayable,video:e.onVideoTracksNotPlayable,text:"continue"}});e.tracksStore=r,r.addEventListener("newAvailablePeriods",o=>{this.trigger("newAvailablePeriods",o)}),r.addEventListener("brokenRepresentationsLock",o=>{this.trigger("brokenRepresentationsLock",o)}),r.addEventListener("trackUpdate",o=>{var s,d;this.trigger("trackUpdate",o);let a=(d=(s=this._priv_contentInfos)==null?void 0:s.currentPeriod)!=null?d:void 0;o.reason==="no-playable-representation"&&o.period.id===(a==null?void 0:a.id)&&this._priv_onAvailableTracksMayHaveChanged(o.trackType)}),r.addEventListener("warning",o=>{this.trigger("warning",o)}),r.addEventListener("error",o=>{this._priv_onFatalError(o,e)}),r.addEventListener("noPlayableTrack",o=>{this.trigger("noPlayableTrack",o)}),r.onManifestUpdate(t)}_priv_onManifestUpdate(e,t){var o,a,s;if(this._priv_contentInfos===null||this._priv_contentInfos.manifest===null)return;_(e==null?void 0:e.tracksStore)||e.tracksStore.onManifestUpdate(this._priv_contentInfos.manifest);let r=(a=(o=this._priv_contentInfos)==null?void 0:o.currentPeriod)!=null?a:void 0,i=(s=this._priv_contentInfos)==null?void 0:s.tracksStore;if(!(r===void 0||_(i))){for(let d of t.updatedPeriods)if(d.period.id===r.id&&(d.result.addedAdaptations.length>0||d.result.removedAdaptations.length>0)){if(i.getPeriodObjectFromPeriod(r)===void 0)return;this._priv_onAvailableTracksMayHaveChanged("audio"),this._priv_onAvailableTracksMayHaveChanged("text"),this._priv_onAvailableTracksMayHaveChanged("video")}}}_priv_onCodecSupportUpdate(e){let t=e==null?void 0:e.tracksStore;_(t)||t.onManifestCodecSupportUpdate()}_priv_onDecipherabilityUpdate(e,t){if(e===null||e.manifest===null)return;_(e==null?void 0:e.tracksStore)||e.tracksStore.onDecipherabilityUpdates();let r=t.reduce((i,o)=>{var s,d,u;if(!(Q(i,c=>c[0].id===o.period.id&&c[1]===o.adaptation.type)!==void 0)){let c=e.tracksStore;if(c===null)return i;let l=!1,f=c.getPeriodObjectFromPeriod(o.period);if(f===void 0)return i;switch(o.adaptation.type){case"audio":l=((s=c.getChosenAudioTrack(f,!1))==null?void 0:s.id)===o.adaptation.id;break;case"video":l=((d=c.getChosenVideoTrack(f,!1))==null?void 0:d.id)===o.adaptation.id;break;case"text":l=((u=c.getChosenTextTrack(f))==null?void 0:u.id)===o.adaptation.id;break}l&&i.push([o.period,o.adaptation.type])}return i},[]);for(let[i,o]of r)this._priv_triggerEventIfNotStopped("representationListUpdate",{period:{start:i.start,end:i.end,id:i.id},trackType:o,reason:"decipherability-update"},e.currentContentCanceller.signal)}_priv_onActivePeriodChanged(e,{period:t}){var s,d,u,c,l,f;if(e.contentId!==((s=this._priv_contentInfos)==null?void 0:s.contentId))return;e.currentPeriod=t;let r=e.currentContentCanceller.signal;this._priv_contentEventsMemory.periodChange!==t&&(this._priv_contentEventsMemory.periodChange=t,this._priv_triggerEventIfNotStopped("periodChange",{start:t.start,end:t.end,id:t.id},r)),this._priv_triggerEventIfNotStopped("availableAudioTracksChange",this.getAvailableAudioTracks(),r),this._priv_triggerEventIfNotStopped("availableTextTracksChange",this.getAvailableTextTracks(),r),this._priv_triggerEventIfNotStopped("availableVideoTracksChange",this.getAvailableVideoTracks(),r);let i=(d=this._priv_contentInfos)==null?void 0:d.tracksStore;if(_(i))this._priv_triggerEventIfNotStopped("audioTrackChange",null,r),this._priv_triggerEventIfNotStopped("textTrackChange",null,r),this._priv_triggerEventIfNotStopped("videoTrackChange",null,r);else{let p=i.getPeriodObjectFromPeriod(t);if(p!==void 0){let g=i.getChosenAudioTrack(p,!0);this._priv_triggerEventIfNotStopped("audioTrackChange",g,r);let I=i.getChosenTextTrack(p);this._priv_triggerEventIfNotStopped("textTrackChange",I,r);let h=i.getChosenVideoTrack(p,!0);this._priv_triggerEventIfNotStopped("videoTrackChange",h,r)}}let o=(c=(u=this.__priv_getCurrentRepresentations())==null?void 0:u.audio)!=null?c:null;this._priv_triggerEventIfNotStopped("audioRepresentationChange",_(o)?o:In(o),r);let a=(f=(l=this.__priv_getCurrentRepresentations())==null?void 0:l.video)!=null?f:null;this._priv_triggerEventIfNotStopped("videoRepresentationChange",_(a)?a:In(a),r)}_priv_onPeriodStreamReady(e,t){var s;if(e.contentId!==((s=this._priv_contentInfos)==null?void 0:s.contentId))return;let{type:r,period:i,adaptationRef:o}=t,a=e.tracksStore;switch(r){case"video":case"audio":case"text":_(a)?(m.error("API",`TracksStore not instanciated for a new ${r} period`),o.setValue(null)):a.addTrackReference(r,i,o);break;default:ze(r)}}_priv_onPeriodStreamCleared(e,t){var d;if(e.contentId!==((d=this._priv_contentInfos)==null?void 0:d.contentId))return;let{type:r,periodId:i}=t,o=e.tracksStore;switch(r){case"audio":case"text":case"video":_(o)||o.removeTrackReference(r,i);break}let{activeAdaptations:a,activeRepresentations:s}=e;if(!_(a)&&!_(a[i])){let u=a[i];delete u[r],Object.keys(u).length===0&&delete a[i]}if(!_(s)&&!_(s[i])){let u=s[i];delete u[r],Object.keys(u).length===0&&delete s[i]}}_priv_onAdaptationChange(e,{type:t,adaptation:r,period:i}){var c;if(e.contentId!==((c=this._priv_contentInfos)==null?void 0:c.contentId))return;e.activeAdaptations===null&&(e.activeAdaptations={});let{activeAdaptations:o,currentPeriod:a}=e,s=o[i.id];_(s)?o[i.id]={[t]:r}:s[t]=r;let{tracksStore:d}=e,u=e.currentContentCanceller.signal;if(d!==null&&a!==null&&!_(i)&&i.id===a.id){let l=d.getPeriodObjectFromPeriod(i);if(l===void 0)return;switch(t){case"audio":{let f=d.getChosenAudioTrack(l,!0);this._priv_triggerEventIfNotStopped("audioTrackChange",f,u);break}case"text":{let f=d.getChosenTextTrack(l);this._priv_triggerEventIfNotStopped("textTrackChange",f,u);break}case"video":{let f=d.getChosenVideoTrack(l,!0);this._priv_triggerEventIfNotStopped("videoTrackChange",f,u);break}}}}_priv_onRepresentationChange(e,{type:t,period:r,representation:i}){var d;if(e.contentId!==((d=this._priv_contentInfos)==null?void 0:d.contentId))return;e.activeRepresentations===null&&(e.activeRepresentations={});let{activeRepresentations:o,currentPeriod:a}=e,s=o[r.id];if(_(s)?o[r.id]={[t]:i}:s[t]=i,!_(r)&&a!==null&&a.id===r.id){let u=this._priv_contentInfos.currentContentCanceller.signal;t==="video"?this._priv_triggerEventIfNotStopped("videoRepresentationChange",_(i)?i:In(i),u):t==="audio"&&this._priv_triggerEventIfNotStopped("audioRepresentationChange",_(i)?i:Ko(i),u)}}_priv_onBitrateEstimateChange({type:e,bitrate:t}){t!==void 0&&(this._priv_bitrateInfos.lastBitrates[e]=t),this.trigger("__priv_bitrateEstimateChange",{type:e,bitrate:t})}_priv_setPlayerState(e){this.state!==e&&(this.state=e,m.info("API","playerStateChange event",{newState:e}),this.trigger("playerStateChange",e))}_priv_triggerPositionUpdate(e,t){var s,d;if(e.contentId!==((s=this._priv_contentInfos)==null?void 0:s.contentId))return;let{isDirectFile:r,manifest:i}=e;if(!r&&i===null||_(t))return;let o=i!==null?kt(i):void 0,a={position:t.position.getPolled(),duration:t.duration,playbackRate:t.playbackRate,maximumPosition:o,bufferGap:t.bufferGap===void 0||!isFinite(t.bufferGap)?0:t.bufferGap};if(i!==null&&i.isLive&&t.position.getPolled()>0){let u=(d=i.availabilityStartTime)!=null?d:0;a.wallClockTime=t.position.getPolled()+u;let c=Sn(i);c!==void 0&&(a.liveGap=c-t.position.getPolled())}else if(r&&this.videoElement!==null){let u=yo(this.videoElement);u!==void 0&&(a.wallClockTime=u+t.position.getPolled())}this.trigger("positionUpdate",a)}_priv_triggerEventIfNotStopped(e,t,r){r.isCancelled()||this.trigger(e,t)}_priv_initializeMediaElementTracksStore(e){var r,i,o;J(pe.directfile!==null,"Initializing `MediaElementTracksStore` without Directfile feature"),J(this.videoElement!==null,"Initializing `MediaElementTracksStore` on a disposed RxPlayer");let t=new pe.directfile.mediaElementTracksStore(this.videoElement);return this._priv_triggerEventIfNotStopped("availableAudioTracksChange",t.getAvailableAudioTracks(),e),this._priv_triggerEventIfNotStopped("availableVideoTracksChange",t.getAvailableVideoTracks(),e),this._priv_triggerEventIfNotStopped("availableTextTracksChange",t.getAvailableTextTracks(),e),this._priv_triggerEventIfNotStopped("audioTrackChange",(r=t.getChosenAudioTrack())!=null?r:null,e),this._priv_triggerEventIfNotStopped("textTrackChange",(i=t.getChosenTextTrack())!=null?i:null,e),this._priv_triggerEventIfNotStopped("videoTrackChange",(o=t.getChosenVideoTrack())!=null?o:null,e),t.addEventListener("availableVideoTracksChange",a=>this.trigger("availableVideoTracksChange",a)),t.addEventListener("availableAudioTracksChange",a=>this.trigger("availableAudioTracksChange",a)),t.addEventListener("availableTextTracksChange",a=>this.trigger("availableTextTracksChange",a)),t.addEventListener("audioTrackChange",a=>this.trigger("audioTrackChange",a)),t.addEventListener("videoTrackChange",a=>this.trigger("videoTrackChange",a)),t.addEventListener("textTrackChange",a=>this.trigger("textTrackChange",a)),t}_priv_callTracksStoreGetterSetter(e,t,r){var d,u;if(this._priv_contentInfos===null||this._priv_contentInfos.tracksStore===null)return m.warn("API","Trying to call track API too soon"),t;let{tracksStore:i}=this._priv_contentInfos,o=(u=(d=this._priv_contentInfos)==null?void 0:d.currentPeriod)!=null?u:void 0,a=e!=null?e:o==null?void 0:o.id;if(a===void 0)return t;let s=a===(o==null?void 0:o.id)?i.getPeriodObjectFromPeriod(o):i.getPeriodObjectFromId(a);return s===void 0?t:r(i,s)}_priv_onAvailableTracksMayHaveChanged(e,t){let r=this._priv_contentInfos;if(r===null)return;let{currentPeriod:i,tracksStore:o,currentContentCanceller:a}=r,s=a.signal;if(_(i)||o===null)return;let d=t!=null?t:o.getPeriodObjectFromPeriod(i);if(d!==void 0)switch(e){case"video":{let u=o.getAvailableVideoTracks(d,!0);this._priv_triggerEventIfNotStopped("availableVideoTracksChange",u!=null?u:[],s);break}case"audio":{let u=o.getAvailableAudioTracks(d,!0);this._priv_triggerEventIfNotStopped("availableAudioTracksChange",u!=null?u:[],s);break}case"text":{let u=o.getAvailableTextTracks(d);this._priv_triggerEventIfNotStopped("availableTextTracksChange",u!=null?u:[],s);break}default:ze(e)}}_priv_onFatalError(e,t){let r=Me(e,{defaultCode:"NONE",defaultReason:"An unknown error stopped content playback."});r.fatal=!0,t.currentContentCanceller.cancel(),this._priv_cleanUpCurrentContentState(),this._priv_currentError=r,m.error("API","The player stopped because of an error",r),this._priv_setPlayerState("STOPPED"),this._priv_currentError===r&&this.trigger("error",r)}};Yt._priv_currentlyUsedVideoElements=new WeakSet;var Ir=Yt;Ir.version="4.4.1-dev.2025120800";var Np=Ir;var ns=Np;rs();ns.addFeatures([Vl,xu,Nu,Uu,Ml,Rl,wl,Pl,fl,zu,Tl,qu]);var lue=ns;Z.RxPlayer=ns;})();
23
+ Make sure to dispose the previous instance with player.dispose() before creating a new player instance attaching that video element.`),Yt._priv_currentlyUsedVideoElements.add(e)}static _priv_deregisterVideoElement(e){Yt._priv_currentlyUsedVideoElements.has(e)&&Yt._priv_currentlyUsedVideoElements.delete(e)}constructor(e={}){super();let{baseBandwidth:t,videoResolutionLimit:r,maxBufferAhead:i,maxBufferBehind:o,throttleVideoBitrateWhenHidden:a,videoElement:s,wantedBufferAhead:d,maxVideoBufferSize:u}=Mp(e);s.preload="auto",this.version="4.4.1",this.log=m,this.state="STOPPED",this.videoElement=s,Yt._priv_registerVideoElement(this.videoElement);let c=new U;this._destroyCanceller=c,this._priv_pictureInPictureRef=Nc(s,c.signal),this._priv_speed=new j(s.playbackRate,this._destroyCanceller.signal),this._priv_preferTrickModeTracks=!1,this._priv_contentLock=new j(!1,this._destroyCanceller.signal),this._priv_bufferOptions={wantedBufferAhead:new j(d,this._destroyCanceller.signal),maxBufferAhead:new j(i,this._destroyCanceller.signal),maxBufferBehind:new j(o,this._destroyCanceller.signal),maxVideoBufferSize:new j(u,this._destroyCanceller.signal)},this._priv_bitrateInfos={lastBitrates:{audio:t,video:t}},this._priv_throttleVideoBitrateWhenHidden=a,this._priv_videoResolutionLimit=r,this._priv_currentError=null,this._priv_contentInfos=null,this._priv_contentEventsMemory={},this._priv_reloadingMetadata={},this._priv_lastAutoPlay=!1,this._priv_worker=null;let l=()=>{this.trigger("volumeChange",{volume:s.volume,muted:s.muted})};s.addEventListener("volumechange",l),c.signal.register(()=>{s.removeEventListener("volumechange",l)})}attachWorker(e){return new Promise((t,r)=>{var a;if(!Wl())return m.warn("API","Cannot rely on a WebWorker: Worker API unavailable"),r(new mn("INCOMPATIBLE_ERROR","Worker unavailable"));if(this._priv_worker!==null){if(this.state!=="STOPPED")return m.warn("API","Cannot attach a new worker while a content is playing, please stop the player first."),r(new mn("SETUP_ERROR","Cannot attach a new worker while a content is playing"));this._priv_worker.terminate()}if(typeof e.workerUrl=="string")this._priv_worker=new Worker(e.workerUrl);else{let s=URL.createObjectURL(e.workerUrl);this._priv_worker=new Worker(s),URL.revokeObjectURL(s)}this._priv_worker.onerror=s=>{this._priv_worker!==null&&(this._priv_worker.terminate(),this._priv_worker=null),m.error("API","Unexpected worker error",s.error instanceof Error?s.error:void 0),r(new mn("UNKNOWN_ERROR",'Unexpected Worker "error" event'))};let i=s=>{let d=s.data;d.type==="init-error"?(m.warn("API","Processing InitError worker message: detaching worker"),this._priv_worker!==null&&(this._priv_worker.removeEventListener("message",i),this._priv_worker.terminate(),this._priv_worker=null),r(new mn("SETUP_ERROR","Worker parser initialization failed: "+d.value.errorMessage))):d.type==="init-success"&&(m.info("API","InitSuccess received from worker."),this._priv_worker!==null&&this._priv_worker.removeEventListener("message",i),t())};this._priv_worker.addEventListener("message",i),m.debug("M-->C","Sending message",{name:"init"}),this._priv_worker.postMessage({type:"init",value:{dashWasmUrl:e.dashWasmUrl,logLevel:m.getLevel(),logFormat:m.getFormat(),sendBackLogs:_o,date:Date.now(),timestamp:z(),hasVideo:((a=this.videoElement)==null?void 0:a.nodeName.toLowerCase())==="video"}}),m.addEventListener("onLogLevelChange",s=>{this._priv_worker!==null&&(m.debug("M-->C","Sending message",{name:"log-level-update"}),this._priv_worker.postMessage({type:"log-level-update",value:{logLevel:s.level,logFormat:s.format,sendBackLogs:_o}}))},this._destroyCanceller.signal);let o=s=>{this._priv_worker!==null&&(m.debug("M-->C","Sending message:",{name:"config-update"}),this._priv_worker.postMessage({type:"config-update",value:s}))};O.updated&&o(O.getCurrent()),O.addEventListener("update",o,this._destroyCanceller.signal)})}getCurrentModeInformation(){return this._priv_contentInfos===null?null:{isDirectFile:this._priv_contentInfos.isDirectFile,useWorker:this._priv_contentInfos.useWorker}}addEventListener(e,t){return super.addEventListener(e,t)}stop(){this._priv_contentInfos!==null&&this._priv_contentInfos.currentContentCanceller.cancel(),this._priv_cleanUpCurrentContentState(),this.state!=="STOPPED"&&this._priv_setPlayerState("STOPPED")}dispose(){this.stop(),this.videoElement!==null&&(Yt._priv_deregisterVideoElement(this.videoElement),qn(this.videoElement).catch(e=>{let t=e instanceof Error?e.message:"Unknown error";m.error("API","Could not dispose decryption resources: "+t)})),this._destroyCanceller.cancel(),this._priv_reloadingMetadata={},this.videoElement=null,this._priv_worker!==null&&(this._priv_worker.terminate(),this._priv_worker=null)}loadVideo(e){let t=wp(e);m.info("API","Calling loadvideo",{url:t.url,transport:t.transport}),this._priv_reloadingMetadata={options:t},this._priv_initializeContentPlayback(t),this._priv_lastAutoPlay=t.autoPlay}reload(e){var c,l,f;let{options:t,manifest:r,reloadPosition:i,reloadInPause:o}=this._priv_reloadingMetadata;if(t===void 0)throw new Error("API: Can't reload without having previously loaded a content.");xp(e);let a;if(((c=e==null?void 0:e.reloadAt)==null?void 0:c.position)!==void 0)a={position:e.reloadAt.position};else if(((l=e==null?void 0:e.reloadAt)==null?void 0:l.relative)!==void 0){if(i===void 0)throw new Error("Can't reload to a relative position when previous content was not loaded.");a={position:e.reloadAt.relative+i}}else i!==void 0&&(a={position:i});let s;(e==null?void 0:e.autoPlay)!==void 0?s=e.autoPlay:o!==void 0&&(s=!o);let d;(e==null?void 0:e.keySystems)!==void 0?d=e.keySystems:((f=this._priv_reloadingMetadata.options)==null?void 0:f.keySystems)!==void 0&&(d=this._priv_reloadingMetadata.options.keySystems);let u=ue(ae({},t),{initialManifest:r});a!==void 0&&(u.startAt=a),s!==void 0&&(u.autoPlay=s),d!==void 0&&(u.keySystems=d),this._priv_initializeContentPlayback(u)}createDebugElement(e){if(pe.createDebugElement===null)throw new Error("Feature `DEBUG_ELEMENT` not added to the RxPlayer");let t=new U;return pe.createDebugElement(e,this,t.signal),{dispose(){t.cancel()}}}getAvailableThumbnailTracks({time:e,periodId:t}={}){if(this._priv_contentInfos===null||this._priv_contentInfos.manifest===null)return[];let{manifest:r}=this._priv_contentInfos,i;if(e!==void 0){if(i=Hn(this._priv_contentInfos.manifest,e),i===void 0||i.thumbnailTracks.length===0)return[]}else if(t!==void 0){if(i=Q(r.periods,o=>o.id===t),i===void 0)return m.error("API","getAvailableThumbnailTracks: periodId not found",{periodId:t}),[]}else{let{currentPeriod:o}=this._priv_contentInfos;if(o===null)return[];i=o}return i.thumbnailTracks.map(o=>({id:o.id,width:Math.floor(o.width/o.horizontalTiles),height:Math.floor(o.height/o.verticalTiles),mimeType:o.mimeType}))}async renderThumbnail(e){if(_(e.time))throw new Error("You have to provide a `time` property to `renderThumbnail`, indicating the wanted thumbnail time in seconds.");if(_(e.container))throw new Error("You have to provide a `container` property to `renderThumbnail`, specifying the HTML Element in which the thumbnail should be inserted.");return Hl(this._priv_contentInfos,e)}_priv_initializeContentPlayback(e){var oe,fe,Re,ge,he,vt;let{autoPlay:t,cmcd:r,defaultAudioTrackSwitchingMode:i,enableFastSwitching:o,initialManifest:a,keySystems:s,lowLatencyMode:d,minimumManifestUpdateInterval:u,requestConfig:c,onCodecSwitch:l,startAt:f,transport:p,checkMediaSegmentIntegrity:g,checkManifestIntegrity:I,manifestLoader:h,referenceDateTime:S,segmentLoader:T,serverSyncInfos:v,mode:E,experimentalOptions:R,__priv_manifestUpdateUrl:k,__priv_patchLastSegmentInSidx:x,url:P,onAudioTracksNotPlayable:M,onVideoTracksNotPlayable:L}=e;if(this.videoElement===null)throw new Error("the attached video element is disposed");let K=p==="directfile",D=new U,B=this.videoElement,A,C=!1,N=null;if(K){if(pe.directfile===null)throw this.stop(),this._priv_currentError=null,new Error("DirectFile feature not activated in your build.");if(_(P))throw new Error("No URL for a DirectFile content");if(m.info("API","Initializing DirectFile mode in the main thread"),N=this._priv_initializeMediaElementTracksStore(D.signal),D.isUsed())return;A=new pe.directfile.initDirectFile({autoPlay:t,keySystems:s,speed:this._priv_speed,startAt:f,url:P})}else{let te={lowLatencyMode:d,maxRetry:(oe=c.manifest)==null?void 0:oe.maxRetry,requestTimeout:(fe=c.manifest)==null?void 0:fe.timeout,connectionTimeout:(Re=c.manifest)==null?void 0:Re.connectionTimeout,minimumManifestUpdateInterval:u,initialManifest:a},ye=zl(),ot={throttleBitrate:{},limitResolution:{}};this._priv_throttleVideoBitrateWhenHidden&&(ye?ot.throttleBitrate={video:gn(Uc(this._priv_pictureInPictureRef,D.signal),Qt=>Qt?1/0:0,D.signal)}:m.warn("API","Can't apply throttleVideoBitrateWhenHidden because browser can't be trusted for visibility.")),this._priv_videoResolutionLimit==="videoElement"?ye?ot.limitResolution={video:Fc(B,this._priv_pictureInPictureRef,D.signal)}:m.warn("API","Can't apply videoResolutionLimit because browser can't be trusted for video size."):this._priv_videoResolutionLimit==="screen"&&(ot.limitResolution={video:Bc(D.signal)});let pn={initialBitrates:this._priv_bitrateInfos.lastBitrates,lowLatencyMode:d,throttlers:ot},yt=e.textTrackMode==="native"?{textTrackMode:"native"}:{textTrackMode:"html",textTrackElement:e.textTrackElement},It=Y({enableFastSwitching:o,onCodecSwitch:l},this._priv_bufferOptions),$l={lowLatencyMode:d,maxRetry:(ge=c.segment)==null?void 0:ge.maxRetry,requestTimeout:(he=c.segment)==null?void 0:he.timeout,connectionTimeout:(vt=c.segment)==null?void 0:vt.connectionTimeout},Up=pe.multithread!==null&&this._priv_worker!==null&&this.videoElement.FORCED_MEDIA_SOURCE===void 0&&p==="dash"&&iS.every(Qt=>_(e[Qt]))&&typeof e.representationFilter!="function";if(E==="main"||E==="auto"&&!Up){if(pe.mainThreadMediaSourceInit===null)throw new Error("Cannot load video, neither in a WebWorker nor with the `MEDIA_SOURCE_MAIN` feature");let Qt=pe.transports[p];if(typeof Qt!="function")throw this.stop(),this._priv_currentError=null,new Error(`transport "${p}" not supported`);let Bp=typeof e.representationFilter=="string"?xc(e.representationFilter):e.representationFilter;m.info("API","Initializing MediaSource mode in the main thread");let Fp=Qt({lowLatencyMode:d,checkMediaSegmentIntegrity:g,checkManifestIntegrity:I,manifestLoader:h,referenceDateTime:S,representationFilter:Bp,segmentLoader:T,serverSyncInfos:v,__priv_manifestUpdateUrl:k,__priv_patchLastSegmentInSidx:x});A=new pe.mainThreadMediaSourceInit({adaptiveOptions:pn,autoPlay:t,bufferOptions:It,cmcd:r,enableRepresentationAvoidance:R.enableRepresentationAvoidance,keySystems:s,lowLatencyMode:d,transport:Fp,manifestRequestSettings:te,segmentRequestOptions:$l,speed:this._priv_speed,startAt:f,textTrackOptions:yt,url:P})}else{if(pe.multithread===null)throw new Error("Cannot load video in multithread mode: `MULTI_THREAD` feature not imported.");if(this._priv_worker===null)throw new Error("Cannot load video in multithread mode: `attachWorker` method not called.");J(typeof e.representationFilter!="function"),C=!0,m.info("API","Initializing MediaSource mode in a WebWorker");let Qt={lowLatencyMode:d,checkMediaSegmentIntegrity:g,checkManifestIntegrity:I,referenceDateTime:S,serverSyncInfos:v,manifestLoader:void 0,segmentLoader:void 0,representationFilter:e.representationFilter,__priv_manifestUpdateUrl:k,__priv_patchLastSegmentInSidx:x};A=new pe.multithread.init({adaptiveOptions:pn,autoPlay:t,bufferOptions:It,cmcd:r,enableRepresentationAvoidance:R.enableRepresentationAvoidance,keySystems:s,lowLatencyMode:d,transportOptions:Qt,manifestRequestSettings:te,segmentRequestOptions:$l,speed:this._priv_speed,startAt:f,textTrackOptions:yt,worker:this._priv_worker,url:P,useMseInWorker:Rm})}}let F=new bo({withMediaSource:!K,lowLatencyMode:d});F.blockSeeking(),D.signal.register(()=>{F.stop()});let G={contentId:rS(),originalUrl:P,playbackObserver:F,currentContentCanceller:D,defaultAudioTrackSwitchingMode:i,initializer:A,isDirectFile:K,manifest:null,currentPeriod:null,activeAdaptations:null,activeRepresentations:null,tracksStore:null,mediaElementTracksStore:N,useWorker:C,segmentSinkMetricsCallback:null,fetchThumbnailDataCallback:null,thumbnailRequestsInfo:{pendingRequests:new WeakMap,lastResponse:null},onAudioTracksNotPlayable:M,onVideoTracksNotPlayable:L};A.addEventListener("error",te=>{this._priv_onFatalError(te,G)}),A.addEventListener("warning",te=>{let ye=Me(te,{defaultCode:"NONE",defaultReason:"An unknown error happened."});m.warn("API","Sending warning:",ye),this.trigger("warning",ye)}),A.addEventListener("reloadingMediaSource",te=>{G.tracksStore!==null&&G.tracksStore.resetPeriodObjects(),this._priv_contentInfos!==null&&(this._priv_contentInfos.segmentSinkMetricsCallback=null),this._priv_lastAutoPlay=te.autoPlay}),A.addEventListener("inbandEvents",te=>this.trigger("inbandEvents",te)),A.addEventListener("streamEvent",te=>this.trigger("streamEvent",te)),A.addEventListener("streamEventSkip",te=>this.trigger("streamEventSkip",te)),A.addEventListener("activePeriodChanged",te=>this._priv_onActivePeriodChanged(G,te)),A.addEventListener("periodStreamReady",te=>this._priv_onPeriodStreamReady(G,te)),A.addEventListener("periodStreamCleared",te=>this._priv_onPeriodStreamCleared(G,te)),A.addEventListener("representationChange",te=>this._priv_onRepresentationChange(G,te)),A.addEventListener("adaptationChange",te=>this._priv_onAdaptationChange(G,te)),A.addEventListener("bitrateEstimateChange",te=>this._priv_onBitrateEstimateChange(te)),A.addEventListener("manifestReady",te=>this._priv_onManifestReady(G,te)),A.addEventListener("manifestUpdate",te=>this._priv_onManifestUpdate(G,te)),A.addEventListener("codecSupportUpdate",()=>this._priv_onCodecSupportUpdate(G)),A.addEventListener("decipherabilityUpdate",te=>this._priv_onDecipherabilityUpdate(G,te)),A.addEventListener("loaded",te=>{this._priv_contentInfos!==null&&(this._priv_contentInfos.segmentSinkMetricsCallback=te.getSegmentSinkMetrics,this._priv_contentInfos.fetchThumbnailDataCallback=te.getThumbnailData)}),A.prepare(),this.stop(),F.attachMediaElement(B);let X=Lp(A,B,F,K,D.signal);D.signal.register(()=>{A.dispose()});let W=te=>{switch(te){case"STOPPED":case"RELOADING":case"LOADING":break;case"ENDED":this._priv_reloadingMetadata.reloadInPause=!0,this._priv_reloadingMetadata.reloadPosition=F.getReference().getValue().position.getPolled();break;default:{let ye=F.getReference().getValue();this._priv_reloadingMetadata.reloadInPause=ye.paused,this._priv_reloadingMetadata.reloadPosition=ye.position.getWanted();break}}},q=null,H=te=>{q!==null&&(q.cancel(),q=null),X.onUpdate((ye,ot)=>{yr(ye)&&(ot(),q!==null&&q.cancel(),q=new U,q.linkToSignal(D.signal),te!==!B.paused&&(B.paused?this.trigger("pause",null):this.trigger("play",null)),Dp(B,()=>this.trigger("play",null),()=>this.trigger("pause",null),D.signal))},{emitCurrentValue:!1,clearSignal:D.signal})};H(t),A.addEventListener("reloadingMediaSource",te=>{H(te.autoPlay)}),this._priv_currentError=null,this._priv_contentInfos=G;let ie=null;X.onUpdate(te=>{W(te),this._priv_setPlayerState(te),!D.isUsed()&&(ie!==null?yr(this.state)||(ie.cancel(),ie=null):yr(this.state)&&(ie=new U,ie.linkToSignal(D.signal),Op(F,()=>this.trigger("seeking",null),()=>this.trigger("seeked",null),ie.signal)))},{emitCurrentValue:!0,clearSignal:D.signal}),F.listen(te=>{W(this.state),this._priv_triggerPositionUpdate(G,te)},{clearSignal:D.signal}),D.signal.register(()=>{A.removeEventListener()}),this._priv_contentLock.onUpdate((te,ye)=>{te||(ye(),A.start(B,F))},{emitCurrentValue:!0,clearSignal:D.signal})}getError(){return this._priv_currentError}getVideoElement(){return this.videoElement}getPlayerState(){return this.state}isContentLoaded(){return!$(["LOADING","RELOADING","STOPPED"],this.state)}isBuffering(){return $(["BUFFERING","SEEKING","LOADING","RELOADING"],this.state)}isPaused(){return this.videoElement!==null?$(["LOADING","RELOADING"],this.state)?!this._priv_lastAutoPlay:this.videoElement.paused:!0}isLive(){if(this._priv_contentInfos===null)return!1;let{isDirectFile:e,manifest:t}=this._priv_contentInfos;return e||t===null?!1:t.isLive}areTrickModeTracksEnabled(){return this._priv_preferTrickModeTracks}getContentUrls(){if(this._priv_contentInfos===null)return;let{isDirectFile:e,manifest:t,originalUrl:r}=this._priv_contentInfos;if(e)return r===void 0?void 0:[r];if(t!==null)return t.uris}updateContentUrls(e,t){if(this._priv_contentInfos===null)throw new Error("No content loaded");let r=(t==null?void 0:t.refresh)===!0;this._priv_contentInfos.initializer.updateContentUrls(e,r)}getMediaDuration(){if(this.videoElement===null)throw new Error("Disposed player");return this.videoElement.duration}getCurrentBufferGap(){if(this.videoElement===null)throw new Error("Disposed player");let e=this.videoElement,t=hc(e.buffered,e.currentTime);return t===1/0?0:t}getWallClockTime(){if(this.videoElement===null)throw new Error("Disposed player");if(this._priv_contentInfos===null)return this.videoElement.currentTime;let e=this.getWallClockOffset();return this.videoElement.currentTime+e}getWallClockOffset(){var r;if(this.videoElement===null||this._priv_contentInfos===null)return 0;let{isDirectFile:e,manifest:t}=this._priv_contentInfos;if(e){let i=yo(this.videoElement);return i!=null?i:0}return t!==null&&(r=t.availabilityStartTime)!=null?r:0}getPosition(){if(this.videoElement===null)throw new Error("Disposed player");return this.videoElement.currentTime}getLastStoredContentPosition(){return this._priv_reloadingMetadata.reloadPosition}getPlaybackRate(){return this._priv_speed.getValue()}setPlaybackRate(e,t){var o;e!==this._priv_speed.getValue()&&this._priv_speed.setValue(e);let r=t==null?void 0:t.preferTrickModeTracks;if(typeof r!="boolean")return;this._priv_preferTrickModeTracks=r;let i=(o=this._priv_contentInfos)==null?void 0:o.tracksStore;_(i)||(r&&!i.isTrickModeEnabled()?i.enableVideoTrickModeTracks():!r&&i.isTrickModeEnabled()&&i.disableVideoTrickModeTracks())}getVideoRepresentation(){let e=this.__priv_getCurrentRepresentations();if(e!==null)return _(e.video)?e.video:In(e.video)}getAudioRepresentation(){let e=this.__priv_getCurrentRepresentations();if(e!==null)return _(e.audio)?e.video:Ko(e.audio)}play(){if(this.videoElement===null)throw new Error("Disposed player");let e=this.videoElement.play();return _(e)||typeof e.catch!="function"?Promise.resolve():e.catch(t=>{if(t.name==="NotAllowedError"){let r=new re("MEDIA_ERR_PLAY_NOT_ALLOWED",t.toString());this.trigger("warning",r)}throw t})}pause(){if(this.videoElement===null)throw new Error("Disposed player");this.videoElement.pause()}seekTo(e){var o;if(this.videoElement===null)throw new Error("Disposed player");if(this._priv_contentInfos===null)throw new Error("player: no content loaded");let{isDirectFile:t,manifest:r}=this._priv_contentInfos,i;if(typeof e=="number")i=e;else if(typeof e=="object"){let a=e,s=this.videoElement.currentTime;if(!_(a.relative))i=s+a.relative;else if(!_(a.position))i=a.position;else{if(_(a.wallClockTime))throw new Error('invalid time object. You must set one of the following properties: "relative", "position" or "wallClockTime"');if(r!==null)i=a.wallClockTime-((o=r.availabilityStartTime)!=null?o:0);else if(t){if(this.videoElement!==null){let d=yo(this.videoElement);d!==void 0&&(i=a.wallClockTime-d)}}else throw new Error("Cannot seek: wallClockTime asked but Manifest not yet loaded.");i===void 0&&(i=a.wallClockTime)}}if(i===void 0)throw new Error("invalid time given");return m.info("API","API seekTo",{positionWanted:i}),this._priv_contentInfos.playbackObserver.setCurrentTime(i,!1),i}getVolume(){if(this.videoElement===null)throw new Error("Disposed player");return this.videoElement.volume}setVolume(e){if(this.videoElement===null)throw new Error("Disposed player");let t=this.videoElement;e!==t.volume&&(t.volume=e)}isMute(){var e;return((e=this.videoElement)==null?void 0:e.muted)===!0}mute(){if(this.videoElement===null)throw new Error("Disposed player");this.videoElement.muted||(this.videoElement.muted=!0)}unMute(){if(this.videoElement===null)throw new Error("Disposed player");this.videoElement.muted&&(this.videoElement.muted=!1)}setMaxBufferBehind(e){this._priv_bufferOptions.maxBufferBehind.setValue(e)}setMaxBufferAhead(e){this._priv_bufferOptions.maxBufferAhead.setValue(e)}setWantedBufferAhead(e){this._priv_bufferOptions.wantedBufferAhead.setValue(e)}setMaxVideoBufferSize(e){this._priv_bufferOptions.maxVideoBufferSize.setValue(e)}getMaxBufferBehind(){return this._priv_bufferOptions.maxBufferBehind.getValue()}getMaxBufferAhead(){return this._priv_bufferOptions.maxBufferAhead.getValue()}getWantedBufferAhead(){return this._priv_bufferOptions.wantedBufferAhead.getValue()}getMaxVideoBufferSize(){return this._priv_bufferOptions.maxVideoBufferSize.getValue()}getCurrentPeriod(){var t;let e=(t=this._priv_contentInfos)==null?void 0:t.currentPeriod;return _(e)?null:{id:e.id,start:e.start,end:e.end}}getKeySystemConfiguration(){if(this.videoElement===null)throw new Error("Disposed player");let e=Zn(this.videoElement);return e===null?null:{keySystem:e[0],configuration:e[1]}}getAvailablePeriods(){if(this._priv_contentInfos===null)return[];let{isDirectFile:e,tracksStore:t}=this._priv_contentInfos;return e?[]:t===null?[]:t.getAvailablePeriods().slice()}getAvailableAudioTracks(e){var a,s;if(this._priv_contentInfos===null)return[];let{isDirectFile:t,mediaElementTracksStore:r}=this._priv_contentInfos;if(t)return(a=r==null?void 0:r.getAvailableAudioTracks())!=null?a:[];let i,o=!0;return typeof e=="string"?i=e:(i=e==null?void 0:e.periodId,o=(s=e==null?void 0:e.filterPlayableRepresentations)!=null?s:!0),this._priv_callTracksStoreGetterSetter(i,[],(d,u)=>{var c;return(c=d.getAvailableAudioTracks(u,o))!=null?c:[]})}getAvailableTextTracks(e){var i;if(this._priv_contentInfos===null)return[];let{isDirectFile:t,mediaElementTracksStore:r}=this._priv_contentInfos;return t?(i=r==null?void 0:r.getAvailableTextTracks())!=null?i:[]:this._priv_callTracksStoreGetterSetter(e,[],(o,a)=>{var s;return(s=o.getAvailableTextTracks(a))!=null?s:[]})}getAvailableVideoTracks(e){var a,s;if(this._priv_contentInfos===null)return[];let{isDirectFile:t,mediaElementTracksStore:r}=this._priv_contentInfos;if(t)return(a=r==null?void 0:r.getAvailableVideoTracks())!=null?a:[];let i,o=!0;return typeof e=="string"?i=e:(i=e==null?void 0:e.periodId,o=(s=e==null?void 0:e.filterPlayableRepresentations)!=null?s:!0),this._priv_callTracksStoreGetterSetter(i,[],(d,u)=>{var c;return(c=d.getAvailableVideoTracks(u,o))!=null?c:[]})}getAudioTrack(e){var a;if(this._priv_contentInfos===null)return;let{isDirectFile:t,mediaElementTracksStore:r}=this._priv_contentInfos;if(t)return r===null?void 0:r.getChosenAudioTrack();let i,o=!0;return typeof e=="string"?i=e:(i=e==null?void 0:e.periodId,o=(a=e==null?void 0:e.filterPlayableRepresentations)!=null?a:!0),this._priv_callTracksStoreGetterSetter(i,void 0,(s,d)=>s.getChosenAudioTrack(d,o))}getTextTrack(e){if(this._priv_contentInfos===null)return;let{isDirectFile:t,mediaElementTracksStore:r}=this._priv_contentInfos;return t?r===null?void 0:r.getChosenTextTrack():this._priv_callTracksStoreGetterSetter(e,void 0,(i,o)=>i.getChosenTextTrack(o))}getVideoTrack(e){var a;if(this._priv_contentInfos===null)return;let{isDirectFile:t,mediaElementTracksStore:r}=this._priv_contentInfos;if(t)return r===null?void 0:r.getChosenVideoTrack();let i,o=!0;return typeof e=="string"?i=e:(i=e==null?void 0:e.periodId,o=(a=e==null?void 0:e.filterPlayableRepresentations)!=null?a:!0),this._priv_callTracksStoreGetterSetter(i,void 0,(s,d)=>s.getChosenVideoTrack(d,o))}setAudioTrack(e){var u;if(this._priv_contentInfos===null)throw new Error("No content loaded");let{isDirectFile:t,mediaElementTracksStore:r}=this._priv_contentInfos;if(t)try{let c=typeof e=="string"?e:e.trackId;r==null||r.setAudioTrackById(c);return}catch(c){throw new Error("player: unknown audio track")}let i,o,a,s=null,d;return typeof e=="string"?o=e:(o=e.trackId,i=e.periodId,a=e.switchingMode,s=(u=e.lockedRepresentations)!=null?u:null,d=e.relativeResumingPosition),this._priv_callTracksStoreGetterSetter(i,void 0,(c,l)=>c.setAudioTrack({periodRef:l,trackId:o,switchingMode:a,lockedRepresentations:s,relativeResumingPosition:d}))}setTextTrack(e){if(this._priv_contentInfos===null)throw new Error("No content loaded");let{isDirectFile:t,mediaElementTracksStore:r}=this._priv_contentInfos;if(t)try{let a=typeof e=="string"?e:e.trackId;r==null||r.setTextTrackById(a);return}catch(a){throw new Error("player: unknown text track")}let i,o;return typeof e=="string"?o=e:(o=e.trackId,i=e.periodId),this._priv_callTracksStoreGetterSetter(i,void 0,(a,s)=>a.setTextTrack(s,o))}disableTextTrack(e){if(this._priv_contentInfos===null)return;let{isDirectFile:t,mediaElementTracksStore:r}=this._priv_contentInfos;if(t){r==null||r.disableTextTrack();return}return this._priv_callTracksStoreGetterSetter(e,void 0,(i,o)=>i.disableTrack(o,"text"))}setVideoTrack(e){var u;if(this._priv_contentInfos===null)throw new Error("No content loaded");let{isDirectFile:t,mediaElementTracksStore:r}=this._priv_contentInfos;if(t)try{let c=typeof e=="string"?e:e.trackId;r==null||r.setVideoTrackById(c);return}catch(c){throw new Error("player: unknown video track")}let i,o,a,s=null,d;return typeof e=="string"?o=e:(o=e.trackId,i=e.periodId,a=e.switchingMode,s=(u=e.lockedRepresentations)!=null?u:null,d=e.relativeResumingPosition),this._priv_callTracksStoreGetterSetter(i,void 0,(c,l)=>c.setVideoTrack({periodRef:l,trackId:o,switchingMode:a,lockedRepresentations:s,relativeResumingPosition:d}))}disableVideoTrack(e){if(this._priv_contentInfos===null)return;let{isDirectFile:t,mediaElementTracksStore:r}=this._priv_contentInfos;return t&&r!==null?r.disableVideoTrack():this._priv_callTracksStoreGetterSetter(e,void 0,(i,o)=>i.disableTrack(o,"video"))}lockVideoRepresentations(e){if(this._priv_contentInfos===null)throw new Error("No content loaded");let{isDirectFile:t}=this._priv_contentInfos;if(t)throw new Error("Cannot lock video Representations in directfile mode.");let r,i,o;return Array.isArray(e)?(r=e,i=void 0):(r=e.representations,i=e.periodId,o=e.switchingMode),this._priv_callTracksStoreGetterSetter(i,void 0,(a,s)=>a.lockVideoRepresentations(s,{representations:r,switchingMode:o}))}disableAudioTrack(e){if(this._priv_contentInfos===null)return;let{isDirectFile:t,mediaElementTracksStore:r}=this._priv_contentInfos;return t&&r!==null?r.disableAudioTrack():this._priv_callTracksStoreGetterSetter(e,void 0,(i,o)=>i.disableTrack(o,"audio"))}lockAudioRepresentations(e){if(this._priv_contentInfos===null)throw new Error("No content loaded");let{isDirectFile:t}=this._priv_contentInfos;if(t)throw new Error("Cannot lock audio Representations in directfile mode.");let r,i,o;return Array.isArray(e)?(r=e,i=void 0):(r=e.representations,i=e.periodId,o=e.switchingMode),this._priv_callTracksStoreGetterSetter(i,void 0,(a,s)=>a.lockAudioRepresentations(s,{representations:r,switchingMode:o}))}getLockedVideoRepresentations(e){if(this._priv_contentInfos===null)return null;let{isDirectFile:t}=this._priv_contentInfos;return t?null:this._priv_callTracksStoreGetterSetter(e,null,(r,i)=>r.getLockedVideoRepresentations(i))}getLockedAudioRepresentations(e){if(this._priv_contentInfos===null)return null;let{isDirectFile:t}=this._priv_contentInfos;return t?null:this._priv_callTracksStoreGetterSetter(e,null,(r,i)=>r.getLockedAudioRepresentations(i))}unlockVideoRepresentations(e){if(this._priv_contentInfos===null)return;let{isDirectFile:t}=this._priv_contentInfos;if(!t)return this._priv_callTracksStoreGetterSetter(e,void 0,(r,i)=>r.unlockVideoRepresentations(i))}unlockAudioRepresentations(e){if(this._priv_contentInfos===null)return;let{isDirectFile:t}=this._priv_contentInfos;if(!t)return this._priv_callTracksStoreGetterSetter(e,void 0,(r,i)=>r.unlockAudioRepresentations(i))}getMinimumPosition(){if(this._priv_contentInfos===null)return null;if(this._priv_contentInfos.isDirectFile)return 0;let{manifest:e}=this._priv_contentInfos;return e!==null?bn(e):null}getLivePosition(){if(this._priv_contentInfos===null)return null;let{isDirectFile:e,manifest:t}=this._priv_contentInfos;if(!e)return(t==null?void 0:t.isLive)!==!0?null:Sn(t)}getMaximumPosition(){if(this._priv_contentInfos===null)return null;let{isDirectFile:e,manifest:t}=this._priv_contentInfos;if(e){if(this.videoElement===null)throw new Error("Disposed player");return this.videoElement.duration}return t!==null?!t.isDynamic&&this.videoElement!==null?this.videoElement.duration:kt(t):null}async __priv_getSegmentSinkMetrics(){var e,t;return(t=(e=this._priv_contentInfos)==null?void 0:e.segmentSinkMetricsCallback)==null?void 0:t.call(e)}__priv_getManifest(){return this._priv_contentInfos===null?null:this._priv_contentInfos.manifest}__priv_getCurrentAdaptation(){if(this._priv_contentInfos===null)return null;let{currentPeriod:e,activeAdaptations:t}=this._priv_contentInfos;return e===null||t===null||_(t[e.id])?null:t[e.id]}__priv_getCurrentRepresentations(){if(this._priv_contentInfos===null)return null;let{currentPeriod:e,activeRepresentations:t}=this._priv_contentInfos;return e===null||t===null||_(t[e.id])?null:t[e.id]}_priv_cleanUpCurrentContentState(){var t,r,i,o;m.debug("API","Locking `contentLock` to clean-up the current content."),this._priv_contentLock.setValue(!0),(r=(t=this._priv_contentInfos)==null?void 0:t.tracksStore)==null||r.dispose(),(o=(i=this._priv_contentInfos)==null?void 0:i.mediaElementTracksStore)==null||o.dispose(),this._priv_contentInfos=null,this._priv_contentEventsMemory={};let e=()=>{this.videoElement!==null&&(m.debug("API","Unlocking `contentLock`. Next content can begin."),this._priv_contentLock.setValue(!1))};_(this.videoElement)?e():Ho(this.videoElement).then(()=>{m.debug("API","DRM session cleaned-up with success!"),e()},a=>{m.error("API","An error arised when trying to clean-up the DRM session:"+(a instanceof Error?a.toString():"Unknown Error")),e()})}_priv_onManifestReady(e,t){var i;if(e.contentId!==((i=this._priv_contentInfos)==null?void 0:i.contentId))return;e.manifest=t,t.manifestFormat===0&&(this._priv_reloadingMetadata.manifest=t);let r=new Ap({preferTrickModeTracks:this._priv_preferTrickModeTracks,defaultAudioTrackSwitchingMode:e.defaultAudioTrackSwitchingMode,onTracksNotPlayableForType:{audio:e.onAudioTracksNotPlayable,video:e.onVideoTracksNotPlayable,text:"continue"}});e.tracksStore=r,r.addEventListener("newAvailablePeriods",o=>{this.trigger("newAvailablePeriods",o)}),r.addEventListener("brokenRepresentationsLock",o=>{this.trigger("brokenRepresentationsLock",o)}),r.addEventListener("trackUpdate",o=>{var s,d;this.trigger("trackUpdate",o);let a=(d=(s=this._priv_contentInfos)==null?void 0:s.currentPeriod)!=null?d:void 0;o.reason==="no-playable-representation"&&o.period.id===(a==null?void 0:a.id)&&this._priv_onAvailableTracksMayHaveChanged(o.trackType)}),r.addEventListener("warning",o=>{this.trigger("warning",o)}),r.addEventListener("error",o=>{this._priv_onFatalError(o,e)}),r.addEventListener("noPlayableTrack",o=>{this.trigger("noPlayableTrack",o)}),r.onManifestUpdate(t)}_priv_onManifestUpdate(e,t){var o,a,s;if(this._priv_contentInfos===null||this._priv_contentInfos.manifest===null)return;_(e==null?void 0:e.tracksStore)||e.tracksStore.onManifestUpdate(this._priv_contentInfos.manifest);let r=(a=(o=this._priv_contentInfos)==null?void 0:o.currentPeriod)!=null?a:void 0,i=(s=this._priv_contentInfos)==null?void 0:s.tracksStore;if(!(r===void 0||_(i))){for(let d of t.updatedPeriods)if(d.period.id===r.id&&(d.result.addedAdaptations.length>0||d.result.removedAdaptations.length>0)){if(i.getPeriodObjectFromPeriod(r)===void 0)return;this._priv_onAvailableTracksMayHaveChanged("audio"),this._priv_onAvailableTracksMayHaveChanged("text"),this._priv_onAvailableTracksMayHaveChanged("video")}}}_priv_onCodecSupportUpdate(e){let t=e==null?void 0:e.tracksStore;_(t)||t.onManifestCodecSupportUpdate()}_priv_onDecipherabilityUpdate(e,t){if(e===null||e.manifest===null)return;_(e==null?void 0:e.tracksStore)||e.tracksStore.onDecipherabilityUpdates();let r=t.reduce((i,o)=>{var s,d,u;if(!(Q(i,c=>c[0].id===o.period.id&&c[1]===o.adaptation.type)!==void 0)){let c=e.tracksStore;if(c===null)return i;let l=!1,f=c.getPeriodObjectFromPeriod(o.period);if(f===void 0)return i;switch(o.adaptation.type){case"audio":l=((s=c.getChosenAudioTrack(f,!1))==null?void 0:s.id)===o.adaptation.id;break;case"video":l=((d=c.getChosenVideoTrack(f,!1))==null?void 0:d.id)===o.adaptation.id;break;case"text":l=((u=c.getChosenTextTrack(f))==null?void 0:u.id)===o.adaptation.id;break}l&&i.push([o.period,o.adaptation.type])}return i},[]);for(let[i,o]of r)this._priv_triggerEventIfNotStopped("representationListUpdate",{period:{start:i.start,end:i.end,id:i.id},trackType:o,reason:"decipherability-update"},e.currentContentCanceller.signal)}_priv_onActivePeriodChanged(e,{period:t}){var s,d,u,c,l,f;if(e.contentId!==((s=this._priv_contentInfos)==null?void 0:s.contentId))return;e.currentPeriod=t;let r=e.currentContentCanceller.signal;this._priv_contentEventsMemory.periodChange!==t&&(this._priv_contentEventsMemory.periodChange=t,this._priv_triggerEventIfNotStopped("periodChange",{start:t.start,end:t.end,id:t.id},r)),this._priv_triggerEventIfNotStopped("availableAudioTracksChange",this.getAvailableAudioTracks(),r),this._priv_triggerEventIfNotStopped("availableTextTracksChange",this.getAvailableTextTracks(),r),this._priv_triggerEventIfNotStopped("availableVideoTracksChange",this.getAvailableVideoTracks(),r);let i=(d=this._priv_contentInfos)==null?void 0:d.tracksStore;if(_(i))this._priv_triggerEventIfNotStopped("audioTrackChange",null,r),this._priv_triggerEventIfNotStopped("textTrackChange",null,r),this._priv_triggerEventIfNotStopped("videoTrackChange",null,r);else{let p=i.getPeriodObjectFromPeriod(t);if(p!==void 0){let g=i.getChosenAudioTrack(p,!0);this._priv_triggerEventIfNotStopped("audioTrackChange",g,r);let I=i.getChosenTextTrack(p);this._priv_triggerEventIfNotStopped("textTrackChange",I,r);let h=i.getChosenVideoTrack(p,!0);this._priv_triggerEventIfNotStopped("videoTrackChange",h,r)}}let o=(c=(u=this.__priv_getCurrentRepresentations())==null?void 0:u.audio)!=null?c:null;this._priv_triggerEventIfNotStopped("audioRepresentationChange",_(o)?o:In(o),r);let a=(f=(l=this.__priv_getCurrentRepresentations())==null?void 0:l.video)!=null?f:null;this._priv_triggerEventIfNotStopped("videoRepresentationChange",_(a)?a:In(a),r)}_priv_onPeriodStreamReady(e,t){var s;if(e.contentId!==((s=this._priv_contentInfos)==null?void 0:s.contentId))return;let{type:r,period:i,adaptationRef:o}=t,a=e.tracksStore;switch(r){case"video":case"audio":case"text":_(a)?(m.error("API",`TracksStore not instanciated for a new ${r} period`),o.setValue(null)):a.addTrackReference(r,i,o);break;default:ze(r)}}_priv_onPeriodStreamCleared(e,t){var d;if(e.contentId!==((d=this._priv_contentInfos)==null?void 0:d.contentId))return;let{type:r,periodId:i}=t,o=e.tracksStore;switch(r){case"audio":case"text":case"video":_(o)||o.removeTrackReference(r,i);break}let{activeAdaptations:a,activeRepresentations:s}=e;if(!_(a)&&!_(a[i])){let u=a[i];delete u[r],Object.keys(u).length===0&&delete a[i]}if(!_(s)&&!_(s[i])){let u=s[i];delete u[r],Object.keys(u).length===0&&delete s[i]}}_priv_onAdaptationChange(e,{type:t,adaptation:r,period:i}){var c;if(e.contentId!==((c=this._priv_contentInfos)==null?void 0:c.contentId))return;e.activeAdaptations===null&&(e.activeAdaptations={});let{activeAdaptations:o,currentPeriod:a}=e,s=o[i.id];_(s)?o[i.id]={[t]:r}:s[t]=r;let{tracksStore:d}=e,u=e.currentContentCanceller.signal;if(d!==null&&a!==null&&!_(i)&&i.id===a.id){let l=d.getPeriodObjectFromPeriod(i);if(l===void 0)return;switch(t){case"audio":{let f=d.getChosenAudioTrack(l,!0);this._priv_triggerEventIfNotStopped("audioTrackChange",f,u);break}case"text":{let f=d.getChosenTextTrack(l);this._priv_triggerEventIfNotStopped("textTrackChange",f,u);break}case"video":{let f=d.getChosenVideoTrack(l,!0);this._priv_triggerEventIfNotStopped("videoTrackChange",f,u);break}}}}_priv_onRepresentationChange(e,{type:t,period:r,representation:i}){var d;if(e.contentId!==((d=this._priv_contentInfos)==null?void 0:d.contentId))return;e.activeRepresentations===null&&(e.activeRepresentations={});let{activeRepresentations:o,currentPeriod:a}=e,s=o[r.id];if(_(s)?o[r.id]={[t]:i}:s[t]=i,!_(r)&&a!==null&&a.id===r.id){let u=this._priv_contentInfos.currentContentCanceller.signal;t==="video"?this._priv_triggerEventIfNotStopped("videoRepresentationChange",_(i)?i:In(i),u):t==="audio"&&this._priv_triggerEventIfNotStopped("audioRepresentationChange",_(i)?i:Ko(i),u)}}_priv_onBitrateEstimateChange({type:e,bitrate:t}){t!==void 0&&(this._priv_bitrateInfos.lastBitrates[e]=t),this.trigger("__priv_bitrateEstimateChange",{type:e,bitrate:t})}_priv_setPlayerState(e){this.state!==e&&(this.state=e,m.info("API","playerStateChange event",{newState:e}),this.trigger("playerStateChange",e))}_priv_triggerPositionUpdate(e,t){var s,d;if(e.contentId!==((s=this._priv_contentInfos)==null?void 0:s.contentId))return;let{isDirectFile:r,manifest:i}=e;if(!r&&i===null||_(t))return;let o=i!==null?kt(i):void 0,a={position:t.position.getPolled(),duration:t.duration,playbackRate:t.playbackRate,maximumPosition:o,bufferGap:t.bufferGap===void 0||!isFinite(t.bufferGap)?0:t.bufferGap};if(i!==null&&i.isLive&&t.position.getPolled()>0){let u=(d=i.availabilityStartTime)!=null?d:0;a.wallClockTime=t.position.getPolled()+u;let c=Sn(i);c!==void 0&&(a.liveGap=c-t.position.getPolled())}else if(r&&this.videoElement!==null){let u=yo(this.videoElement);u!==void 0&&(a.wallClockTime=u+t.position.getPolled())}this.trigger("positionUpdate",a)}_priv_triggerEventIfNotStopped(e,t,r){r.isCancelled()||this.trigger(e,t)}_priv_initializeMediaElementTracksStore(e){var r,i,o;J(pe.directfile!==null,"Initializing `MediaElementTracksStore` without Directfile feature"),J(this.videoElement!==null,"Initializing `MediaElementTracksStore` on a disposed RxPlayer");let t=new pe.directfile.mediaElementTracksStore(this.videoElement);return this._priv_triggerEventIfNotStopped("availableAudioTracksChange",t.getAvailableAudioTracks(),e),this._priv_triggerEventIfNotStopped("availableVideoTracksChange",t.getAvailableVideoTracks(),e),this._priv_triggerEventIfNotStopped("availableTextTracksChange",t.getAvailableTextTracks(),e),this._priv_triggerEventIfNotStopped("audioTrackChange",(r=t.getChosenAudioTrack())!=null?r:null,e),this._priv_triggerEventIfNotStopped("textTrackChange",(i=t.getChosenTextTrack())!=null?i:null,e),this._priv_triggerEventIfNotStopped("videoTrackChange",(o=t.getChosenVideoTrack())!=null?o:null,e),t.addEventListener("availableVideoTracksChange",a=>this.trigger("availableVideoTracksChange",a)),t.addEventListener("availableAudioTracksChange",a=>this.trigger("availableAudioTracksChange",a)),t.addEventListener("availableTextTracksChange",a=>this.trigger("availableTextTracksChange",a)),t.addEventListener("audioTrackChange",a=>this.trigger("audioTrackChange",a)),t.addEventListener("videoTrackChange",a=>this.trigger("videoTrackChange",a)),t.addEventListener("textTrackChange",a=>this.trigger("textTrackChange",a)),t}_priv_callTracksStoreGetterSetter(e,t,r){var d,u;if(this._priv_contentInfos===null||this._priv_contentInfos.tracksStore===null)return m.warn("API","Trying to call track API too soon"),t;let{tracksStore:i}=this._priv_contentInfos,o=(u=(d=this._priv_contentInfos)==null?void 0:d.currentPeriod)!=null?u:void 0,a=e!=null?e:o==null?void 0:o.id;if(a===void 0)return t;let s=a===(o==null?void 0:o.id)?i.getPeriodObjectFromPeriod(o):i.getPeriodObjectFromId(a);return s===void 0?t:r(i,s)}_priv_onAvailableTracksMayHaveChanged(e,t){let r=this._priv_contentInfos;if(r===null)return;let{currentPeriod:i,tracksStore:o,currentContentCanceller:a}=r,s=a.signal;if(_(i)||o===null)return;let d=t!=null?t:o.getPeriodObjectFromPeriod(i);if(d!==void 0)switch(e){case"video":{let u=o.getAvailableVideoTracks(d,!0);this._priv_triggerEventIfNotStopped("availableVideoTracksChange",u!=null?u:[],s);break}case"audio":{let u=o.getAvailableAudioTracks(d,!0);this._priv_triggerEventIfNotStopped("availableAudioTracksChange",u!=null?u:[],s);break}case"text":{let u=o.getAvailableTextTracks(d);this._priv_triggerEventIfNotStopped("availableTextTracksChange",u!=null?u:[],s);break}default:ze(e)}}_priv_onFatalError(e,t){let r=Me(e,{defaultCode:"NONE",defaultReason:"An unknown error stopped content playback."});r.fatal=!0,t.currentContentCanceller.cancel(),this._priv_cleanUpCurrentContentState(),this._priv_currentError=r,m.error("API","The player stopped because of an error",r),this._priv_setPlayerState("STOPPED"),this._priv_currentError===r&&this.trigger("error",r)}};Yt._priv_currentlyUsedVideoElements=new WeakSet;var Ir=Yt;Ir.version="4.4.1";var Np=Ir;var ns=Np;rs();ns.addFeatures([Vl,xu,Nu,Uu,Ml,Rl,wl,Pl,fl,zu,Tl,qu]);var lue=ns;Z.RxPlayer=ns;})();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "rx-player",
3
3
  "author": "Canal+",
4
- "version": "4.4.1-dev.2025120800",
4
+ "version": "4.4.1",
5
5
  "description": "Canal+ HTML5 Video Player",
6
6
  "main": "./dist/commonjs/index.js",
7
7
  "module": "./dist/es2017/index.js",
@@ -445,7 +445,7 @@ class Player extends EventEmitter<IPublicAPIEvent> {
445
445
  // See: https://bugzilla.mozilla.org/show_bug.cgi?id=1194624
446
446
  videoElement.preload = "auto";
447
447
 
448
- this.version = /* PLAYER_VERSION */ "4.4.1-dev.2025120800";
448
+ this.version = /* PLAYER_VERSION */ "4.4.1";
449
449
  this.log = log;
450
450
  this.state = "STOPPED";
451
451
  this.videoElement = videoElement;
@@ -3578,7 +3578,7 @@ class Player extends EventEmitter<IPublicAPIEvent> {
3578
3578
  }
3579
3579
  }
3580
3580
  }
3581
- Player.version = /* PLAYER_VERSION */ "4.4.1-dev.2025120800";
3581
+ Player.version = /* PLAYER_VERSION */ "4.4.1";
3582
3582
 
3583
3583
  /** Every events sent by the RxPlayer's public API. */
3584
3584
  interface IPublicAPIEvent {