0

我在文档https://aws.github.io/amazon-chime-sdk-js/index.html的帮助下使用 chime js SDK 创建了一个视频应用程序

            const indexMap = {};

            const acquireVideoElement = tileId => {
              for (let i = 0; i < 16; i += 1) {
                if (indexMap[i] === tileId) {
                  return videoElements[i];
                }
              }
              for (let i = 0; i < 16; i += 1) {
                if (!indexMap.hasOwnProperty(i)) {
                  indexMap[i] = tileId;
                  return videoElements[i];
                }
              }
              throw new Error('no video element is available');
            };

            const releaseVideoElement = tileId => {
              for (let i = 0; i < 16; i += 1) {
                if (indexMap[i] === tileId) {
                  delete indexMap[i];
                  return;
                }
              }
            };
            const observer = {
              videoTileDidUpdate: tileState => {
                if (!tileState.boundAttendeeId || tileState.localTile || tileState.isContent) {
                  return;
                }

                meetingSession.audioVideo.bindVideoElement(tileState.tileId, acquireVideoElement(tileState.tileId));
              },
                videoTileWasRemoved: tileId => {
                    releaseVideoElement(tileId);
                  }
            };

            meetingSession.audioVideo.addObserver(observer);
            const audioMix = document.getElementById('meeting-audio');
            meetingSession.audioVideo.bindAudioElement(audioMix);
            meetingSession.audioVideo.start();
            meetingSession.audioVideo.startLocalVideoTile();

这很好用,我可以看到参加会议的所有与会者。但我还需要在标签中显示我的视频。可能吗?

4

1 回答 1

0

在您的videoTileDidUpdate,为了您的视频图块显示,您在哪里绑定本地图块,我看到如果tileState.localTiletrue正在返回并且bindVideoElement没有被调用,因此您的 localTile 没有显示。您能否删除 localTile 检查,看看它是否可以作为初始步骤。

于 2020-05-19T03:26:41.947 回答