mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-05-30 19:54:16 -04:00
Use artist in media session for android
This commit is contained in:
parent
e6f4f51aea
commit
660175f4ed
@ -146,7 +146,7 @@ export const Player = ({
|
|||||||
<Video
|
<Video
|
||||||
metadata={{
|
metadata={{
|
||||||
title: title ?? t("show.episodeNoMetadata"),
|
title: title ?? t("show.episodeNoMetadata"),
|
||||||
subtitle: subtitle ?? undefined,
|
artist: subtitle ?? undefined,
|
||||||
description: data?.overview ?? undefined,
|
description: data?.overview ?? undefined,
|
||||||
imageUri: image?.medium,
|
imageUri: image?.medium,
|
||||||
next: next,
|
next: next,
|
||||||
|
@ -27,12 +27,14 @@ import { durationAtom, playAtom, progressAtom } from "./state";
|
|||||||
export const MediaSessionManager = ({
|
export const MediaSessionManager = ({
|
||||||
title,
|
title,
|
||||||
subtitle,
|
subtitle,
|
||||||
|
artist,
|
||||||
imageUri,
|
imageUri,
|
||||||
previous,
|
previous,
|
||||||
next,
|
next,
|
||||||
}: {
|
}: {
|
||||||
title?: string;
|
title?: string;
|
||||||
subtitle?: string;
|
subtitle?: string;
|
||||||
|
artist?: string;
|
||||||
imageUri?: string | null;
|
imageUri?: string | null;
|
||||||
previous?: string;
|
previous?: string;
|
||||||
next?: string;
|
next?: string;
|
||||||
@ -48,9 +50,10 @@ export const MediaSessionManager = ({
|
|||||||
navigator.mediaSession.metadata = new MediaMetadata({
|
navigator.mediaSession.metadata = new MediaMetadata({
|
||||||
title: title,
|
title: title,
|
||||||
album: subtitle,
|
album: subtitle,
|
||||||
|
artist: artist,
|
||||||
artwork: imageUri ? [{ src: imageUri }] : undefined,
|
artwork: imageUri ? [{ src: imageUri }] : undefined,
|
||||||
});
|
});
|
||||||
}, [title, subtitle, imageUri]);
|
}, [title, subtitle, artist, imageUri]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!("mediaSession" in navigator)) return;
|
if (!("mediaSession" in navigator)) return;
|
||||||
|
@ -33,7 +33,7 @@ import {
|
|||||||
} from "react";
|
} from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { Platform } from "react-native";
|
import { Platform } from "react-native";
|
||||||
import NativeVideo, { canPlay, type VideoProps } from "./video";
|
import NativeVideo, { canPlay, VideoMetadata, type VideoProps } from "./video";
|
||||||
|
|
||||||
export const playAtom = atom(true);
|
export const playAtom = atom(true);
|
||||||
export const loadAtom = atom(false);
|
export const loadAtom = atom(false);
|
||||||
@ -114,14 +114,7 @@ export const Video = memo(function Video({
|
|||||||
setError: (error: string | undefined) => void;
|
setError: (error: string | undefined) => void;
|
||||||
fonts?: string[];
|
fonts?: string[];
|
||||||
startTime?: number | null;
|
startTime?: number | null;
|
||||||
metadata: {
|
metadata: VideoMetadata & { next?: string; previous?: string };
|
||||||
title?: string;
|
|
||||||
subtitle?: string;
|
|
||||||
description?: string;
|
|
||||||
imageUri?: string;
|
|
||||||
previous?: string;
|
|
||||||
next?: string;
|
|
||||||
};
|
|
||||||
} & Partial<VideoProps>) {
|
} & Partial<VideoProps>) {
|
||||||
const ref = useRef<ElementRef<typeof NativeVideo> | null>(null);
|
const ref = useRef<ElementRef<typeof NativeVideo> | null>(null);
|
||||||
const [isPlaying, setPlay] = useAtom(playAtom);
|
const [isPlaying, setPlay] = useAtom(playAtom);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user