2017-10-10 04:48:10 +08:00
|
|
|
import React from 'react';
|
2017-03-23 21:19:44 +08:00
|
|
|
import { createContainer } from 'meteor/react-meteor-data';
|
2017-10-10 04:48:10 +08:00
|
|
|
import Service from '/imports/ui/components/audio/service';
|
2017-10-23 20:41:09 +08:00
|
|
|
import PropTypes from 'prop-types';
|
2017-03-23 21:19:44 +08:00
|
|
|
import AudioTest from './component';
|
|
|
|
|
2017-10-23 20:41:09 +08:00
|
|
|
const propTypes = {
|
|
|
|
children: PropTypes.node,
|
|
|
|
};
|
|
|
|
|
|
|
|
const defaultProps = {
|
|
|
|
children: null,
|
|
|
|
};
|
|
|
|
|
2017-10-10 04:48:10 +08:00
|
|
|
const AudioTestContainer = props => (
|
|
|
|
<AudioTest {...props}>
|
|
|
|
{props.children}
|
|
|
|
</AudioTest>
|
|
|
|
);
|
2017-03-23 21:19:44 +08:00
|
|
|
|
2017-06-03 03:25:02 +08:00
|
|
|
export default createContainer(() => ({
|
2017-10-10 04:48:10 +08:00
|
|
|
outputDeviceId: Service.outputDeviceId(),
|
|
|
|
handlePlayAudioSample: (deviceId) => {
|
|
|
|
const sound = new Audio('resources/sounds/audioSample.mp3');
|
2017-10-23 20:41:09 +08:00
|
|
|
if (deviceId && sound.setSinkId) sound.setSinkId(deviceId);
|
2017-10-10 04:48:10 +08:00
|
|
|
sound.play();
|
2017-06-03 03:25:02 +08:00
|
|
|
},
|
|
|
|
}), AudioTestContainer);
|
2017-10-23 20:41:09 +08:00
|
|
|
|
|
|
|
AudioTestContainer.propTypes = propTypes;
|
|
|
|
AudioTestContainer.defaultProps = defaultProps;
|