From d0dd9813d563ecd3f7ec6342d922a1534e182bd8 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 29 Jan 2021 14:03:30 +0100 Subject: [PATCH] Fix hls error handling --- client/src/assets/player/p2p-media-loader/hls-plugin.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/client/src/assets/player/p2p-media-loader/hls-plugin.ts b/client/src/assets/player/p2p-media-loader/hls-plugin.ts index 4283fc7dd..38a940229 100644 --- a/client/src/assets/player/p2p-media-loader/hls-plugin.ts +++ b/client/src/assets/player/p2p-media-loader/hls-plugin.ts @@ -124,8 +124,11 @@ class Html5Hlsjs { this.videoElement.addEventListener('error', event => { let errorTxt: string - const mediaError = (event.currentTarget as HTMLVideoElement).error + const mediaError = ((event.currentTarget || event.target) as HTMLVideoElement).error + if (!mediaError) return + + console.log(mediaError) switch (mediaError.code) { case mediaError.MEDIA_ERR_ABORTED: errorTxt = 'You aborted the video playback'