2024-06-13 22:31:07 +08:00
|
|
|
import React, { useCallback } from 'react';
|
2024-06-12 21:25:46 +08:00
|
|
|
import { useReactiveVar } from '@apollo/client';
|
|
|
|
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);
|
2024-06-13 22:31:07 +08:00
|
|
|
const handlePlayAudioSample = useCallback((deviceId) => {
|
2024-08-03 02:10:39 +08:00
|
|
|
const sound = new Audio(`${window.meetingClientSettings.public.app.cdn + window.meetingClientSettings.public.app.basename}/resources/sounds/audioSample.mp3`);
|
2024-06-13 22:31:07 +08:00
|
|
|
sound.addEventListener('ended', () => { sound.src = null; });
|
|
|
|
if (deviceId && sound.setSinkId) sound.setSinkId(deviceId);
|
|
|
|
sound.play();
|
|
|
|
}, []);
|
2024-06-12 21:25:46 +08:00
|
|
|
return (
|
|
|
|
<AudioTest
|
|
|
|
outputDeviceId={outputDeviceId}
|
2024-06-13 22:31:07 +08:00
|
|
|
handlePlayAudioSample={handlePlayAudioSample}
|
2024-06-12 21:25:46 +08:00
|
|
|
{...props}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
};
|
2017-03-23 21:19:44 +08:00
|
|
|
|
2024-06-13 22:31:07 +08:00
|
|
|
export default AudioTestContainer;
|