2017-10-10 04:48:10 +08:00
|
|
|
import React from 'react';
|
2024-06-12 21:25:46 +08:00
|
|
|
import { useReactiveVar } from '@apollo/client';
|
2018-01-08 12:44:42 +08:00
|
|
|
import { withTracker } from 'meteor/react-meteor-data';
|
2024-06-12 21:25:46 +08:00
|
|
|
import AudioManager from '/imports/ui/services/audio-manager';
|
2017-03-23 21:19:44 +08:00
|
|
|
import AudioTest from './component';
|
|
|
|
|
2024-06-12 21:25:46 +08:00
|
|
|
const AudioTestContainer = (props) => {
|
|
|
|
const outputDeviceId = useReactiveVar(AudioManager._outputDeviceId.value);
|
|
|
|
return (
|
|
|
|
<AudioTest
|
|
|
|
outputDeviceId={outputDeviceId}
|
|
|
|
{...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
|
|
|
handlePlayAudioSample: (deviceId) => {
|
2024-03-07 01:28:18 +08:00
|
|
|
const sound = new Audio(`${window.meetingClientSettings.public.app.cdn + window.meetingClientSettings.public.app.basename + window.meetingClientSettings.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);
|