2017-03-02 09:03:02 +08:00
|
|
|
import React from 'react';
|
2017-10-23 20:41:09 +08:00
|
|
|
import PropTypes from 'prop-types';
|
2020-05-26 04:00:13 +08:00
|
|
|
import { defineMessages, injectIntl } from 'react-intl';
|
2021-11-09 22:38:28 +08:00
|
|
|
import Styled from './styles';
|
|
|
|
import Settings from '/imports/ui/services/settings';
|
2017-10-10 04:48:10 +08:00
|
|
|
|
2017-10-23 20:41:09 +08:00
|
|
|
const propTypes = {
|
2021-08-09 22:24:02 +08:00
|
|
|
intl: PropTypes.shape({
|
|
|
|
formatMessage: PropTypes.func.isRequired,
|
|
|
|
}).isRequired,
|
2017-10-23 20:41:09 +08:00
|
|
|
handlePlayAudioSample: PropTypes.func.isRequired,
|
|
|
|
outputDeviceId: PropTypes.string,
|
|
|
|
};
|
|
|
|
|
|
|
|
const defaultProps = {
|
|
|
|
outputDeviceId: null,
|
|
|
|
};
|
|
|
|
|
2017-10-10 04:48:10 +08:00
|
|
|
const intlMessages = defineMessages({
|
|
|
|
playSoundLabel: {
|
|
|
|
id: 'app.audio.playSoundLabel',
|
|
|
|
description: 'Play sound button label',
|
|
|
|
},
|
|
|
|
});
|
2017-03-02 09:03:02 +08:00
|
|
|
|
|
|
|
class AudioTest extends React.Component {
|
|
|
|
constructor(props) {
|
2017-03-23 21:19:44 +08:00
|
|
|
super(props);
|
2017-10-10 04:48:10 +08:00
|
|
|
|
|
|
|
this.handlePlayAudioSample = props.handlePlayAudioSample.bind(this);
|
2017-03-23 21:19:44 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
const {
|
2017-10-10 04:48:10 +08:00
|
|
|
outputDeviceId,
|
2017-03-23 21:19:44 +08:00
|
|
|
intl,
|
|
|
|
} = this.props;
|
|
|
|
|
2021-11-09 22:38:28 +08:00
|
|
|
const { animations } = Settings.application;
|
|
|
|
|
2017-03-23 21:19:44 +08:00
|
|
|
return (
|
2021-11-09 22:38:28 +08:00
|
|
|
<Styled.TestAudioButton
|
2017-03-23 21:19:44 +08:00
|
|
|
label={intl.formatMessage(intlMessages.playSoundLabel)}
|
2021-08-09 22:24:02 +08:00
|
|
|
icon="unmute"
|
|
|
|
size="sm"
|
|
|
|
color="primary"
|
2017-10-10 04:48:10 +08:00
|
|
|
onClick={() => this.handlePlayAudioSample(outputDeviceId)}
|
2021-11-09 22:38:28 +08:00
|
|
|
animations={animations}
|
2017-03-23 21:19:44 +08:00
|
|
|
/>
|
|
|
|
);
|
|
|
|
}
|
2017-06-03 03:25:02 +08:00
|
|
|
}
|
2017-03-23 21:19:44 +08:00
|
|
|
|
2017-10-23 20:41:09 +08:00
|
|
|
AudioTest.propTypes = propTypes;
|
|
|
|
AudioTest.defaultProps = defaultProps;
|
|
|
|
|
2017-03-23 21:19:44 +08:00
|
|
|
export default injectIntl(AudioTest);
|