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
|
// Helpers
|
||||||
const updateMediaSession = async () => {
|
const updateMediaSession = async () => {
|
||||||
|
if (!import.meta.client) return
|
||||||
if (!navigator.mediaSession) {
|
if (!navigator.mediaSession) {
|
||||||
console.warn("Media Session API is not supported")
|
console.warn("Media Session API is not supported")
|
||||||
return
|
return
|
||||||
@@ -37,6 +38,7 @@ export default defineNuxtPlugin((nuxtApp) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const createHowl = async (song: Track) => {
|
const createHowl = async (song: Track) => {
|
||||||
|
if (!import.meta.client) return
|
||||||
if (!song) throw new Error("Song not provided")
|
if (!song) throw new Error("Song not provided")
|
||||||
|
|
||||||
const newSound = new Howl({
|
const newSound = new Howl({
|
||||||
@@ -177,6 +179,7 @@ export default defineNuxtPlugin((nuxtApp) => {
|
|||||||
setSecondsPlayed,
|
setSecondsPlayed,
|
||||||
setVolume,
|
setVolume,
|
||||||
getVolume,
|
getVolume,
|
||||||
|
queue,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user