VideoUIKit-Flutter
VideoUIKit-Flutter copied to clipboard
AgoraUser
https://github.com/AgoraIO-Community/VideoUIKit-Flutter/issues/137#issue-1718845438 having the same issue when I pinned the remote user.
Can you try this with the new 1.3.4
version?
Can you try this with the new
1.3.4
version?
This is with 1.3.4 version.
@kyawthet-wam Can you share the code, stack trace, and what steps you took to reproduce this issue?
@RoutePage() class VideoCallPage extends ConsumerStatefulWidget { const VideoCallPage({ Key? key, required this.token, required this.channelName, required this.gpId, required this.isGroup, required this.isCaller, }) : super(key: key); final String token; final String channelName; final int gpId; final bool isGroup; final bool isCaller; @override VideoCallPageState createState() => VideoCallPageState(); }
class VideoCallPageState extends ConsumerState<VideoCallPage> { late String chName; late String token; late AgoraClient client; int initialCountDown = 30; Timer? _timer; int waitingTime = 0; var stopwatch = Stopwatch();
void initAgora() async { await client.initialize(); }
@override void dispose() { client.engine.leaveChannel(); client.engine.release(); _timer!.cancel(); super.dispose(); }
@override void initState() { super.initState(); chName = widget.channelName; client = AgoraClient( agoraEventHandlers: AgoraRtcEventHandlers( onUserJoined: (connection, remoteUid, elapsed) { SystemSound.play(SystemSoundType.click); HapticFeedback.lightImpact(); stopwatch.start(); }, ), agoraConnectionData: AgoraConnectionData( appId: appId, rtmUid: widget.gpId.toString(), channelName: widget.channelName, username: 'user', tempToken: widget.token, uid: SharedPrefs.getInt('user_id')!, ), );
initAgora();
waitingTime = initialCountDown;
_timer = Timer.periodic(
const Duration(seconds: 1),
(_) {
waitingTime--;
if (waitingTime == 0 && client.users.isEmpty) {
EasyLoading.showToast('Call End');
Navigator.pop(context, {"duration": 0});
}
},
);
}
@override Widget build(BuildContext context) { final chatNotifier = ref.read(chatMessageListProvider( Param(p1: widget.gpId, p2: widget.isGroup ? 1 : 0), ).notifier);
void endCall() {
String text =
'📹 Video call (${FormatDuration.format(stopwatch.elapsed)})';
chatNotifier
.sentGroupMessage(
groupId: widget.gpId,
fileList: [],
text: text,
fileNameList: [],
)
.then((value) {
value.maybeWhen(
error: (l) => l.maybeWhen(
unexpectedError: () => EasyLoading.showToast(
AppLocalizations.of(context)!.something_went_wrong),
serverError: (message) => EasyLoading.showToast(message!),
orElse: () {},
),
orElse: () {
Navigator.pop(context);
},
);
});
}
void cancelCall() {
chatNotifier.cancelCall().then((value) {
value.maybeWhen(
error: (l) => l.maybeWhen(
unexpectedError: () => EasyLoading.showToast(
AppLocalizations.of(context)!.something_went_wrong),
serverError: (message) => EasyLoading.showToast(message!),
orElse: () {},
),
saved: () {
SharedPrefs.setBool('cancel', true);
Navigator.pop(context);
},
orElse: () {},
);
});
}
return WillPopScope(
onWillPop: () {
if (client.users.isEmpty &&
stopwatch.elapsed.inSeconds == 0 &&
widget.isCaller) {
cancelCall();
} else if (client.users.isEmpty) {
endCall();
} else {
Navigator.pop(context);
}
return Future.value(true);
},
child: SafeArea(
child: Scaffold(
backgroundColor: Colors.black,
body: Stack(
children: [
AgoraVideoViewer(
client: client,
showAVState: true,
showNumberOfUsers: true,
layoutType: Layout.floating,
enableHostControls: true,
),
AgoraVideoButtons(
client: client,
disconnectButtonChild: RawMaterialButton(
onPressed: () {
if (client.users.isEmpty &&
stopwatch.elapsed.inSeconds == 0 &&
widget.isCaller) {
cancelCall();
} else if (client.users.isEmpty) {
endCall();
} else {
Navigator.pop(context);
}
},
shape: const CircleBorder(),
elevation: 2.0,
fillColor: Colors.redAccent,
padding: const EdgeInsets.all(15.0),
child: const Icon(
Icons.call_end,
color: Colors.white,
size: 35.0,
),
),
autoHideButtons: true,
),
],
),
),
),
);
} }
Sorry for my bad code. Thanks for your help.
line no 329
@kyawthet-wam This issue should have been fixed with v1.3.4
Can you please try a flutter clean
and then installing the dependencies.
@Meherdeep Yes. But it didn't work.
@kyawthet-wam Can you please try the example code and share the SDK logs