agora - flutter : PlatformException(-1, , null, null) error

Viewed 13

i'm new to voice calls and video calls with agora and i'm getting this error which i couldn't solve . there is no article or documentation for this error this is my call code :

class _CallPageState extends State<CallPage> {
 final _users = <int>[];
 final _infoStrings = <String>[];
 bool muted = false;
 late RtcEngine _engine;

 @override
 void dispose() {
  // clear users
 _users.clear();
 _dispose();
 super.dispose();
 }

 Future<void> _dispose() async {
 // destroy sdk
  await _engine.leaveChannel();
  await _engine.destroy();
 }

 @override
  void initState() {
  super.initState();
// initialize agora sdk
  initialize();
  }

Future<void> _initAgoraRtcEngine() async {
  _engine = await RtcEngine.create(appId);
  await _engine.enableVideo();
  await _engine.setChannelProfile(ChannelProfile.LiveBroadcasting);
  await _engine.setClientRole(widget.role!);
}

Future<void> initialize() async {
  if (appId.isEmpty) {
  setState(() {
    _infoStrings.add(
      'APP_ID missing, please provide your APP_ID in settings.dart',
    );
    _infoStrings.add('Agora Engine is not starting');
  });
  return;
 }

 await _initAgoraRtcEngine();
_addAgoraEventHandlers();
SharedPreferences prefs = await SharedPreferences.getInstance();
var username = prefs.getString("username");
VideoEncoderConfiguration configuration = VideoEncoderConfiguration();
configuration.dimensions = VideoDimensions(width: 1920, height: 1080);
await _engine.setVideoEncoderConfiguration(configuration);
await _engine.joinChannel(token, widget.channelName!, null, 0);
await _engine.joinChannel(token, username!, null, 0);

} please if anyone found a solution for this issue plz share it with us . . .

0 Answers
Related