Open Elkassas-dev opened 1 month ago
i upgraded the package recently, but i am always getting this error when i try to join a meeting and the meeting not launched I/System.out( 6734): Failed to initialize Zoom SDK
`import 'dart:async'; import 'dart:io';
import 'package:flutter/material.dart'; import 'package:gr_zoom/gr_zoom_platform_interface.dart';
class MeetingWidget extends StatefulWidget { ZoomOptions? zoomOptions; ZoomMeetingOptions? meetingOptions; Timer? timer; final String? meetingId; final String? meetingPassword; final String? userId; final String? meetingTitle; final String jwtToken; MeetingWidget( {Key? key, this.meetingId, this.meetingPassword, this.userId, this.meetingTitle, this.zoomOptions, this.meetingOptions, required this.jwtToken, this.timer}) : super(key: key) { this.zoomOptions = new ZoomOptions( domain: "zoom.us", jwtToken: jwtToken, / appKey: "YFjwuVW9JYxCulhS9sd5PZZS3Tong5YrcsUp", appSecret: "00dDf0nTC7pFdAwpDfUkdy7ycaDQa8VpnxJw", / );
this.meetingOptions = new ZoomMeetingOptions( userId: '$userId', meetingId: '$meetingId', meetingPassword: '$meetingPassword', disableDialIn: "true", disableDrive: "true", disableInvite: "true", disableShare: "true", noAudio: "false", // disableTitlebar: "false", // viewOptions: "false", noDisconnectAudio: "false");
}
@override State createState() => _MeetingWidgetState(); }
class _MeetingWidgetState extends State { joinMeeting(BuildContext context) { bool _isMeetingEnded(String status) { var result = false;
if (Platform.isAndroid) result = status == "MEETING_STATUS_DISCONNECTING" || status == "MEETING_STATUS_FAILED"; else result = status == "MEETING_STATUS_IDLE"; return result; } try { if (widget.meetingId!.isNotEmpty && widget.meetingPassword!.isNotEmpty) { ZoomOptions zoomOptions = ZoomOptions( domain: "zoom.us", jwtToken: widget.jwtToken, /* appKey: "YFjwuVW9JYxCulhS9sd5PZZS3Tong5YrcsUp", //API KEY FROM ZOOM appSecret: "00dDf0nTC7pFdAwpDfUkdy7ycaDQa8VpnxJw", */ //API SECRET FROM ZOOM ); var meetingOptions = ZoomMeetingOptions( zoomAccessToken: "", zoomToken: "", userId: 'username', //pass username for join meeting only --- Any name eg:- EVILRATT. meetingId: widget.meetingId!, //pass meeting id for join meeting only meetingPassword: widget.meetingPassword!, //pass meeting password for join meeting only disableDialIn: "true", disableDrive: "true", disableInvite: "true", disableShare: "true", // disableTitlebar: "false", // viewOptions: "true", noAudio: "false", noDisconnectAudio: "false"); var zoom = ZoomPlatform.instance; zoom.initZoom(zoomOptions).then((results) { if (results[0] == 0) { zoom.onMeetingStatus().listen((status) { print( "[Meeting Status Stream] : " + status[0] + " - " + status[1]); if (_isMeetingEnded(status[0])) { print("[Meeting Status] :- Ended"); widget.timer!.cancel(); } }); print("listen on event channel"); zoom.joinMeeting(meetingOptions).then((joinMeetingResult) { widget.timer = Timer.periodic(new Duration(seconds: 2), (timer) { zoom.meetingStatus(meetingOptions.meetingId).then((status) { print("[Meeting Status Polling] : " + status[0] + " - " + status[1]); }); }); }); } }).catchError((error) { print("[Error Generated] : " + error); }); } else { if (widget.meetingId!.isEmpty) { ScaffoldMessenger.of(context).showSnackBar(SnackBar( content: Text("Enter a valid meeting id to continue."), )); } else if (widget.meetingPassword!.isEmpty) { ScaffoldMessenger.of(context).showSnackBar(SnackBar( content: Text("Enter a meeting password to start."), )); } } } catch (e, s) { print("this is catch error $e"); print("this is catch error2 $s"); }
@override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text('${widget.meetingTitle}'), ), body: Padding( padding: const EdgeInsets.all(16.0), child: Builder( builder: (context) { // The basic Material Design action button. return ElevatedButton( style: ElevatedButton.styleFrom( foregroundColor: Colors.white, backgroundColor: Color(0xFF001068), // foreground ), onPressed: () => {joinMeeting(context)}, child: Text('Join'), ); }, ), ), ); } } `
Probably your JWT token is not generated properly. Please check and generate one valid token from
jwt.io.
You should also refer to the
Zoom documentation
on how to generate JWT tokens for a Meeting.
i upgraded the package recently, but i am always getting this error when i try to join a meeting and the meeting not launched I/System.out( 6734): Failed to initialize Zoom SDK
`import 'dart:async'; import 'dart:io';
import 'package:flutter/material.dart'; import 'package:gr_zoom/gr_zoom_platform_interface.dart';
class MeetingWidget extends StatefulWidget { ZoomOptions? zoomOptions; ZoomMeetingOptions? meetingOptions; Timer? timer; final String? meetingId; final String? meetingPassword; final String? userId; final String? meetingTitle; final String jwtToken; MeetingWidget( {Key? key, this.meetingId, this.meetingPassword, this.userId, this.meetingTitle, this.zoomOptions, this.meetingOptions, required this.jwtToken, this.timer}) : super(key: key) { this.zoomOptions = new ZoomOptions( domain: "zoom.us", jwtToken: jwtToken, / appKey: "YFjwuVW9JYxCulhS9sd5PZZS3Tong5YrcsUp", appSecret: "00dDf0nTC7pFdAwpDfUkdy7ycaDQa8VpnxJw", / );
}
@override State createState() => _MeetingWidgetState();
}
class _MeetingWidgetState extends State {
joinMeeting(BuildContext context) {
bool _isMeetingEnded(String status) {
var result = false;
}
@override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text('${widget.meetingTitle}'), ), body: Padding( padding: const EdgeInsets.all(16.0), child: Builder( builder: (context) { // The basic Material Design action button. return ElevatedButton( style: ElevatedButton.styleFrom( foregroundColor: Colors.white, backgroundColor: Color(0xFF001068), // foreground ), onPressed: () => {joinMeeting(context)}, child: Text('Join'), ); }, ), ), ); } } `