diff --git a/Dockerfile b/Dockerfile index 860aeff..4038e99 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,6 +9,8 @@ COPY tsconfig.json tsconfig.app.json tsconfig.node.json vite.config.ts /srv/ COPY src /srv/src COPY public /srv/public COPY map /srv/map +COPY summon /srv/summon +COPY chromecast /srv/chromecast COPY ./index.html /srv/ RUN npm run build diff --git a/src/model/Audio/PlaylistGroupNode.ts b/src/model/Audio/PlaylistGroupNode.ts index b448f72..9291a07 100644 --- a/src/model/Audio/PlaylistGroupNode.ts +++ b/src/model/Audio/PlaylistGroupNode.ts @@ -1,6 +1,6 @@ import { VirtualFile } from "../FileSystem/types"; import { SoundGroupNode, SoundGroupNodeOptions } from "./SoundGroupNode"; -import { MediaElementSoundNode } from "./SoundNode"; +import { MediaElementSoundNode, SoundNode } from "./SoundNode"; export interface PlaylistGroupNodeOptions extends SoundGroupNodeOptions { currentTrack: number; @@ -13,7 +13,7 @@ export class PlaylistGroupNode extends SoundGroupNode private intervalId?: number; changeTrack(track: number) { - this.currentTrack.stop(); + this.currentTrack?.stop(); (this.currentTrack as MediaElementSoundNode)?.seek(0); this.soundNodes[this.options.currentTrack]?.stop(); this.options.currentTrack = track; @@ -46,6 +46,15 @@ export class PlaylistGroupNode extends SoundGroupNode }, 1000); } + removeSoundNode(node: SoundNode) { + const index = this.soundNodes.indexOf(node); + if (index === this.options.currentTrack) { + this.options.currentTrack = 0; + this.options.currentTrackTime = 0; + } + super.removeSoundNode(node); + } + stop() { this.currentTrack?.stop(); clearInterval(this.intervalId); diff --git a/src/model/Audio/SoundGroupNode.ts b/src/model/Audio/SoundGroupNode.ts index b1990b7..18ae65a 100644 --- a/src/model/Audio/SoundGroupNode.ts +++ b/src/model/Audio/SoundGroupNode.ts @@ -66,6 +66,7 @@ export abstract class SoundGroupNode { } removeSoundNode(node: SoundNode) { + node?.stop(); const index = this.soundNodes.indexOf(node); if (index > -1) { this.soundNodes.splice(index, 1);