From c3d6150f59ef2458c5447837cd29a1d343f7538c Mon Sep 17 00:00:00 2001 From: Moshe Maor Date: Thu, 14 Sep 2023 17:07:42 +0300 Subject: [PATCH 1/2] fix(SUP-39117): handle when audio tracks are returned with video tracks --- src/hls-adapter.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/hls-adapter.js b/src/hls-adapter.js index d816851..468e9ff 100644 --- a/src/hls-adapter.js +++ b/src/hls-adapter.js @@ -671,6 +671,8 @@ export default class HlsAdapter extends BaseMediaSourceAdapter { */ _parseVideoTracks(hlsVideoTracks: Array): Array { let videoTracks = []; + let audioTracks = []; + for (let i = 0; i < hlsVideoTracks.length; i++) { // Create video tracks let settings = { @@ -681,7 +683,14 @@ export default class HlsAdapter extends BaseMediaSourceAdapter { language: '', index: i }; - videoTracks.push(new VideoTrack(settings)); + if (hlsVideoTracks[i].height || hlsVideoTracks[i].width) { + videoTracks.push(new VideoTrack(settings)); + } else { + audioTracks.push(new VideoTrack(settings)); + } + } + if (!videoTracks.length) { + return audioTracks; } return videoTracks; } From 4cf87a981a59deacd442670d2337b5c0fe70b016 Mon Sep 17 00:00:00 2001 From: Moshe Maor Date: Thu, 21 Sep 2023 12:17:32 +0300 Subject: [PATCH 2/2] Update hls-adapter.js --- src/hls-adapter.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/hls-adapter.js b/src/hls-adapter.js index 468e9ff..fb57efa 100644 --- a/src/hls-adapter.js +++ b/src/hls-adapter.js @@ -671,7 +671,7 @@ export default class HlsAdapter extends BaseMediaSourceAdapter { */ _parseVideoTracks(hlsVideoTracks: Array): Array { let videoTracks = []; - let audioTracks = []; + let audioOnlyTracks = []; for (let i = 0; i < hlsVideoTracks.length; i++) { // Create video tracks @@ -686,11 +686,11 @@ export default class HlsAdapter extends BaseMediaSourceAdapter { if (hlsVideoTracks[i].height || hlsVideoTracks[i].width) { videoTracks.push(new VideoTrack(settings)); } else { - audioTracks.push(new VideoTrack(settings)); + audioOnlyTracks.push(new VideoTrack(settings)); } } if (!videoTracks.length) { - return audioTracks; + return audioOnlyTracks; } return videoTracks; }