Переглянути джерело

feat(lobby) Add sound for participant knocking

master
hmuresan 4 роки тому
джерело
коміт
b6b943e7de

+ 6
- 0
react/features/lobby/constants.js Переглянути файл

2
  * Hide these emails when trying to join a lobby
2
  * Hide these emails when trying to join a lobby
3
  */
3
  */
4
 export const HIDDEN_EMAILS = [ 'inbound-sip-jibri@jitsi.net', 'outbound-sip-jibri@jitsi.net' ];
4
 export const HIDDEN_EMAILS = [ 'inbound-sip-jibri@jitsi.net', 'outbound-sip-jibri@jitsi.net' ];
5
+
6
+/**
7
+ * The identifier of the sound to be played when a participant joins lobby.
8
+ * @type {string}
9
+ */
10
+export const KNOCKING_PARTICIPANT_SOUND_ID = 'KNOCKING_PARTICIPANT_SOUND';

+ 19
- 4
react/features/lobby/middleware.js Переглянути файл

1
 // @flow
1
 // @flow
2
 
2
 
3
+import { batch } from 'react-redux';
4
+
5
+import { APP_WILL_MOUNT, APP_WILL_UNMOUNT } from '../base/app';
3
 import { CONFERENCE_FAILED, CONFERENCE_JOINED } from '../base/conference';
6
 import { CONFERENCE_FAILED, CONFERENCE_JOINED } from '../base/conference';
4
 import { JitsiConferenceErrors, JitsiConferenceEvents } from '../base/lib-jitsi-meet';
7
 import { JitsiConferenceErrors, JitsiConferenceEvents } from '../base/lib-jitsi-meet';
5
 import { getFirstLoadableAvatarUrl, getParticipantDisplayName } from '../base/participants';
8
 import { getFirstLoadableAvatarUrl, getParticipantDisplayName } from '../base/participants';
6
 import { MiddlewareRegistry, StateListenerRegistry } from '../base/redux';
9
 import { MiddlewareRegistry, StateListenerRegistry } from '../base/redux';
10
+import { playSound, registerSound, unregisterSound } from '../base/sounds';
7
 import { isTestModeEnabled } from '../base/testing';
11
 import { isTestModeEnabled } from '../base/testing';
8
 import { NOTIFICATION_TYPE, showNotification } from '../notifications';
12
 import { NOTIFICATION_TYPE, showNotification } from '../notifications';
9
 import { shouldAutoKnock } from '../prejoin/functions';
13
 import { shouldAutoKnock } from '../prejoin/functions';
18
     startKnocking,
22
     startKnocking,
19
     setPasswordJoinFailed
23
     setPasswordJoinFailed
20
 } from './actions';
24
 } from './actions';
25
+import { KNOCKING_PARTICIPANT_SOUND_ID } from './constants';
26
+import { KNOCKING_PARTICIPANT_FILE } from './sounds';
21
 
27
 
22
 MiddlewareRegistry.register(store => next => action => {
28
 MiddlewareRegistry.register(store => next => action => {
23
     switch (action.type) {
29
     switch (action.type) {
30
+    case APP_WILL_MOUNT:
31
+        store.dispatch(registerSound(KNOCKING_PARTICIPANT_SOUND_ID, KNOCKING_PARTICIPANT_FILE));
32
+        break;
33
+    case APP_WILL_UNMOUNT:
34
+        store.dispatch(unregisterSound(KNOCKING_PARTICIPANT_SOUND_ID));
35
+        break;
24
     case CONFERENCE_FAILED:
36
     case CONFERENCE_FAILED:
25
         return _conferenceFailed(store, next, action);
37
         return _conferenceFailed(store, next, action);
26
     case CONFERENCE_JOINED:
38
     case CONFERENCE_JOINED:
51
             });
63
             });
52
 
64
 
53
             conference.on(JitsiConferenceEvents.LOBBY_USER_JOINED, (id, name) => {
65
             conference.on(JitsiConferenceEvents.LOBBY_USER_JOINED, (id, name) => {
54
-                dispatch(participantIsKnockingOrUpdated({
55
-                    id,
56
-                    name
57
-                }));
66
+                batch(() => {
67
+                    dispatch(participantIsKnockingOrUpdated({
68
+                        id,
69
+                        name
70
+                    }));
71
+                    dispatch(playSound(KNOCKING_PARTICIPANT_SOUND_ID));
72
+                });
58
             });
73
             });
59
 
74
 
60
             conference.on(JitsiConferenceEvents.LOBBY_USER_UPDATED, (id, participant) => {
75
             conference.on(JitsiConferenceEvents.LOBBY_USER_UPDATED, (id, participant) => {

+ 5
- 0
react/features/lobby/sounds.js Переглянути файл

1
+/**
2
+ * The name of the bundled sound file which will be played when a
3
+ * participant enters lobby.
4
+ */
5
+export const KNOCKING_PARTICIPANT_FILE = 'knock.mp3';

BIN
sounds/knock.mp3 Переглянути файл


Завантаження…
Відмінити
Зберегти