Browse Source

fix: MediaSession breaks station if a YouTube video plays instead of a song

Owen Diffey 2 years ago
parent
commit
3e9ef5f49e
1 changed files with 5 additions and 5 deletions
  1. 5 5
      frontend/src/pages/Station/index.vue

+ 5 - 5
frontend/src/pages/Station/index.vue

@@ -172,15 +172,15 @@ const isOwnerOnly = () =>
 	loggedIn.value && userId.value === station.value.owner;
 const isAdminOnly = () => loggedIn.value && role.value === "admin";
 const isOwnerOrAdmin = () => isOwnerOnly() || isAdminOnly();
-const updateMediaSessionData = currentSong => {
-	if (currentSong) {
+const updateMediaSessionData = song => {
+	if (song) {
 		ms.setMediaSessionData(
 			0,
 			!localPaused.value && !stationPaused.value, // This should be improved later
-			currentSong.value.title,
-			currentSong.value.artists.join(", "),
+			song.title,
+			song.artists ? song.artists.join(", ") : null,
 			null,
-			currentSong.value.thumbnail
+			song.thumbnail
 		);
 	} else ms.removeMediaSessionData(0);
 };