wisesdk 0.0.4 wisesdk: ^0.0.4 copied to clipboard
Wise meetings SDK
import 'package:flutter/material.dart';
import 'dart:async';
import 'package:flutter/services.dart';
import 'package:wisesdk/wisesdk.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
final _wiseSdk = Wisesdk();
// channel name must by `wisesdk`
final wiseChannelName = 'wisesdk';
@override
void initState() {
super.initState();
initPlatformState();
final methodChannel = MethodChannel(wiseChannelName);
methodChannel.setMethodCallHandler(_wiseSDKMeetingListener);
}
Future<void> initPlatformState() async {
// Platform messages may fail, so we use a try/catch PlatformException.
// We also handle the message potentially returning null.
try {
await _wiseSdk.initSdk("650d61477aaa3e6b9988934f", "yellowmonkey");
// enable / disable screen capture
_wiseSdk.disableScreenCapture(false);
// join meeting by classroom public ID
// This doesn't need Authentication or SSO Login
final joinParams = {
"classroomPublicId": "65953bb0aa3f4e26b047982b51053399",
"userName": "Ravi Flutter",
"userId": "userId_101001"
};
//_wiseSdk.joinMeeting(joinParams);
// SSO Login
// await _wiseSdk.loginUsingSSOToken("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwaG9uZU51bWJlciI6Iis5MTgyOTc2NTg4OTMiLCJpYXQiOjE3MDQyODc1OTAsImV4cCI6MTcwNDI4NzcxMH0.kiKK66SD0XNjsjRLUBOfJ4nqEvrvekERu383umCv3Jo");
// Logout SSO
// _wiseSdk.logoutSSO();
// Set Auth token
// _wiseSdk.setAuthToken("YOUR_AUTH_TOKEN");
// join meeting by classroom number
// SSO Login or Auth token is needed to do this
final joinParams1 = {
"classroomId": "65953bb0aa3f4e26b047982b",
"disableScreenCapture": true
};
_wiseSdk.joinMeeting(joinParams1);
} on PlatformException catch (err) {
debugPrint('Error. ${err.message}, ${err.details}');
}
if (!mounted) return;
setState(() {
});
}
Future<void> _wiseSDKMeetingListener(MethodCall call) async {
switch (call.method) {
case "onInitialised":
{
debugPrint("onInitialised");
}
case "onMeetingConnecting":
{
debugPrint("onMeetingConnecting");
}
case "onMeetingEnded":
{
final userId = call.arguments;
debugPrint("onMeetingEnded userId: $userId");
}
case "onMeetingEndedByHost":
{
debugPrint("onMeetingEndedByHost");
}
case "onMeetingEndedWithError":
{
final data = call.arguments;
int errorCode = data["errorCode"];
int internalErrorCode = data["internalErrorCode"];
String message = data["message"];
debugPrint(
"onMeetingEndedWithError $errorCode, $internalErrorCode, $message");
}
case "onMeetingNeedPasswordOrDisplayName":
{
debugPrint("onMeetingNeedPasswordOrDisplayName");
}
case "onMeetingNotStartedByHostError":
{
debugPrint("onMeetingNotStartedByHostError");
}
case "onMeetingStarted":
{
final isMeetingStarted = call.arguments;
debugPrint(
"onMeetingStarted isMeetingStarted: $isMeetingStarted");
}
case "onSDKError":
{
final data = call.arguments;
int wiseErrorCode = data["wiseErrorCode"];
int errorCode = data["errorCode"];
int internalErrorCode = data["internalErrorCode"];
debugPrint(
"onSDKError $wiseErrorCode, $errorCode, $internalErrorCode");
}
case "onVendorIdError":
{
debugPrint("onVendorIdError");
}
}
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Wise SDK'),
),
body: const Center(
child: Text('Wise SDK Sample'),
),
),
);
}
}