AWS Chime SDK js无法识别视频和音频元素

问题描述

我试图让basic tutorial for the AWS Chime SDK在我们的应用程序中工作,而meetingSession.audioVideo.listVideoInputDevices()始终不返回任何内容/空值。

我正在最新的Chrome上运行此操作系统,我的操作系统是Windows 10工作区实例。我已插入耳机;但这没什么不同。

我的预期结果是为视频返回至少一台设备。这是记录器的输出

2020-08-26T15:29:19.127Z [INFO] MyLogger - attempting to trigger media device labels since they are hidden
chime-bundle.js:1 2020-08-26T15:29:19.133Z [INFO] MyLogger - unable to get media device labels
chime-bundle.js:1 2020-08-26T15:29:19.134Z [INFO] MyLogger - API/DefaultDeviceController/listVideoInputDevices null -> []
chime-bundle.js:1 Uncaught (in promise) TypeError: Cannot read property 'deviceid' of undefined

*注意。视频和音频元素未隐藏。

我尝试了各种演示的代码片段。这些都只是AWS演练的一个副本。几乎所有零信息。我研究了音频设备在html5中的工作方式,并查看了sdk-js中提供的文件,我感到更加困惑。有人可以指出我正确的方向吗?

这是基本代码,您可以获取它,以及上面的链接中的描述。

var fetchResult = await window.fetch(
            window.encodeURI("<our endpoint for backend (running c# instead of node)>",{
                method: 'POST'
            }
        );
        let result = await fetchResult.json();

        
        console.log("Result from Chime API:",result);

        const logger = new ConsoleLogger('MyLogger',LogLevel.INFO);
        const deviceController = new DefaultDeviceController(logger);

        const meetingResponse = result.JoinInfo.Meeting;
        const attendeeResponse = result.JoinInfo.Attendee;
        const configuration = new MeetingSessionConfiguration(meetingResponse,attendeeResponse);

        // In the usage examples below,you will use this meetingSession object.
        const meetingSession = new DefaultMeetingSession(
            configuration,logger,deviceController
        );
        console.log("MEETING SESSION",meetingSession);

        //SETUP AUdio
        const audioElement = document.getElementById('notary-audio');
        meetingSession.audioVideo.bindAudioElement(audioElement);

        
        const videoElement = document.getElementById('notary-video');

        // Make sure you have chosen your camera. In this use case,you will choose the first device.
        const videoInputDevices = await meetingSession.audioVideo.listVideoInputDevices();

        // The camera LED light will turn on indicating that it is Now capturing.
        // See the "Device" section for details.
        await meetingSession.audioVideo.chooseVideoInputDevice(videoInputDevices[0].deviceid);

        const observer = {
            audioVideoDidStart: () => {
                console.log('Started');
            },audioVideoDidStop: sessionStatus => {
                // See the "Stopping a session" section for details.
                console.log('Stopped with a session status code: ',sessionStatus.statusCode());
            },audioVideoDidStartConnecting: reconnecting => {
                if (reconnecting) {
                    // e.g. the WiFi connection is dropped.
                    console.log('Attempting to reconnect');
                }
            },// videoTileDidUpdate is called whenever a new tile is created or tileState changes.
            videoTileDidUpdate: tileState => {
                // Ignore a tile without attendee ID and other attendee's tile.
                if (!tileState.boundAttendeeId || !tileState.localTile) {
                    return;
                }

                // videoTileDidUpdate is also invoked when you call startLocalVideoTile or tileState changes.
                console.log(`If you called stopLocalVideoTile,${tileState.active} is false.`);
                meetingSession.audioVideo.bindVideoElement(tileState.tileId,videoElement);
                localTileId = tileState.tileId;
            },videoTileWasRemoved: tileId => {
                if (localTileId === tileId) {
                    console.log(`You called removeLocalVideoTile. videoElement can be bound to another tile.`);
                    localTileId = null;
                }
            }
        };

        meetingSession.audioVideo.addobserver(observer);
        meetingSession.audioVideo.start();

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)