fix(web): bridge onError to consumers and fix __destroy cleanup

This commit is contained in:
Kamil Moskała
2026-03-25 00:13:31 +01:00
parent 3e839810f6
commit e1c705311b
@@ -80,6 +80,11 @@ class VideoPlayer extends VideoPlayerEvents implements VideoPlayerBase {
this.player = player;
this.mediaSession = new MediaSessionHandler(this.player);
// Bridge web errors to JS event system so consumers receive them via addEventListener.
(this.eventEmitter as WebEventEmitter).addOnErrorListener((error) => {
this.triggerJSEvent("onError", error);
});
this.replaceSourceAsync(source);
}
@@ -89,6 +94,9 @@ class VideoPlayer extends VideoPlayerEvents implements VideoPlayerBase {
* @internal
*/
__destroy() {
this.mediaSession.disable();
(this.eventEmitter as WebEventEmitter).destroy();
this.clearAllEvents();
this.player.dispose();
}