mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 12:55:00 +00: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) {
|
||||
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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user