Adds notifications for who stop/start recording/live streaming. (#4708)
* Adds notifications for who stop/start recording/live streaming. * Updates to latest lib-jitsi-meet.
This commit is contained in:
@@ -113,16 +113,46 @@ export function showRecordingError(props: Object) {
|
||||
*
|
||||
* @param {string} streamType - The type of the stream ({@code file} or
|
||||
* {@code stream}).
|
||||
* @param {string?} participantName - The participant name stopping the recording.
|
||||
* @returns {showNotification}
|
||||
*/
|
||||
export function showStoppedRecordingNotification(streamType: string) {
|
||||
export function showStoppedRecordingNotification(streamType: string, participantName?: string) {
|
||||
const isLiveStreaming
|
||||
= streamType === JitsiMeetJS.constants.recording.mode.STREAM;
|
||||
const descriptionArguments = { name: participantName };
|
||||
const dialogProps = isLiveStreaming ? {
|
||||
descriptionKey: 'liveStreaming.off',
|
||||
descriptionKey: participantName ? 'liveStreaming.offBy' : 'liveStreaming.off',
|
||||
descriptionArguments,
|
||||
titleKey: 'dialog.liveStreaming'
|
||||
} : {
|
||||
descriptionKey: 'recording.off',
|
||||
descriptionKey: participantName ? 'recording.offBy' : 'recording.off',
|
||||
descriptionArguments,
|
||||
titleKey: 'dialog.recording'
|
||||
};
|
||||
|
||||
return showNotification(dialogProps, NOTIFICATION_TIMEOUT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Signals that a started recording notification should be shown on the
|
||||
* screen for a given period.
|
||||
*
|
||||
* @param {string} streamType - The type of the stream ({@code file} or
|
||||
* {@code stream}).
|
||||
* @param {string} participantName - The participant name that started the recording.
|
||||
* @returns {showNotification}
|
||||
*/
|
||||
export function showStartedRecordingNotification(streamType: string, participantName: string) {
|
||||
const isLiveStreaming
|
||||
= streamType === JitsiMeetJS.constants.recording.mode.STREAM;
|
||||
const descriptionArguments = { name: participantName };
|
||||
const dialogProps = isLiveStreaming ? {
|
||||
descriptionKey: 'liveStreaming.onBy',
|
||||
descriptionArguments,
|
||||
titleKey: 'dialog.liveStreaming'
|
||||
} : {
|
||||
descriptionKey: 'recording.onBy',
|
||||
descriptionArguments,
|
||||
titleKey: 'dialog.recording'
|
||||
};
|
||||
|
||||
@@ -151,9 +181,11 @@ export function updateRecordingSessionData(session: Object) {
|
||||
sessionData: {
|
||||
error: session.getError(),
|
||||
id: session.getID(),
|
||||
initiator: session.getInitiator(),
|
||||
liveStreamViewURL: session.getLiveStreamViewURL(),
|
||||
mode: session.getMode(),
|
||||
status,
|
||||
terminator: session.getTerminator(),
|
||||
timestamp
|
||||
}
|
||||
};
|
||||
|
||||
@@ -11,6 +11,7 @@ import JitsiMeetJS, {
|
||||
JitsiConferenceEvents,
|
||||
JitsiRecordingConstants
|
||||
} from '../base/lib-jitsi-meet';
|
||||
import { getParticipantDisplayName } from '../base/participants';
|
||||
import { MiddlewareRegistry, StateListenerRegistry } from '../base/redux';
|
||||
import {
|
||||
playSound,
|
||||
@@ -24,6 +25,7 @@ import {
|
||||
hidePendingRecordingNotification,
|
||||
showPendingRecordingNotification,
|
||||
showRecordingError,
|
||||
showStartedRecordingNotification,
|
||||
showStoppedRecordingNotification,
|
||||
updateRecordingSessionData
|
||||
} from './actions';
|
||||
@@ -131,7 +133,7 @@ MiddlewareRegistry.register(({ dispatch, getState }) => next => action => {
|
||||
|
||||
const updatedSessionData
|
||||
= getSessionById(getState(), action.sessionData.id);
|
||||
const { mode } = updatedSessionData;
|
||||
const { initiator, mode, terminator } = updatedSessionData;
|
||||
const { PENDING, OFF, ON } = JitsiRecordingConstants.status;
|
||||
|
||||
if (updatedSessionData.status === PENDING
|
||||
@@ -142,6 +144,10 @@ MiddlewareRegistry.register(({ dispatch, getState }) => next => action => {
|
||||
|
||||
if (updatedSessionData.status === ON
|
||||
&& (!oldSessionData || oldSessionData.status !== ON)) {
|
||||
const initiatorName = initiator && getParticipantDisplayName(getState, initiator.getId());
|
||||
|
||||
initiatorName && dispatch(showStartedRecordingNotification(mode, initiatorName));
|
||||
|
||||
let soundID;
|
||||
|
||||
if (mode === JitsiRecordingConstants.mode.FILE) {
|
||||
@@ -156,7 +162,8 @@ MiddlewareRegistry.register(({ dispatch, getState }) => next => action => {
|
||||
}
|
||||
} else if (updatedSessionData.status === OFF
|
||||
&& (!oldSessionData || oldSessionData.status !== OFF)) {
|
||||
dispatch(showStoppedRecordingNotification(mode));
|
||||
dispatch(showStoppedRecordingNotification(
|
||||
mode, terminator && getParticipantDisplayName(getState, terminator.getId())));
|
||||
let duration = 0, soundOff, soundOn;
|
||||
|
||||
if (oldSessionData && oldSessionData.timestamp) {
|
||||
|
||||
Reference in New Issue
Block a user