Add constants for app features

This commit is contained in:
Bill Thornton
2025-04-30 17:41:36 -04:00
parent bb810a183a
commit fdcf1b06c3
34 changed files with 211 additions and 129 deletions
+6 -5
View File
@@ -24,6 +24,7 @@ import { getItemBackdropImageUrl } from '../../utils/jellyfin-apiclient/backdrop
import { PlayerEvent } from 'apps/stable/features/playback/constants/playerEvent';
import { bindMediaSegmentManager } from 'apps/stable/features/playback/utils/mediaSegmentManager';
import { bindMediaSessionSubscriber } from 'apps/stable/features/playback/utils/mediaSessionSubscriber';
import { AppFeature } from 'constants/appFeature';
import { ServerConnections } from 'lib/jellyfin-apiclient';
import { MediaError } from 'types/mediaError';
import { getMediaError } from 'utils/mediaError';
@@ -41,7 +42,7 @@ function enableLocalPlaylistManagement(player) {
}
function supportsPhysicalVolumeControl(player) {
return player.isLocalPlayer && appHost.supports('physicalvolumecontrol');
return player.isLocalPlayer && appHost.supports(AppFeature.PhysicalVolumeControl);
}
function bindToFullscreenChange(player) {
@@ -317,7 +318,7 @@ function getAudioStreamUrl(item, transcodingProfile, directPlayContainers, apiCl
PlaySessionId: startingPlaySession,
StartTimeTicks: startPosition || 0,
EnableRedirection: true,
EnableRemoteMedia: appHost.supports('remoteaudio'),
EnableRemoteMedia: appHost.supports(AppFeature.RemoteAudio),
EnableAudioVbrEncoding: transcodingProfile.EnableAudioVbrEncoding
});
}
@@ -598,7 +599,7 @@ function supportsDirectPlay(apiClient, item, mediaSource) {
const isFolderRip = mediaSource.VideoType === 'BluRay' || mediaSource.VideoType === 'Dvd' || mediaSource.VideoType === 'HdDvd';
if (mediaSource.SupportsDirectPlay || isFolderRip) {
if (mediaSource.IsRemote && !appHost.supports('remotevideo')) {
if (mediaSource.IsRemote && !appHost.supports(AppFeature.RemoteVideo)) {
return Promise.resolve(false);
}
@@ -3689,7 +3690,7 @@ export class PlaybackManager {
return streamInfo ? streamInfo.playbackStartTimeTicks : null;
};
if (appHost.supports('remotecontrol')) {
if (appHost.supports(AppFeature.RemoteControl)) {
import('../../scripts/serverNotifications').then(({ default: serverNotifications }) => {
Events.on(serverNotifications, 'ServerShuttingDown', self.setDefaultPlayerActive.bind(self));
Events.on(serverNotifications, 'ServerRestarting', self.setDefaultPlayerActive.bind(self));
@@ -4060,7 +4061,7 @@ export class PlaybackManager {
'PlayTrailers'
];
if (appHost.supports('fullscreenchange')) {
if (appHost.supports(AppFeature.Fullscreen)) {
list.push('ToggleFullscreen');
}
@@ -1,3 +1,4 @@
import { AppFeature } from 'constants/appFeature';
import Events from '../../utils/events.ts';
import browser from '../../scripts/browser';
import loading from '../loading/loading';
@@ -96,7 +97,7 @@ export function show(button) {
// Unfortunately we can't allow the url to change or chromecast will throw a security error
// Might be able to solve this in the future by moving the dialogs to hashbangs
if (!(!browser.chrome && !browser.edgeChromium || appHost.supports('castmenuhashchange'))) {
if (!(!browser.chrome && !browser.edgeChromium || appHost.supports(AppFeature.CastMenuHashChange))) {
menuOptions.enableHistory = false;
}