【问题标题】:Cant see video of other person in twiliotwilio看不到其他人的视频
【发布时间】:2020-12-24 14:54:06
【问题描述】:

我正在尝试创建一个视频通话应用程序,当我连接到一个房间时,我可以看到我的视频,我可以看到其他人的视频,但其他人看不到我。我添加了 localaudiotracks、localvideotracks 但仍然没有成功。我们这里是sn-p

ConnectOptions connectOptions = new ConnectOptions.Builder(token)
            .roomName(roomName)
            .videoTracks(Collections.singletonList(localVideoTrack))
            .audioTracks(Collections.singletonList(localAudioTrack))
            .enableInsights(true)
            .enableNetworkQuality(true)
            .build();
    room = Video.connect(this, connectOptions, roomListener());

我也尝试使用room.publishTrack(localVideoTrack) 还是没有成功。

注意 - 我可以看到其他人都听到,其他人看不到我但可以听到我 我正在使用 Twilio 6.1.0

我在那里尝试了带有我的房间名称和令牌的示例应用程序的另一件事,它工作正常,请让我知道我缺少什么。 提前致谢

【问题讨论】:

标签: java android twilio


【解决方案1】:

好的,所以在文档中没有正确提及。在进行了大量研究并进行了反复试验后,我找到了解决方案。 创建 localvideotrack 时,我们需要传递我们需要显示相机或屏幕的内容。所以我创建了一个字符串

private String CAMERA = "camera";

然后在创建轨道时调用它-

Camera1Enumerator camera1Enumerator = new Camera1Enumerator();
if (camera1Enumerator.getDeviceNames() != null) {
            for (String cameraId : camera1Enumerator.getDeviceNames()) {
                if (camera1Enumerator.isBackFacing(cameraId)) {
                    backCameraId = cameraId;
                }
                if (!camera1Enumerator.isBackFacing(cameraId)) {
                    frontCameraId = cameraId;
                }
            }
            cameraCapturer = new CameraCapturer(this, frontCameraId);
            localVideoTrack = LocalVideoTrack.create(this, true, cameraCapturer, new VideoFormat(VideoDimensions.HD_720P_VIDEO_DIMENSIONS, 30), CAMERA); // here we pass it

然后按原样传递

ConnectOptions connectOptions = new ConnectOptions.Builder(token)
        .roomName(roomName)
        .videoTracks(Collections.singletonList(localVideoTrack))
        .audioTracks(Collections.singletonList(localAudioTrack))
        .enableInsights(true)
        .enableNetworkQuality(true)
        .build();
room = Video.connect(this, connectOptions, roomListener());

【讨论】:

    猜你喜欢
    • 2021-05-21
    • 2012-04-01
    • 2022-01-14
    • 2022-10-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多