From ac45163e4c5d3228a5bed582ce6f041f649b610a Mon Sep 17 00:00:00 2001 From: Bill Thornton Date: Wed, 8 Sep 2021 11:33:20 -0400 Subject: [PATCH 1/2] Fix direct play logic when direct stream is disabled --- src/components/playback/playbackmanager.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/playback/playbackmanager.js b/src/components/playback/playbackmanager.js index 3f22244c40..284a67af7d 100644 --- a/src/components/playback/playbackmanager.js +++ b/src/components/playback/playbackmanager.js @@ -2481,7 +2481,7 @@ class PlaybackManager { // Only used for audio playMethod = 'Transcode'; mediaUrl = mediaSource.StreamUrl; - } else if (mediaSource.SupportsDirectStream) { + } else if (mediaSource.SupportsDirectPlay || mediaSource.SupportsDirectStream) { directOptions = { Static: true, mediaSourceId: mediaSource.Id, @@ -2500,7 +2500,7 @@ class PlaybackManager { const prefix = type === 'Video' ? 'Videos' : 'Audio'; mediaUrl = apiClient.getUrl(prefix + '/' + item.Id + '/stream.' + mediaSourceContainer, directOptions); - playMethod = 'DirectStream'; + playMethod = mediaSource.SupportsDirectPlay ? 'DirectPlay' : 'DirectStream'; } else if (mediaSource.SupportsTranscoding) { mediaUrl = apiClient.getUrl(mediaSource.TranscodingUrl); From 4f762c10760fcbfcd7187425d6260161bc93f5f8 Mon Sep 17 00:00:00 2001 From: Bill Thornton Date: Thu, 9 Sep 2021 12:18:35 -0400 Subject: [PATCH 2/2] Remove unused filesystem support --- src/components/playback/playbackmanager.js | 15 --------------- src/scripts/filesystem.js | 13 ------------- 2 files changed, 28 deletions(-) delete mode 100644 src/scripts/filesystem.js diff --git a/src/components/playback/playbackmanager.js b/src/components/playback/playbackmanager.js index 284a67af7d..2b683130df 100644 --- a/src/components/playback/playbackmanager.js +++ b/src/components/playback/playbackmanager.js @@ -618,21 +618,6 @@ function supportsDirectPlay(apiClient, item, mediaSource) { } else { return isHostReachable(mediaSource, apiClient); } - } else if (mediaSource.Protocol === 'File') { - return new Promise(function (resolve) { - // Determine if the file can be accessed directly - import('../../scripts/filesystem').then((filesystem) => { - const method = isFolderRip ? - 'directoryExists' : - 'fileExists'; - - filesystem[method](mediaSource.Path).then(function () { - resolve(true); - }, function () { - resolve(false); - }); - }); - }); } } diff --git a/src/scripts/filesystem.js b/src/scripts/filesystem.js deleted file mode 100644 index 3c14020d1a..0000000000 --- a/src/scripts/filesystem.js +++ /dev/null @@ -1,13 +0,0 @@ -export function fileExists(path) { - if (window.NativeShell && window.NativeShell.FileSystem) { - return window.NativeShell.FileSystem.fileExists(path); - } - return Promise.reject(); -} - -export function directoryExists(path) { - if (window.NativeShell && window.NativeShell.FileSystem) { - return window.NativeShell.FileSystem.directoryExists(path); - } - return Promise.reject(); -}