From f88d9601e941b2aaea72a9b99305068a4b0e0aa5 Mon Sep 17 00:00:00 2001 From: Tom Van Laerhoven Date: Mon, 23 Dec 2024 09:50:38 +0100 Subject: [PATCH] Fix native track conversion --- src/internal/adapter/WebEventForwarder.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/internal/adapter/WebEventForwarder.ts b/src/internal/adapter/WebEventForwarder.ts index 8f30f6bdf..832dd2a29 100644 --- a/src/internal/adapter/WebEventForwarder.ts +++ b/src/internal/adapter/WebEventForwarder.ts @@ -18,7 +18,7 @@ import type { VolumeChangeEvent as NativeVolumeChangeEvent, DimensionChangeEvent as NativeDimensionChangeEvent, } from 'theoplayer'; -import type { AdEvent, MediaTrack, TextTrack, TimeRange } from 'react-native-theoplayer'; +import type { AdEvent, MediaTrack, TimeRange } from 'react-native-theoplayer'; import { AdEventType, CastState, @@ -267,7 +267,7 @@ export class WebEventForwarder { track.addEventListener('removecue', this.onRemoveTextTrackCue(track)); track.addEventListener('entercue', this.onEnterTextTrackCue(track)); track.addEventListener('exitcue', this.onExitTextTrackCue(track)); - this._facade.dispatchEvent(new DefaultTextTrackListEvent(TrackListEventType.ADD_TRACK, track as TextTrack)); + this._facade.dispatchEvent(new DefaultTextTrackListEvent(TrackListEventType.ADD_TRACK, fromNativeTextTrack(track))); }; private readonly onRemoveTextTrack = (event: RemoveTrackEvent) => { @@ -276,11 +276,11 @@ export class WebEventForwarder { track.removeEventListener('removecue', this.onRemoveTextTrackCue(track)); track.removeEventListener('entercue', this.onEnterTextTrackCue(track)); track.removeEventListener('exitcue', this.onExitTextTrackCue(track)); - this._facade.dispatchEvent(new DefaultTextTrackListEvent(TrackListEventType.REMOVE_TRACK, track as NativeTextTrack as TextTrack)); + this._facade.dispatchEvent(new DefaultTextTrackListEvent(TrackListEventType.REMOVE_TRACK, fromNativeTextTrack(track))); }; private readonly onChangeTextTrack = (event: TrackChangeEvent) => { - this._facade.dispatchEvent(new DefaultTextTrackListEvent(TrackListEventType.CHANGE_TRACK, event.track as NativeTextTrack as TextTrack)); + this._facade.dispatchEvent(new DefaultTextTrackListEvent(TrackListEventType.CHANGE_TRACK, fromNativeTextTrack(event.track as NativeTextTrack))); }; private readonly onAddAudioTrack = (event: AddTrackEvent) => {