fix(core): stop media when audio block is removed (#11492)

This commit is contained in:
pengx17
2025-04-07 06:15:50 +00:00
parent 4e33059d58
commit fddf68f061

View File

@@ -35,6 +35,12 @@ export class AudioAttachmentService extends Service {
if (!exists) {
const entity = this.framework.createEntity(AudioAttachmentBlock, model);
exists = this.pool.put(key, entity);
const subscription = model.deleted.subscribe(() => {
entity.audioMedia.stop();
exists?.release();
});
this.disposables.push(() => subscription.unsubscribe());
}
return exists;
}