Skip to content
Snippets Groups Projects
Unverified Commit eb231e88 authored by Anton Georgiev's avatar Anton Georgiev Committed by GitHub
Browse files

Merge pull request #6329 from antobinary/logs-audio-devices

Add logs for audio input/output devices to debug iOS
parents dc8aa379 22a4c495
No related branches found
No related tags found
No related merge requests found
......@@ -2,13 +2,13 @@ import React, { Component } from 'react';
import _ from 'lodash';
import PropTypes from 'prop-types';
import cx from 'classnames';
import logger from '/imports/startup/client/logger';
import { styles } from '../audio-modal/styles';
const propTypes = {
kind: PropTypes.oneOf(['audioinput', 'audiooutput', 'videoinput']),
onChange: PropTypes.func.isRequired,
value: PropTypes.string,
handleDeviceChange: PropTypes.func,
className: PropTypes.string,
};
......@@ -16,7 +16,6 @@ const defaultProps = {
kind: 'audioinput',
value: undefined,
className: null,
handleDeviceChange: null,
};
class DeviceSelector extends Component {
......@@ -35,7 +34,7 @@ class DeviceSelector extends Component {
componentDidMount() {
const handleEnumerateDevicesSuccess = (deviceInfos) => {
const devices = deviceInfos.filter(d => d.kind === this.props.kind);
logger.info(`Success on enumerateDevices() for ${this.props.kind}: ${JSON.stringify(devices)}`);
this.setState({
devices,
options: devices.map((d, i) => ({
......@@ -48,11 +47,14 @@ class DeviceSelector extends Component {
navigator.mediaDevices
.enumerateDevices()
.then(handleEnumerateDevicesSuccess);
.then(handleEnumerateDevicesSuccess)
.catch((err) => {
logger.error(`Error on enumerateDevices(): ${JSON.stringify(err)}`);
});
}
handleSelectChange(event) {
const value = event.target.value;
const { value } = event.target;
const { onChange } = this.props;
this.setState({ value }, () => {
const selectedDevice = this.state.devices.find(d => d.deviceId === value);
......@@ -61,7 +63,9 @@ class DeviceSelector extends Component {
}
render() {
const { kind, handleDeviceChange, className, ...props } = this.props;
const {
kind, className, ...props
} = this.props;
const { options, value } = this.state;
return (
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment