mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-07-02 10:32:50 +01:00
Addressing pr comments
Signed-off-by: Lance Chant <13349722+lancechant@users.noreply.github.com>
This commit is contained in:
@@ -178,17 +178,31 @@ export enum VideoPlayer {
|
||||
ExoPlayer = 1,
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether ExoPlayer's native module is available on the current platform.
|
||||
* ExoPlayer only ships for Android TV; on any other platform a persisted
|
||||
* `videoPlayer: ExoPlayer` preference (e.g. MMKV roaming) must fall back
|
||||
* to MPV rather than crash on requireNativeView().
|
||||
*/
|
||||
export const isExoPlayerSupported =
|
||||
Platform.OS === "android" && Platform.isTV === true;
|
||||
|
||||
/**
|
||||
* Resolve the actually-active video player for the current settings.
|
||||
* MPV is the default on every platform; users can opt into ExoPlayer on
|
||||
* Android TV via settings.videoPlayer. Centralized here so the rule has
|
||||
* one source of truth (used by VideoPlayerView, direct-player's device
|
||||
* profile, and the TV settings UI).
|
||||
* Android TV via settings.videoPlayer. The Android-TV capability gate is
|
||||
* folded in here so callers (VideoPlayerView, direct-player's device
|
||||
* profile, PlaySettingsProvider) can never advertise ExoPlayer on a
|
||||
* platform where MPV is actually rendering — that mismatch would let
|
||||
* Jellyfin pick a stream for the wrong renderer.
|
||||
*/
|
||||
export const getActiveVideoPlayer = (
|
||||
settings: Pick<Settings, "videoPlayer"> | null | undefined,
|
||||
): VideoPlayer => {
|
||||
return settings?.videoPlayer ?? VideoPlayer.MPV;
|
||||
if (isExoPlayerSupported && settings?.videoPlayer === VideoPlayer.ExoPlayer) {
|
||||
return VideoPlayer.ExoPlayer;
|
||||
}
|
||||
return VideoPlayer.MPV;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -183,7 +183,7 @@ export const generateDeviceProfile = (options: ProfileOptions = {}) => {
|
||||
CodecProfiles: [
|
||||
{
|
||||
Type: MediaTypes.Video,
|
||||
Codec: "h263,h264,hevc,vp8,vp9,av1",
|
||||
Codec: "h263,h264,vp8,vp9,av1",
|
||||
},
|
||||
{
|
||||
Type: MediaTypes.Video,
|
||||
|
||||
Reference in New Issue
Block a user