Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Destroy playback instance on voice message unmount #6101

Merged
merged 2 commits into from
May 26, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/components/views/messages/MVoiceMessageBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,16 @@ export default class MVoiceMessageBody extends React.PureComponent<IProps, IStat

// We should have a buffer to work with now: let's set it up
const playback = new Playback(buffer, waveform);
this.setState({playback});
this.setState({ playback });
// Note: the RecordingPlayback component will handle preparing the Playback class for us.
}

public componentWillUnmount() {
if (this.state.playback) {
this.state.playback.destroy();
}
jaiwanth-v marked this conversation as resolved.
Show resolved Hide resolved
}

public render() {
if (this.state.error) {
// TODO: @@TR: Verify error state
Expand Down