mirror of
https://github.com/stashapp/stash.git
synced 2025-12-06 08:26:00 +01:00
[MediaSession] fall back to performers if studio not available (#6315)
This commit is contained in:
parent
dc520e2b2f
commit
50ad3c0778
2 changed files with 5 additions and 3 deletions
|
|
@ -882,11 +882,13 @@ export const ScenePlayer: React.FC<IScenePlayerProps> = PatchComponent(
|
|||
if (!player) return;
|
||||
|
||||
// set up mediasession plugin
|
||||
// get performer names as array
|
||||
const performers = scene?.performers.map((p) => p.name).join(", ");
|
||||
player
|
||||
.mediaSession()
|
||||
.setMetadata(
|
||||
scene?.title ?? "Stash",
|
||||
scene?.studio?.name ?? "Stash",
|
||||
scene?.studio?.name ?? performers ?? "Stash",
|
||||
scene.paths.screenshot || ""
|
||||
);
|
||||
}, [getPlayer, scene]);
|
||||
|
|
|
|||
|
|
@ -20,11 +20,11 @@ class MediaSessionPlugin extends videojs.getPlugin("plugin") {
|
|||
}
|
||||
|
||||
// manually set poster since it's only set on useEffect
|
||||
public setMetadata(title: string, studioName: string, poster: string): void {
|
||||
public setMetadata(title: string, artist: string, poster: string): void {
|
||||
if ("mediaSession" in navigator) {
|
||||
navigator.mediaSession.metadata = new MediaMetadata({
|
||||
title,
|
||||
artist: studioName,
|
||||
artist,
|
||||
artwork: [
|
||||
{
|
||||
src: poster || this.player.poster() || "",
|
||||
|
|
|
|||
Loading…
Reference in a new issue