From fe65e0c3b38f1231679c3483d4ff20281f9f07cb Mon Sep 17 00:00:00 2001 From: Dmitry Lyzo Date: Sat, 7 Jan 2023 21:04:40 +0300 Subject: [PATCH] refactor: decrease the number of iterations --- src/components/playback/playbackmanager.js | 4 ++-- src/plugins/htmlVideoPlayer/plugin.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/playback/playbackmanager.js b/src/components/playback/playbackmanager.js index 9d38bb2712..8c6bced1eb 100644 --- a/src/components/playback/playbackmanager.js +++ b/src/components/playback/playbackmanager.js @@ -1316,11 +1316,11 @@ class PlaybackManager { const profiles = deviceProfile.DirectPlayProfiles || []; - return profiles.filter(function (p) { + return profiles.some(function (p) { return p.Type === 'Video' && includesAny((p.Container || '').toLowerCase(), container) && includesAny((p.AudioCodec || '').toLowerCase(), codec); - }).length > 0; + }); } self.setAudioStreamIndex = function (index, player) { diff --git a/src/plugins/htmlVideoPlayer/plugin.js b/src/plugins/htmlVideoPlayer/plugin.js index aaf6b53c76..defd931ae0 100644 --- a/src/plugins/htmlVideoPlayer/plugin.js +++ b/src/plugins/htmlVideoPlayer/plugin.js @@ -617,11 +617,11 @@ function tryRemoveElement(elem) { const profiles = deviceProfile.DirectPlayProfiles || []; - return profiles.filter(function (p) { + return profiles.some(function (p) { return p.Type === 'Video' && includesAny((p.Container || '').toLowerCase(), container) && includesAny((p.AudioCodec || '').toLowerCase(), codec); - }).length > 0; + }); } /**