AWS Chime SDK js не распознает видео и аудио элементы

Я пытаюсь получить базовое руководство по 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();

0 ответов

Другие вопросы по тегам