Flutter - webRTC Video Call signalling doesn't work

半城伤御伤魂 提交于 2020-05-17 08:46:41

问题


I am able to implement voice and video call using agora.io library which is available at https://www.agora.io/ && https://github.com/AgoraIO/Flutter-SDK

how ever the process for starting a call is both user has to join a particular channel name defined by the user manually or automatically. which is not the practical way. Is there any way to create a separate signalling system (may be using, nodejs socket, firebase or one-signal notification? )

What's the simultaneous/parallel way to be used along side that? or what's the complete alternative?


回答1:


Agora.io doesn't provide any method other passing a channel name manually or a default string. But what you can do is use Firebase dynamic link to share the channel name via a dynamic link. This link will redirect you to the page where you're taking channel name as input and fill the channel name according to the parameters passed. So your code will look something like:

 class AgoraImpementation extends State<AgoraImplementation> {

  @override
  void initState() {
    super.initState();
    this.initDynamicLinks();
  }

  initDynamicLinks(BuildContext context) async {
    await Future.delayed(Duration(seconds: 3));
    var data = await FirebaseDynamicLinks.instance.getInitialLink();
    var deepLink = data?.link;
    final queryParams = deepLink.queryParameters;
    if (queryParams.length > 0) {
      var channelName = queryParams['channel_name'];
      openFormScreen(channelName);
    }
    FirebaseDynamicLinks.instance.onLink(onSuccess: (dynamicLink)
    async {
      var deepLink = dynamicLink?.link;
      final queryParams = deepLink.queryParameters;
      if (queryParams.length > 0) {
        var userName = queryParams['channel_name'];
        openFormScreen(channelName);
      }
      debugPrint('DynamicLinks onLink $deepLink');
    }, onError: (e) async {
      debugPrint('DynamicLinks onError $e');
    });
  }

  openFormScreen(String userName){
    Navigator.of(context).pushNamed("routeFormScreen", arguments: {"channelName": channelName});
  }
}


来源:https://stackoverflow.com/questions/61504631/flutter-webrtc-video-call-signalling-doesnt-work

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!