我正在开发一个利用 Amazon Chime 的视频会议应用程序。我已经关注了Amazon Chime SDK JS的 npm 页面,并设法获得了服务器响应并初始化了 meetingSession。但是,问题是当我尝试获取音频输出设备数组时,它在 Safari 上是长度为零的数组,而在 Chrome 和 Firefox 等浏览器中,它工作得很好,并且我得到了一个非零长度的数组。我该如何解决这个问题?
到目前为止,这是我编写的代码:
import {
ConsoleLogger,
DefaultDeviceController,
DefaultMeetingSession,
LogLevel,
MeetingSessionConfiguration
} from 'amazon-chime-sdk-js';
const logger = new ConsoleLogger('MyLogger', LogLevel.INFO);
const deviceController = new DefaultDeviceController(logger);
// You need responses from server-side Chime API. See below for details.
const meetingResponse = /* Server response */;
const attendeeResponse = /* Server response */;
const configuration = new MeetingSessionConfiguration(meetingResponse, attendeeResponse);
const meetingSession = new DefaultMeetingSession(
configuration,
logger,
deviceController
);
const audioInputDevices = await meetingSession.audioVideo.listAudioInputDevices();
const audioOutputDevices = await meetingSession.audioVideo.listAudioOutputDevices();
const videoInputDevices = await meetingSession.audioVideo.listVideoInputDevices();
/* Rest of the code... */
当我在控制台中记录上述数组的长度时,audioOutputDevices
数组的长度在 Safari 中为零,而在其他浏览器中则为非零。