You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-07 10:46:24 +03:00
Name functions better
This commit is contained in:
@@ -63,7 +63,7 @@ export default class MAudioBody extends React.PureComponent<IBodyProps, IState>
|
|||||||
const waveform = content?.["org.matrix.msc1767.audio"]?.waveform?.map(p => p / 1024);
|
const waveform = content?.["org.matrix.msc1767.audio"]?.waveform?.map(p => p / 1024);
|
||||||
|
|
||||||
// We should have a buffer to work with now: let's set it up
|
// We should have a buffer to work with now: let's set it up
|
||||||
const playback = PlaybackManager.instance.createInstance(buffer, waveform);
|
const playback = PlaybackManager.instance.createPlaybackInstance(buffer, waveform);
|
||||||
playback.clockInfo.populatePlaceholdersFrom(this.props.mxEvent);
|
playback.clockInfo.populatePlaceholdersFrom(this.props.mxEvent);
|
||||||
this.setState({ playback });
|
this.setState({ playback });
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ export class ManagedPlayback extends Playback {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public destroy() {
|
public destroy() {
|
||||||
this.manager.destroyInstance(this);
|
this.manager.destroyPlaybackInstance(this);
|
||||||
super.destroy();
|
super.destroy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,11 +42,11 @@ export class PlaybackManager {
|
|||||||
this.instances.filter(p => p !== playback).forEach(p => p.stop());
|
this.instances.filter(p => p !== playback).forEach(p => p.stop());
|
||||||
}
|
}
|
||||||
|
|
||||||
public destroyInstance(playback: ManagedPlayback) {
|
public destroyPlaybackInstance(playback: ManagedPlayback) {
|
||||||
this.instances = this.instances.filter(p => p !== playback);
|
this.instances = this.instances.filter(p => p !== playback);
|
||||||
}
|
}
|
||||||
|
|
||||||
public createInstance(buf: ArrayBuffer, waveform = DEFAULT_WAVEFORM): Playback {
|
public createPlaybackInstance(buf: ArrayBuffer, waveform = DEFAULT_WAVEFORM): Playback {
|
||||||
const instance = new ManagedPlayback(this, buf, waveform);
|
const instance = new ManagedPlayback(this, buf, waveform);
|
||||||
this.instances.push(instance);
|
this.instances.push(instance);
|
||||||
return instance;
|
return instance;
|
||||||
|
|||||||
Reference in New Issue
Block a user