only detach of bars tools if exist

This commit is contained in:
SrGooglo 2025-04-02 00:32:47 +00:00
parent 23192a1772
commit 22f747c235

View File

@ -1,43 +1,45 @@
import ToolBarPlayer from "@components/Player/ToolBarPlayer"
export default class PlayerUI {
constructor(player) {
this.player = player
constructor(player) {
this.player = player
return this
}
return this
}
currentDomWindow = null
currentDomWindow = null
//
// UI Methods
//
attachPlayerComponent() {
if (this.currentDomWindow) {
this.player.console.warn("EmbbededMediaPlayer already attached")
return false
}
//
// UI Methods
//
attachPlayerComponent() {
if (this.currentDomWindow) {
this.player.console.warn("EmbbededMediaPlayer already attached")
return false
}
if (app.layout.tools_bar) {
this.currentDomWindow = app.layout.tools_bar.attachRender("mediaPlayer", ToolBarPlayer, undefined, {
position: "bottom",
})
}
}
if (app.layout.tools_bar) {
this.currentDomWindow = app.layout.tools_bar.attachRender(
"mediaPlayer",
ToolBarPlayer,
undefined,
{
position: "bottom",
},
)
}
}
detachPlayerComponent() {
if (!this.currentDomWindow) {
this.player.console.warn("EmbbededMediaPlayer not attached")
return false
}
detachPlayerComponent() {
if (!this.currentDomWindow) {
this.player.console.warn("EmbbededMediaPlayer not attached")
return false
}
if (!app.layout.tools_bar) {
this.player.console.error("Tools bar not found")
return false
}
if (app.layout.tools_bar) {
app.layout.tools_bar.detachRender("mediaPlayer")
}
app.layout.tools_bar.detachRender("mediaPlayer")
this.currentDomWindow = null
}
this.currentDomWindow = null
}
}