【问题标题】:Flutter WebRTC camera doesn't show upFlutter WebRTC 摄像头不显示
【发布时间】:2021-10-31 16:54:17
【问题描述】:

我正在开发 WebRTC,以便在 Flutter 中进行视频通话。一切都像魅力一样工作,但是当我运行应用程序时,它不会同时显示本地摄像头和远程摄像头(已授予摄像头权限),但如果我热重载应用程序,摄像头会显示。

这是我的代码。

这是我的用户界面。

Expanded(
    child: Padding(
      padding: const EdgeInsets.all(8.0),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.center,
        children: [
          Expanded(child: RTCVideoView(_localRenderer, mirror: true)),
          Expanded(child: RTCVideoView(_remoteRenderer)),
        ],
      ),
    ),
),`

【问题讨论】:

    标签: flutter webrtc simplewebrtc webrtc-android openwebrtc


    【解决方案1】:

    尝试在调用getUserMedia() 函数后添加setState。我会告诉你我的例子。

    ElevatedButton(
                onPressed: () async {
                  await signaling.openUserMedia(_localRenderer, _remoteRenderer);
                  setState(() {});
                  print("Open Camera");
                },
                child: const Text("Open camera & microphone"),
              ),
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-12-31
      • 2020-11-14
      • 2018-07-11
      • 2018-02-14
      • 2020-10-04
      • 2018-06-19
      • 2017-07-31
      • 1970-01-01
      相关资源
      最近更新 更多