2017-10-10 04:48:10 +08:00
|
|
|
import React from 'react';
|
2018-01-08 12:44:42 +08:00
|
|
|
import { withTracker } from 'meteor/react-meteor-data';
|
2017-10-10 04:48:10 +08:00
|
|
|
import Service from '/imports/ui/components/audio/service';
|
2017-03-23 21:19:44 +08:00
|
|
|
import AudioTest from './component';
|
|
|
|
|
2021-08-09 22:24:02 +08:00
|
|
|
const AudioTestContainer = (props) => <AudioTest {...props} />;
|
2017-03-23 21:19:44 +08:00
|
|
|
|
2018-01-08 12:44:42 +08:00
|
|
|
export default withTracker(() => ({
|
2017-10-10 04:48:10 +08:00
|
|
|
outputDeviceId: Service.outputDeviceId(),
|
|
|
|
handlePlayAudioSample: (deviceId) => {
|
2020-12-01 00:09:35 +08:00
|
|
|
const sound = new Audio(`${Meteor.settings.public.app.cdn + Meteor.settings.public.app.basename + Meteor.settings.public.app.instanceId}/resources/sounds/audioSample.mp3`);
|
2021-02-23 22:12:37 +08:00
|
|
|
sound.addEventListener('ended', () => { sound.src = null; });
|
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
|
|
|
},
|
2018-01-08 12:44:42 +08:00
|
|
|
}))(AudioTestContainer);
|