微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

如何解决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 举报,一经查实,本站将立刻删除。

相关推荐


Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其他元素将获得点击?
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。)
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbcDriver发生异常。为什么?
这是用Java进行XML解析的最佳库。
Java的PriorityQueue的内置迭代器不会以任何特定顺序遍历数据结构。为什么?
如何在Java中聆听按键时移动图像。
Java“Program to an interface”。这是什么意思?