diff --git a/bigbluebutton-html5/imports/api/2.0/audio/client/bridge/sip.js b/bigbluebutton-html5/imports/api/2.0/audio/client/bridge/sip.js index 5c595cdf4765eeafb2b30245e8a6a3e88799334e..47a2156b5ac76901ddbbf0782b40988449711a79 100644 --- a/bigbluebutton-html5/imports/api/2.0/audio/client/bridge/sip.js +++ b/bigbluebutton-html5/imports/api/2.0/audio/client/bridge/sip.js @@ -165,6 +165,13 @@ export default class SIPBridge extends BaseAudioBridge { resolve(); }); + currentSession.mediaHandler.on('iceConnectionConnected', () => { + console.log('iceConnectionConnected'); + this.hangup = false; + callback({ status: 'started' }); + resolve(); + }); + this.currentSession = currentSession; }) } diff --git a/bigbluebutton-html5/imports/ui/components/audio/audio-modal/component.jsx b/bigbluebutton-html5/imports/ui/components/audio/audio-modal/component.jsx index 5d235edac66391a19c289605fc3ec57bd77927f6..73804874e56e89ca4dc0920937255ac9e4386c23 100644 --- a/bigbluebutton-html5/imports/ui/components/audio/audio-modal/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/audio/audio-modal/component.jsx @@ -55,26 +55,22 @@ class AudioModal extends Component { super(props); this.state = { - content: null, + content: 'settings', }; - const { - isConnecting, - isConnected, - isEchoTest, - inputDeviceId, - } = this.props; - this.handleGoToAudioOptions = this.handleGoToAudioOptions.bind(this); this.handleGoToAudioSettings = this.handleGoToAudioSettings.bind(this); this.handleGoToEchoTest = this.handleGoToEchoTest.bind(this); - this.closeModal = props.closeModal.bind(this); + this.closeModal = props.closeModal; this.handleJoinMicrophone = props.joinMicrophone; this.handleJoinListenOnly = props.joinListenOnly; this.joinEchoTest = props.joinEchoTest; this.exitAudio = props.exitAudio; this.leaveEchoTest = props.leaveEchoTest; this.changeInputDevice = props.changeInputDevice; + this.changeOutputDevice = props.changeOutputDevice; + + console.log(props); this.contents = { echoTest: () => this.renderEchoTest(), @@ -82,6 +78,17 @@ class AudioModal extends Component { }; } + componentWillUnmount() { + const { + isConnected, + isEchoTest, + } = this.props; + + if (isEchoTest) { + this.exitAudio(); + } + } + handleGoToAudioOptions() { this.setState({ content: null, @@ -93,7 +100,7 @@ class AudioModal extends Component { this.setState({ content: 'settings', }); - }) + }); } handleGoToEchoTest() { @@ -101,18 +108,7 @@ class AudioModal extends Component { this.setState({ content: 'echoTest', }); - }) - } - - componentWillUnmount() { - const { - isConnected, - isEchoTest, - } = this.props; - - if (isEchoTest) { - this.exitAudio(); - } + }); } renderAudioOptions() { @@ -221,6 +217,7 @@ class AudioModal extends Component { joinEchoTest={this.joinEchoTest} exitAudio={this.exitAudio} changeInputDevice={this.changeInputDevice} + changeOutputDevice={this.changeOutputDevice} isConnecting={isConnecting} isConnected={isConnected} isEchoTest={isEchoTest} diff --git a/bigbluebutton-html5/imports/ui/components/audio/audio-modal/container.jsx b/bigbluebutton-html5/imports/ui/components/audio/audio-modal/container.jsx index 06e9b0e68512cf919dafd4d17fb2ec02d8d63c15..c387fd191d06cc45304906e11bacbd78d2e2d5a3 100644 --- a/bigbluebutton-html5/imports/ui/components/audio/audio-modal/container.jsx +++ b/bigbluebutton-html5/imports/ui/components/audio/audio-modal/container.jsx @@ -45,6 +45,7 @@ export default withModalMounter(createContainer(({ mountModal }) => return Service.exitAudio(); }, changeInputDevice: (inputDeviceId) => Service.changeInputDevice(inputDeviceId), + changeOutputDevice: (outputDeviceId) => Service.changeOutputDevice(outputDeviceId), joinEchoTest: () => Service.joinEchoTest(), exitAudio: () => Service.exitAudio(), isConnecting: Service.isConnecting(), diff --git a/bigbluebutton-html5/imports/ui/components/audio/audio-settings/component.jsx b/bigbluebutton-html5/imports/ui/components/audio/audio-settings/component.jsx index b92e680119dd7f947cf676b9f55f654ae0dff113..c818c8052f7c9b91a5eb43ffb86d5a2b11e333f8 100644 --- a/bigbluebutton-html5/imports/ui/components/audio/audio-settings/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/audio/audio-settings/component.jsx @@ -51,7 +51,7 @@ class AudioSettings extends React.Component { this.handleRetry = props.handleRetry; this.exitAudio = props.exitAudio; this.changeInputDevice = props.changeInputDevice; - + this.changeOutputDevice = props.changeOutputDevice; console.log('inputDeviceId', props.inputDeviceId); this.state = { @@ -76,6 +76,7 @@ class AudioSettings extends React.Component { handleOutputChange(deviceId, device) { console.log(`OUTPUT DEVICE CHANGED: ${deviceId}`); console.log(device); + this.changeOutputDevice(deviceId); this.setState({ outputDeviceId: deviceId, }); @@ -144,8 +145,10 @@ class AudioSettings extends React.Component { </div> </div> <div className={styles.col}> - <label className={styles.label}>Â </label> - <AudioTestContainer /> + <label className={styles.labelSmall}> + Test your speaker volume + <AudioTestContainer /> + </label> </div> </div> </div> diff --git a/bigbluebutton-html5/imports/ui/components/audio/audio-settings/styles.scss b/bigbluebutton-html5/imports/ui/components/audio/audio-settings/styles.scss index c223a09435b0726fb993ca5d4a505ceb5d8ff129..5ea4ee9c9f60ded6d2da2eb7d0e5bc367fbd432a 100644 --- a/bigbluebutton-html5/imports/ui/components/audio/audio-settings/styles.scss +++ b/bigbluebutton-html5/imports/ui/components/audio/audio-settings/styles.scss @@ -36,7 +36,10 @@ color: black; font-size: 0.85rem; font-weight: 600; - margin-bottom: 0.5rem; + + & > :first-child { + margin-top: 0.5rem; + } } .formElement { @@ -47,13 +50,16 @@ } .select { - background-color: #fff; - border: 0; - border-bottom: 0.1rem solid $color-text; + -webkit-appearance: none; + -webkit-border-radius: 0px; + background: $color-white url("data:image/svg+xml;charset=utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 5'><path fill='#667189' d='M2 0L0 2h4zm0 5L0 3h4z'/></svg>") no-repeat right .35rem center/.4rem .5rem; + background-repeat: no-repeat; + border: 0.07rem solid $color-gray-light; + border-radius: .125rem; color: $color-text; width: 100%; // appearance: none; - height: 1.75rem; + padding: .4rem; } .audioMeter { diff --git a/bigbluebutton-html5/imports/ui/components/audio/audio-test/component.jsx b/bigbluebutton-html5/imports/ui/components/audio/audio-test/component.jsx index 33ace856628851727ace7c1b0e192c0e80c05e32..da775040f3a7e7ce8fccb0e7cdad47f8bf190c41 100644 --- a/bigbluebutton-html5/imports/ui/components/audio/audio-test/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/audio/audio-test/component.jsx @@ -1,15 +1,25 @@ import React from 'react'; import Button from '/imports/ui/components/button/component'; -import styles from './styles.scss'; import { defineMessages, injectIntl } from 'react-intl'; +import styles from './styles.scss'; + +const intlMessages = defineMessages({ + playSoundLabel: { + id: 'app.audio.playSoundLabel', + description: 'Play sound button label', + }, +}); class AudioTest extends React.Component { constructor(props) { super(props); + + this.handlePlayAudioSample = props.handlePlayAudioSample.bind(this); } render() { const { + outputDeviceId, intl, } = this.props; @@ -20,17 +30,10 @@ class AudioTest extends React.Component { icon={'unmute'} size={'sm'} color={'primary'} - onClick={this.props.handlePlayAudioSample} + onClick={() => this.handlePlayAudioSample(outputDeviceId)} /> ); } } -const intlMessages = defineMessages({ - playSoundLabel: { - id: 'app.audio.playSoundLabel', - description: 'Play sound button label', - }, -}); - export default injectIntl(AudioTest); diff --git a/bigbluebutton-html5/imports/ui/components/audio/audio-test/container.jsx b/bigbluebutton-html5/imports/ui/components/audio/audio-test/container.jsx index 37420893afe78df3005acb3826e9ae1fb85dbd16..088fa1c7b31bda2895e68dfaafe4c0c2eb560792 100644 --- a/bigbluebutton-html5/imports/ui/components/audio/audio-test/container.jsx +++ b/bigbluebutton-html5/imports/ui/components/audio/audio-test/container.jsx @@ -1,24 +1,20 @@ -import React, { Component } from 'react'; +import React from 'react'; import { createContainer } from 'meteor/react-meteor-data'; +import Service from '/imports/ui/components/audio/service'; import AudioTest from './component'; -class AudioTestContainer extends Component { - constructor(props) { - super(props); - } - - render() { - return ( - <AudioTest {...this.props}> - {this.props.children} - </AudioTest> - ); - } -} +const AudioTestContainer = props => ( + <AudioTest {...props}> + {props.children} + </AudioTest> +); export default createContainer(() => ({ - handlePlayAudioSample: () => { - const snd = new Audio('resources/sounds/audioSample.mp3'); - snd.play(); + outputDeviceId: Service.outputDeviceId(), + handlePlayAudioSample: (deviceId) => { + console.log('handle play audio sample', deviceId); + const sound = new Audio('resources/sounds/audioSample.mp3'); + sound.setSinkId(deviceId); + sound.play(); }, }), AudioTestContainer); diff --git a/bigbluebutton-html5/imports/ui/components/audio/component.jsx b/bigbluebutton-html5/imports/ui/components/audio/component.jsx index 978cbe9af0ead95e4fd69bf3aa5174e27ea7ace5..39d0db68bb9beb8c99d9c748ba4742106a1d3907 100644 --- a/bigbluebutton-html5/imports/ui/components/audio/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/audio/component.jsx @@ -1,9 +1,9 @@ import React, { Component } from 'react'; export default class Audio extends Component { - constructor(props) { - super(props); - props.init.call(this); + componentDidMount() { + console.log('KKKKKKKK'); + this.props.init.call(this); } render() { diff --git a/bigbluebutton-html5/imports/ui/components/audio/container.jsx b/bigbluebutton-html5/imports/ui/components/audio/container.jsx index e6fc03db8fb72547bb899ebf1b90cf2c4f502e34..0f4f5fc96dd2e3097b975af52798bcfd65edf2e9 100644 --- a/bigbluebutton-html5/imports/ui/components/audio/container.jsx +++ b/bigbluebutton-html5/imports/ui/components/audio/container.jsx @@ -30,6 +30,7 @@ export default withModalMounter(createContainer(({ mountModal }) => { return { init: () => { Service.init(); + Service.changeOutputDevice(document.querySelector('#remote-media').sinkId) if (!autoJoinAudio || didMountAutoJoin) return; mountModal(<AudioModalContainer />); didMountAutoJoin = true; @@ -38,4 +39,4 @@ export default withModalMounter(createContainer(({ mountModal }) => { }, AudioContainer)); AudioContainer.propTypes = propTypes; -AudioContainer.defaultProps = defaultProps; +AudioContainer.d diff --git a/bigbluebutton-html5/imports/ui/components/audio/service.js b/bigbluebutton-html5/imports/ui/components/audio/service.js index caec288c29e59d10c12299065dc11eaa0f0a4f68..0168de733c3b5163393ddc05ed1d47532c0adc71 100644 --- a/bigbluebutton-html5/imports/ui/components/audio/service.js +++ b/bigbluebutton-html5/imports/ui/components/audio/service.js @@ -34,6 +34,7 @@ export default { joinEchoTest: () => AudioManager.joinAudio({ isEchoTest: true }), toggleMuteMicrophone: () => AudioManager.toggleMuteMicrophone(), changeInputDevice: (inputDeviceId) => AudioManager.changeInputDevice(inputDeviceId), + changeOutputDevice: (outputDeviceId) => AudioManager.changeOutputDevice(outputDeviceId), isConnected: () => AudioManager.isConnected, isMuted: () => AudioManager.isMuted, isConnecting: () => AudioManager.isConnecting, diff --git a/bigbluebutton-html5/imports/ui/services/audio-manager/index.js b/bigbluebutton-html5/imports/ui/services/audio-manager/index.js index 2b65fb14de5c092ddf3226fc2230a9e67945961e..f4046a85afb3aec84082e3cfc547aae9e1d9e1ed 100644 --- a/bigbluebutton-html5/imports/ui/services/audio-manager/index.js +++ b/bigbluebutton-html5/imports/ui/services/audio-manager/index.js @@ -17,7 +17,9 @@ const ERROR_CODES = { }, }; -CALL_STATES = { +const OUTPUT_TAG = '#remote-media'; + +const CALL_STATES = { STARTED: 'started', ENDED: 'ended', FAILED: 'failed', @@ -39,6 +41,7 @@ class AudioManager { }) }); + this.defineProperties({ isMuted: false, isConnected: false, @@ -46,6 +49,7 @@ class AudioManager { isListenOnly: false, isEchoTest: false, error: null, + outputDeviceId: null, }); } @@ -234,6 +238,12 @@ class AudioManager { }); } + changeOutputDevice(deviceId) { + this.outputDeviceId = deviceId; + document.querySelector(OUTPUT_TAG).setSinkId(deviceId); + console.log('Change id'); + } + get inputStream () { return this._inputDevice.stream; }