From c344a83376b2ba5fedac6682686fe9fc7c44961c Mon Sep 17 00:00:00 2001 From: hristoterezov Date: Wed, 16 May 2018 10:03:10 -0500 Subject: [PATCH] Outgoing call ringtones (#2949) * fix(PresenceLabel): Use translated strings for the presence label. * feat(sounds): Implements loop and stop functionality. * feat(invite): Add ringtones. * fix(invite): Code style issues. --- lang/main.json | 10 ++ modules/UI/videolayout/LargeVideoManager.js | 6 +- modules/UI/videolayout/RemoteVideo.js | 4 +- .../base/media/components/AbstractAudio.js | 4 +- .../base/media/components/native/Audio.js | 13 +++ .../base/media/components/web/Audio.js | 17 +++ react/features/base/sounds/actionTypes.js | 10 ++ react/features/base/sounds/actions.js | 31 +++++- .../base/sounds/components/SoundCollection.js | 5 +- react/features/base/sounds/middleware.js | 30 ++++- react/features/base/sounds/reducer.js | 10 +- react/features/invite/constants.js | 14 +++ react/features/invite/middleware.any.js | 105 +++++++++++++++++- react/features/invite/sounds.js | 11 ++ .../components/PresenceLabel.js | 35 +++++- react/features/presence-status/constants.js | 70 ++++++++++++ react/features/presence-status/index.js | 1 + sounds/outgoingRinging.wav | Bin 0 -> 132344 bytes sounds/outgoingStart.wav | Bin 0 -> 211000 bytes 19 files changed, 362 insertions(+), 14 deletions(-) create mode 100644 react/features/invite/constants.js create mode 100644 react/features/invite/sounds.js create mode 100644 react/features/presence-status/constants.js create mode 100644 sounds/outgoingRinging.wav create mode 100644 sounds/outgoingStart.wav diff --git a/lang/main.json b/lang/main.json index 80e64bf4f..4803ab223 100644 --- a/lang/main.json +++ b/lang/main.json @@ -577,5 +577,15 @@ "appNotInstalled": "You need the __app__ mobile app to join this meeting on your phone.", "downloadApp": "Download the app", "openApp": "Continue to the app" + }, + "presenceStatus": { + "invited": "Invited", + "ringing": "Ringing", + "calling": "Calling", + "connected": "Connected", + "connecting": "Connecting", + "busy": "Busy", + "rejected": "Rejected", + "ignored": "Ignored" } } diff --git a/modules/UI/videolayout/LargeVideoManager.js b/modules/UI/videolayout/LargeVideoManager.js index 9ddafa45a..6d7ef3d62 100644 --- a/modules/UI/videolayout/LargeVideoManager.js +++ b/modules/UI/videolayout/LargeVideoManager.js @@ -2,8 +2,10 @@ /* eslint-disable no-unused-vars */ import React from 'react'; import ReactDOM from 'react-dom'; +import { I18nextProvider } from 'react-i18next'; import { Provider } from 'react-redux'; +import { i18next } from '../../../react/features/base/i18n'; import { PresenceLabel } from '../../../react/features/presence-status'; /* eslint-enable no-unused-vars */ @@ -456,7 +458,9 @@ export default class LargeVideoManager { if (presenceLabelContainer.length) { ReactDOM.render( - + + + , presenceLabelContainer.get(0)); } diff --git a/modules/UI/videolayout/RemoteVideo.js b/modules/UI/videolayout/RemoteVideo.js index 2986c4c0b..150818f46 100644 --- a/modules/UI/videolayout/RemoteVideo.js +++ b/modules/UI/videolayout/RemoteVideo.js @@ -609,7 +609,9 @@ RemoteVideo.prototype.addPresenceLabel = function() { if (presenceLabelContainer) { ReactDOM.render( - + + + , presenceLabelContainer); } diff --git a/react/features/base/media/components/AbstractAudio.js b/react/features/base/media/components/AbstractAudio.js index 7919bcc66..28c3d6853 100644 --- a/react/features/base/media/components/AbstractAudio.js +++ b/react/features/base/media/components/AbstractAudio.js @@ -7,6 +7,7 @@ import { Component } from 'react'; * playback. */ export type AudioElement = { + currentTime?: number, pause: () => void, play: () => void, setSinkId?: string => void @@ -32,7 +33,8 @@ type Props = { * @type {Object | string} */ src: Object | string, - stream: Object + stream: Object, + loop?: ?boolean } /** diff --git a/react/features/base/media/components/native/Audio.js b/react/features/base/media/components/native/Audio.js index fa2ee4109..418c75ce7 100644 --- a/react/features/base/media/components/native/Audio.js +++ b/react/features/base/media/components/native/Audio.js @@ -74,4 +74,17 @@ export default class Audio extends AbstractAudio { // writing to not render anything. return null; } + + /** + * Stops the sound if it's currently playing. + * + * @returns {void} + */ + stop() { + // Currently not implemented for mobile. If needed, a possible + // implementation is: + // if (this._sound) { + // this._sound.stop(); + // } + } } diff --git a/react/features/base/media/components/web/Audio.js b/react/features/base/media/components/web/Audio.js index bfba1365a..1fc56aa69 100644 --- a/react/features/base/media/components/web/Audio.js +++ b/react/features/base/media/components/web/Audio.js @@ -41,8 +41,11 @@ export default class Audio extends AbstractAudio { * @returns {ReactElement} */ render() { + const loop = this.props.loop ? 'true' : null; + return (