Updated player plugin to work on the server
This commit is contained in:
1 parent
d0d06f1513
commit
baf151d9c0
1 file changed
+3
@@ -11,6 +11,7 @@ export default defineNuxtPlugin((nuxtApp) => {
|
||||
|
||||
// Helpers
|
||||
const updateMediaSession = async () => {
|
||||
if (!import.meta.client) return
|
||||
if (!navigator.mediaSession) {
|
||||
console.warn("Media Session API is not supported")
|
||||
return
|
||||
@@ -37,6 +38,7 @@ export default defineNuxtPlugin((nuxtApp) => {
|
||||
}
|
||||
|
||||
const createHowl = async (song: Track) => {
|
||||
if (!import.meta.client) return
|
||||
if (!song) throw new Error("Song not provided")
|
||||
|
||||
const newSound = new Howl({
|
||||
@@ -177,6 +179,7 @@ export default defineNuxtPlugin((nuxtApp) => {
|
||||
setSecondsPlayed,
|
||||
setVolume,
|
||||
getVolume,
|
||||
queue,
|
||||
},
|
||||
},
|
||||
}
|
||||
Reference in new issue
Block a user