Generalise VoiceRecording (#9304)
This commit is contained in:
parent
71cf9bf932
commit
c182c1c706
11 changed files with 422 additions and 103 deletions
|
@ -16,12 +16,13 @@ limitations under the License.
|
|||
|
||||
import React from "react";
|
||||
|
||||
import { IRecordingUpdate, VoiceRecording } from "../../../audio/VoiceRecording";
|
||||
import { IRecordingUpdate } from "../../../audio/VoiceRecording";
|
||||
import Clock from "./Clock";
|
||||
import { MarkedExecution } from "../../../utils/MarkedExecution";
|
||||
import { VoiceMessageRecording } from "../../../audio/VoiceMessageRecording";
|
||||
|
||||
interface IProps {
|
||||
recorder: VoiceRecording;
|
||||
recorder: VoiceMessageRecording;
|
||||
}
|
||||
|
||||
interface IState {
|
||||
|
|
|
@ -16,13 +16,14 @@ limitations under the License.
|
|||
|
||||
import React from "react";
|
||||
|
||||
import { IRecordingUpdate, RECORDING_PLAYBACK_SAMPLES, VoiceRecording } from "../../../audio/VoiceRecording";
|
||||
import { IRecordingUpdate, RECORDING_PLAYBACK_SAMPLES } from "../../../audio/VoiceRecording";
|
||||
import { arrayFastResample, arraySeed } from "../../../utils/arrays";
|
||||
import Waveform from "./Waveform";
|
||||
import { MarkedExecution } from "../../../utils/MarkedExecution";
|
||||
import { VoiceMessageRecording } from "../../../audio/VoiceMessageRecording";
|
||||
|
||||
interface IProps {
|
||||
recorder: VoiceRecording;
|
||||
recorder: VoiceMessageRecording;
|
||||
}
|
||||
|
||||
interface IState {
|
||||
|
|
|
@ -37,7 +37,7 @@ import ReplyPreview from "./ReplyPreview";
|
|||
import { UPDATE_EVENT } from "../../../stores/AsyncStore";
|
||||
import VoiceRecordComposerTile from "./VoiceRecordComposerTile";
|
||||
import { VoiceRecordingStore } from "../../../stores/VoiceRecordingStore";
|
||||
import { RecordingState, VoiceRecording } from "../../../audio/VoiceRecording";
|
||||
import { RecordingState } from "../../../audio/VoiceRecording";
|
||||
import Tooltip, { Alignment } from "../elements/Tooltip";
|
||||
import ResizeNotifier from "../../../utils/ResizeNotifier";
|
||||
import { E2EStatus } from '../../../utils/ShieldUtils';
|
||||
|
@ -53,6 +53,7 @@ import { ButtonEvent } from '../elements/AccessibleButton';
|
|||
import { ViewRoomPayload } from "../../../dispatcher/payloads/ViewRoomPayload";
|
||||
import { isLocalRoom } from '../../../utils/localRoom/isLocalRoom';
|
||||
import { Features } from '../../../settings/Settings';
|
||||
import { VoiceMessageRecording } from '../../../audio/VoiceMessageRecording';
|
||||
|
||||
let instanceCount = 0;
|
||||
|
||||
|
@ -101,7 +102,7 @@ export default class MessageComposer extends React.Component<IProps, IState> {
|
|||
private ref: React.RefObject<HTMLDivElement> = createRef();
|
||||
private instanceId: number;
|
||||
|
||||
private _voiceRecording: Optional<VoiceRecording>;
|
||||
private _voiceRecording: Optional<VoiceMessageRecording>;
|
||||
|
||||
public static contextType = RoomContext;
|
||||
public context!: React.ContextType<typeof RoomContext>;
|
||||
|
@ -133,11 +134,11 @@ export default class MessageComposer extends React.Component<IProps, IState> {
|
|||
SettingsStore.monitorSetting(Features.VoiceBroadcast, null);
|
||||
}
|
||||
|
||||
private get voiceRecording(): Optional<VoiceRecording> {
|
||||
private get voiceRecording(): Optional<VoiceMessageRecording> {
|
||||
return this._voiceRecording;
|
||||
}
|
||||
|
||||
private set voiceRecording(rec: Optional<VoiceRecording>) {
|
||||
private set voiceRecording(rec: Optional<VoiceMessageRecording>) {
|
||||
if (this._voiceRecording) {
|
||||
this._voiceRecording.off(RecordingState.Started, this.onRecordingStarted);
|
||||
this._voiceRecording.off(RecordingState.EndingSoon, this.onRecordingEndingSoon);
|
||||
|
|
|
@ -23,7 +23,7 @@ import { IEventRelation, MatrixEvent } from "matrix-js-sdk/src/models/event";
|
|||
|
||||
import AccessibleTooltipButton from "../elements/AccessibleTooltipButton";
|
||||
import { _t } from "../../../languageHandler";
|
||||
import { IUpload, RecordingState, VoiceRecording } from "../../../audio/VoiceRecording";
|
||||
import { RecordingState } from "../../../audio/VoiceRecording";
|
||||
import { MatrixClientPeg } from "../../../MatrixClientPeg";
|
||||
import LiveRecordingWaveform from "../audio_messages/LiveRecordingWaveform";
|
||||
import LiveRecordingClock from "../audio_messages/LiveRecordingClock";
|
||||
|
@ -44,6 +44,7 @@ import { attachRelation } from "./SendMessageComposer";
|
|||
import { addReplyToMessageContent } from "../../../utils/Reply";
|
||||
import { RoomPermalinkCreator } from "../../../utils/permalinks/Permalinks";
|
||||
import RoomContext from "../../../contexts/RoomContext";
|
||||
import { IUpload, VoiceMessageRecording } from "../../../audio/VoiceMessageRecording";
|
||||
|
||||
interface IProps {
|
||||
room: Room;
|
||||
|
@ -53,7 +54,7 @@ interface IProps {
|
|||
}
|
||||
|
||||
interface IState {
|
||||
recorder?: VoiceRecording;
|
||||
recorder?: VoiceMessageRecording;
|
||||
recordingPhase?: RecordingState;
|
||||
didUploadFail?: boolean;
|
||||
}
|
||||
|
@ -250,7 +251,7 @@ export default class VoiceRecordComposerTile extends React.PureComponent<IProps,
|
|||
}
|
||||
};
|
||||
|
||||
private bindNewRecorder(recorder: Optional<VoiceRecording>) {
|
||||
private bindNewRecorder(recorder: Optional<VoiceMessageRecording>) {
|
||||
if (this.state.recorder) {
|
||||
this.state.recorder.off(UPDATE_EVENT, this.onRecordingUpdate);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue