简体   繁体   English

Flutter webrtc 在发布模式下无法正常工作

[英]Flutter webrtc not working properly in release mode

I am using WebRTC for video conference within my flutter app.我在我的 flutter 应用程序中使用 WebRTC 进行视频会议。 The app works as expected in debug mode.该应用程序在调试模式下按预期工作。 I am able to establish the connection and the video from both ends is visible without any issues.我能够建立连接,并且可以看到来自两端的视频,没有任何问题。 However, when I build an apk and test it on real devices, video conferencing fails.但是,当我构建一个 apk 并在真实设备上对其进行测试时,视频会议失败了。 Video from both devices is not showing up on the screen.两台设备的视频均未显示在屏幕上。 It is only a white screen with no videos where there should be 2 videos.它只是一个没有视频的白屏,应该有 2 个视频。

Here's the code I am referring to: https://github.com/md-weber/webrtc_tutorial这是我指的代码: https://github.com/md-weber/webrtc_tutorial

Thanks.谢谢。

What I have learnt is WebRTC is not really a production ready solution.我了解到的是 WebRTC 并不是真正的生产就绪解决方案。 One still needs to setup STUN/TURN server as discussed here - https://github.com/flutter-webrtc/flutter-webrtc-server/issues/30仍然需要设置 STUN/TURN 服务器,如此处所述 - https://github.com/flutter-webrtc/flutter-webrtc-server/issues/30

If one is excited to explore in future, they can refer to - https://meetrix.io/blog/webrtc/coturn/installation.html https://medium.com/av-transcode/what-is-webrtc-and-how-to-setup-stun-turn-server-for-webrtc-communication-63314728b9d0如果将来有兴趣探索,他们可以参考 - https://meetrix.io/blog/webrtc/coturn/installation.html Z5E056C500A1C4B6A7110-ismed-B50D807BADE5Z/5E056C500A1C4B6A7110-Smed-B50D807BADE5Z.com -如何设置-stun-turn-server-for-webrtc-communication-63314728b9d0

I do not have the time or energy to spend on this now, but will surely be back when we have a bigger team.我现在没有时间和精力花在这上面,但是当我们有一个更大的团队时肯定会回来的。 For now I am going to use on of the readymade solutions in the market.现在我将使用市场上现成的解决方案。

When you compile the release apk, you need to add the following operations,编译release apk时,需要添加如下操作,

1-Edit /android/app/build.gradle 1-编辑/android/app/build.gradle

buildTypes {
    release {
        // TODO: Add your own signing config for the release build.
        // Signing with the debug keys for now, so `flutter run --release` works.
        signingConfig signingConfigs.debug
        minifyEnabled true
        useProguard true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

2-And create new file /android/app/proguard-rules.pro 2-并创建新文件/android/app/proguard-rules.pro

 ## Flutter wrapper
-keep class io.flutter.app.** { *; }
-keep class io.flutter.plugin.**  { *; }
-keep class io.flutter.util.**  { *; }
-keep class io.flutter.view.**  { *; }
-keep class io.flutter.**  { *; }
-keep class io.flutter.plugins.**  { *; }
-dontwarn io.flutter.embedding.**

## Flutter WebRTC
-keep class com.cloudwebrtc.webrtc.** { *; }
-keep class org.webrtc.** { *; } 

refer to [https://flutter-webrtc.org/docs/flutter-webrtc/get-stared#important-reminder][1]参考 [https://flutter-webrtc.org/docs/flutter-webrtc/get-stared#important-reminder][1]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM