mirror of
https://github.com/stashapp/stash.git
synced 2025-12-06 16:34:02 +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;
|
if (!player) return;
|
||||||
|
|
||||||
// set up mediasession plugin
|
// set up mediasession plugin
|
||||||
|
// get performer names as array
|
||||||
|
const performers = scene?.performers.map((p) => p.name).join(", ");
|
||||||
player
|
player
|
||||||
.mediaSession()
|
.mediaSession()
|
||||||
.setMetadata(
|
.setMetadata(
|
||||||
scene?.title ?? "Stash",
|
scene?.title ?? "Stash",
|
||||||
scene?.studio?.name ?? "Stash",
|
scene?.studio?.name ?? performers ?? "Stash",
|
||||||
scene.paths.screenshot || ""
|
scene.paths.screenshot || ""
|
||||||
);
|
);
|
||||||
}, [getPlayer, scene]);
|
}, [getPlayer, scene]);
|
||||||
|
|
|
||||||
|
|
@ -20,11 +20,11 @@ class MediaSessionPlugin extends videojs.getPlugin("plugin") {
|
||||||
}
|
}
|
||||||
|
|
||||||
// manually set poster since it's only set on useEffect
|
// 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) {
|
if ("mediaSession" in navigator) {
|
||||||
navigator.mediaSession.metadata = new MediaMetadata({
|
navigator.mediaSession.metadata = new MediaMetadata({
|
||||||
title,
|
title,
|
||||||
artist: studioName,
|
artist,
|
||||||
artwork: [
|
artwork: [
|
||||||
{
|
{
|
||||||
src: poster || this.player.poster() || "",
|
src: poster || this.player.poster() || "",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue