1

i'm using connectycube for receiving calls but when i accept call while is in the background like the image below accept call not working it navigates me the home page but not the call here is the code

void videocaller( var friendName){
  Uuid uuid = Uuid();
  CallEvent callEvent = CallEvent(sessionId: uuid.v4() + "1", callType: 1, callerId: 0, 
  callerName: friendName, opponentsIds:{1234});

  Future<void> _onCallAccepted(CallEvent callEvent) async {
    _joinMeetingVideo(friendName);
   }

   Future<void> _onCallRejected(CallEvent callEvent) async {

   }
   Future onCallRejectedWhenTerminated(CallEvent? callEvent) async {

     }
   Future onCallAcceptedWhenTerminated(CallEvent? callEvent) async {
     _joinMeetingVideo(friendName);
   }

 ConnectycubeFlutterCallKit.onCallRejectedWhenTerminated = onCallRejectedWhenTerminated;
 ConnectycubeFlutterCallKit.onCallAcceptedWhenTerminated = onCallAcceptedWhenTerminated;
  ConnectycubeFlutterCallKit.instance.init(
    onCallAccepted: _onCallAccepted,
    onCallRejected: _onCallRejected,
  );
 ConnectycubeFlutterCallKit.showCallNotification(callEvent);
 ConnectycubeFlutterCallKit.setOnLockScreenVisibility(isVisible: true);

 }

i tried it with getx to navigate to jitsi call but it does not work

actually the problem is that jitsi function [_joinMeetingVideo(friendName);] is not a page where i can navigate to it's a function so it can't be executed enless the app is open this why it opens the home page of the app but not the video call itself but unfortunately i could't find a solution for this issue. any ideas ??

alaa
  • 93
  • 1
  • 6
  • please provide the error or log after this "tried it with getx to navigate to jitsi call"? do you have a valid Context for navigation in your app after starting it by `onCallAcceptedWhenTerminated`? – Valentyn Tereshchenko Jan 09 '23 at 09:10
  • are you sure that the function `onCallAcceptedWhenTerminated` satisfies the requirements of the plugin documentation? ```dart /// This provided handler must be a top-level function and cannot be /// anonymous otherwise an [ArgumentError] will be thrown. ``` looks like no, because it uses fields not related to the method arguments – Valentyn Tereshchenko Jan 11 '23 at 07:53
  • are you sure that you have the right context in the function `_joinMeetingVideo(friendName);` for navigation to the next screen? could you provide any logs with errors or other info that will help to localize your issue? – Valentyn Tereshchenko Jan 23 '23 at 15:57
  • You were right _joinMeetingVideo(friendName) is not a top level function – alaa Apr 06 '23 at 16:23

1 Answers1

1
_joinMeetingVideo() is not a top-level function
alaa
  • 93
  • 1
  • 6