fix console

This commit is contained in:
SrGooglo 2023-08-27 14:45:46 +00:00
parent f9f784b871
commit 9de1f66e35
2 changed files with 10 additions and 11 deletions

View File

@ -3,14 +3,13 @@ import { CapacitorMusicControls } from "capacitor-music-controls-plugin-v3"
export default class MediaSession { export default class MediaSession {
initialize() { initialize() {
CapacitorMusicControls.addListener("controlsNotification", (info) => { CapacitorMusicControls.addListener("controlsNotification", (info) => {
this.console.log(info) console.log(info)
this.handleControlsEvent(info) this.handleControlsEvent(info)
}) })
// ANDROID (13, see bug above as to why it's necessary)
document.addEventListener("controlsNotification", (event) => { document.addEventListener("controlsNotification", (event) => {
this.console.log(event) console.log(event)
const info = { message: event.message, position: 0 } const info = { message: event.message, position: 0 }

View File

@ -120,7 +120,7 @@ export default class Player extends Core {
app.cores.sync.music.dispatchEvent("music.player.state.update", this.state) app.cores.sync.music.dispatchEvent("music.player.state.update", this.state)
}, },
"player.seeked": (to) => { "player.seeked": (to) => {
app.cores.sync.music.dispatchEvent("music.player.seek", to) app.cores.sync.music.dispatchEvent("music.player.seek", to)
}, },
} }
@ -213,12 +213,12 @@ export default class Player extends Core {
return false return false
} }
if (!app.layout.floatingStack) { if (!app.layout.tools_bar) {
this.console.error("Floating stack not found") this.console.error("Tools bar not found")
return false return false
} }
this.currentDomWindow = app.layout.floatingStack.add("mediaPlayer", EmbbededMediaPlayer) this.currentDomWindow = app.layout.tools_bar.attachRender("mediaPlayer", EmbbededMediaPlayer)
} }
detachPlayerComponent() { detachPlayerComponent() {
@ -227,12 +227,12 @@ export default class Player extends Core {
return false return false
} }
if (!app.layout.floatingStack) { if (!app.layout.tools_bar) {
this.console.error("Floating stack not found") this.console.error("Tools bar not found")
return false return false
} }
app.layout.floatingStack.remove("mediaPlayer") app.layout.tools_bar.detachRender("mediaPlayer")
this.currentDomWindow = null this.currentDomWindow = null
} }
@ -266,7 +266,7 @@ export default class Player extends Core {
const img = new Image() const img = new Image()
img.crossOrigin = "anonymous" img.crossOrigin = "anonymous"
img.src = `https://cors-anywhere.herokuapp.com/${instance.manifest.cover ?? instance.manifest.thumbnail}` img.src = instance.manifest.cover ?? instance.manifest.thumbnail //`https://cors-anywhere.herokuapp.com/${instance.manifest.cover ?? instance.manifest.thumbnail}`
const cover_analysis = await this.fac.getColorAsync(img) const cover_analysis = await this.fac.getColorAsync(img)
.catch((err) => { .catch((err) => {