PeerDart在使用移动数据时断开连接

huangapple go评论70阅读模式
英文:

PeerDart disconnects when using mobile data

问题

我有一个在Web上部署的Flutter应用,它使用PeerDart(该库从PeerJs中复制了实现)。
我测试了从移动设备到Web浏览器的视频通话,使用不同的WiFi连接,到目前为止一切都正常工作。
问题是,当我从WiFi切换到移动数据时,视频从未被传输。我可以在本地获取视频流并在屏幕上显示它,对等方之间的连接已建立,但没有视频或数据被发送,几秒后对等方断开连接。

只有在使用移动数据时才会出现这种情况,使用WiFi时一切正常。

我认为这可能是与我的Android权限有关的问题,以下是我当前应用程序上的Internet权限:

  <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
  <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
  <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
  <uses-permission android:name="android.permission.INTERNET" />

是否有人知道如何解决这个问题,以便视频通话在WiFi和数据网络上都能正常工作?

在测试移动浏览器版本和设备上安装的应用程序时,这个问题仍然存在。

编辑:以下是应用程序的浏览器端的日志:

PeerDart:  Added ICE candidate for:4c84a3da-85f1-4bb9-8b49-36578768a1a2
2main.dart.js:21693 PeerDart:  Received ICE candidates for 4c84a3da-85f1-4bb9-8b49-36578768a1a2: Instance of 'minified:oa'
main.dart.js:21693 PeerDart:  iceConnectionState changed to disconnected on the connection with 4c84a3da-85f1-4bb9-8b49-36578768a1a2
main.dart.js:21693 PeerDart:  Cleaning up PeerConnection to 4c84a3da-85f1-4bb9-8b49-36578768a1a2
main.dart.js:21693 PeerDart:  iceConnectionState changed to disconnected on the connection with 4c84a3da-85f1-4bb9-8b49-36578768a1a2
main.dart.js:21693 PeerDart:  Cleaning up PeerConnection to 4c84a3da-85f1-4bb9-8b49-36578768a1a2

我正在使用对等方的默认配置。

编辑#2:在第一次失败的连接后,再次从移动设备进行呼叫时,视频流正常工作,为什么第一次尝试不是这种情况?

英文:

I have a flutter app deployed on web that uses PeerDart (which copies the implementation from PeerJs).
I tested video calls from a mobile device to a web browser using different wifi connections and everything works so far.
The problem is that when I switch from wifi to data on my mobile device the video is never streamed, I can get the stream locally and show it on the screen and the connection between peers is established but no video or data is sent and the peer gets disconnected after a few seconds.

This only happens when using mobile data, with wifi it works perfectly fine.

I thought it may be a problem with my Android permissions, this are the internet permissions I currently have on the app:

  <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
  <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
  <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
  <uses-permission android:name="android.permission.INTERNET" />

Does anyone know how to solve this problem so the video calls work on both wifi and data networks?

This problem persists when testing both the mobile browser version and the application installed on the device.

Edit: Here are the logs from the browser side of the app:

PeerDart:  Added ICE candidate for:4c84a3da-85f1-4bb9-8b49-36578768a1a2
2main.dart.js:21693 PeerDart:  Received ICE candidates for 4c84a3da-85f1-4bb9-8b49-36578768a1a2: Instance of 'minified:oa'
main.dart.js:21693 PeerDart:  iceConnectionState changed to disconnected on the connection with 4c84a3da-85f1-4bb9-8b49-36578768a1a2
main.dart.js:21693 PeerDart:  Cleaning up PeerConnection to 4c84a3da-85f1-4bb9-8b49-36578768a1a2
main.dart.js:21693 PeerDart:  iceConnectionState changed to disconnected on the connection with 4c84a3da-85f1-4bb9-8b49-36578768a1a2
main.dart.js:21693 PeerDart:  Cleaning up PeerConnection to 4c84a3da-85f1-4bb9-8b49-36578768a1a2

I am using the default configuration for my peers.

Edit #2: When calling from the mobile device again after the first failed connection the video stream works correctly, why is this not the case on the first try?

答案1

得分: 1

尝试将网站托管在服务器上,然后使用该服务器的IP地址进行连接,因为我认为问题可能是当您使用WIFI时,会使用本地网络IP地址 192.168.*.* 进行连接。

英文:

Try hosting the web site on a server and use that address IP to connect , because the problem I think is that when you use WIFI you connect using the local network IP 192.168.*.* .

huangapple
  • 本文由 发表于 2023年3月3日 22:04:08
  • 转载请务必保留本文链接:https://go.coder-hub.com/75628075.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定