mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 04:14:39 +03:00
[MediaSession] fall back to performers if studio not available (#6315)
This commit is contained in:
@@ -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() || "",
|
||||
|
||||
Reference in New Issue
Block a user