AudioPeers and Fixes
parent
e98d80ed57
commit
944b809c15
|
|
@ -1129,8 +1129,8 @@ export default class RoomClient
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const audioElements = document.getElementById("audio");
|
const audioElements = document.getElementsByTagName("audio");
|
||||||
for( let i=0; i<audioElements; i++){
|
for( let i=0; i<audioElements.length; i++){
|
||||||
if (typeof audioElements[0].setSinkId === 'function'){
|
if (typeof audioElements[0].setSinkId === 'function'){
|
||||||
if (i === 0) logger.debug('changeAudioOutputDevice()');
|
if (i === 0) logger.debug('changeAudioOutputDevice()');
|
||||||
await audioElements[i].setSinkId(deviceId);
|
await audioElements[i].setSinkId(deviceId);
|
||||||
|
|
|
||||||
|
|
@ -3,11 +3,13 @@ import { connect } from 'react-redux';
|
||||||
import { micConsumerSelector } from '../Selectors';
|
import { micConsumerSelector } from '../Selectors';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import PeerAudio from './PeerAudio';
|
import PeerAudio from './PeerAudio';
|
||||||
|
import settings from '../../reducers/settings';
|
||||||
|
|
||||||
const AudioPeers = (props) =>
|
const AudioPeers = (props) =>
|
||||||
{
|
{
|
||||||
const {
|
const {
|
||||||
micConsumers
|
micConsumers,
|
||||||
|
audioOutputDevice
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
@ -19,6 +21,7 @@ const AudioPeers = (props) =>
|
||||||
<PeerAudio
|
<PeerAudio
|
||||||
key={micConsumer.id}
|
key={micConsumer.id}
|
||||||
audioTrack={micConsumer.track}
|
audioTrack={micConsumer.track}
|
||||||
|
audioOutputDevice={audioOutputDevice}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
|
|
@ -34,7 +37,8 @@ AudioPeers.propTypes =
|
||||||
|
|
||||||
const mapStateToProps = (state) =>
|
const mapStateToProps = (state) =>
|
||||||
({
|
({
|
||||||
micConsumers : micConsumerSelector(state)
|
micConsumers : micConsumerSelector(state),
|
||||||
|
audioOutputDevice : settings.selectedAudioOutputDevice
|
||||||
});
|
});
|
||||||
|
|
||||||
const AudioPeersContainer = connect(
|
const AudioPeersContainer = connect(
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ export default class PeerAudio extends React.PureComponent
|
||||||
// Latest received audio track.
|
// Latest received audio track.
|
||||||
// @type {MediaStreamTrack}
|
// @type {MediaStreamTrack}
|
||||||
this._audioTrack = null;
|
this._audioTrack = null;
|
||||||
|
this._audioOutputDevice = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
render()
|
render()
|
||||||
|
|
@ -24,9 +25,10 @@ export default class PeerAudio extends React.PureComponent
|
||||||
|
|
||||||
componentDidMount()
|
componentDidMount()
|
||||||
{
|
{
|
||||||
const { audioTrack } = this.props;
|
const { audioTrack, audioOutputDevice } = this.props;
|
||||||
|
|
||||||
this._setTrack(audioTrack);
|
this._setTrack(audioTrack);
|
||||||
|
this._setOutputDevice(audioOutputDevice);
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line camelcase
|
// eslint-disable-next-line camelcase
|
||||||
|
|
@ -60,6 +62,20 @@ export default class PeerAudio extends React.PureComponent
|
||||||
audio.srcObject = null;
|
audio.srcObject = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_setOutputDevice(audioOutputDevice){
|
||||||
|
if(this._audioOutputDevice === audioOutputDevice)
|
||||||
|
return;
|
||||||
|
|
||||||
|
this._audioOutputDevice = audioOutputDevice;
|
||||||
|
|
||||||
|
const { audio } = this.refs;
|
||||||
|
|
||||||
|
if (audioOutputDevice && typeof audio.setSinkId === 'function')
|
||||||
|
{
|
||||||
|
audio.setSinkId(audioOutputDevice);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PeerAudio.propTypes =
|
PeerAudio.propTypes =
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue