mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-25 02:13:00 +08:00
fix(core): stop media when audio block is removed (#11492)
This commit is contained in:
@@ -35,6 +35,12 @@ export class AudioAttachmentService extends Service {
|
|||||||
if (!exists) {
|
if (!exists) {
|
||||||
const entity = this.framework.createEntity(AudioAttachmentBlock, model);
|
const entity = this.framework.createEntity(AudioAttachmentBlock, model);
|
||||||
exists = this.pool.put(key, entity);
|
exists = this.pool.put(key, entity);
|
||||||
|
|
||||||
|
const subscription = model.deleted.subscribe(() => {
|
||||||
|
entity.audioMedia.stop();
|
||||||
|
exists?.release();
|
||||||
|
});
|
||||||
|
this.disposables.push(() => subscription.unsubscribe());
|
||||||
}
|
}
|
||||||
return exists;
|
return exists;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user