Skip to content

Instantly share code, notes, and snippets.

View Meherdeep's full-sized avatar
💠
Noooooo

Meher Meherdeep

💠
Noooooo
View GitHub Profile
void toggleSendMessage({required String text, required String peerId}) async {
if (text.isEmpty) {
print('Please input text to send.');
return;
}
try {
await value.client?.agoraRtmClient.sendMessageToPeer2(
peerId,
RtmMessage.fromText(text),
).catchError(print);
void updateMessages({required String peerId, required RtmMessage message, required bool isRemote}) {
value = value.copyWith(messages: [
...value.messages,
MessageClass(text: message, remoteUid: peerId, isRemote: isRemote)
]);
}
int remoteUid = value.matchedUsers![0].uid;
value = value.copyWith(likedUsers: [...?value.likedUsers, remoteUid]);
List<AgoraUser>? tempList = value.matchedUsers;
tempList?.removeAt(0);
value = value.copyWith(matchedUsers: tempList);
await muteCurrentStream(
uid: widget.controller.value.matchedUsers![info.cardIndex].uid);
await unmuteStream(uid: widget.controller.value.matchedUsers![index].uid);
AgoraVideoViewer(
client: widget.client,
layoutType: Layout.oneToOne,
remoteUid: widget.controller.value.matchedUsers?[index].uid,
),
AgoraPreCallViewer(
client: client,
joinCallButton: () => // Add the Navigator to the next page here
)
@Meherdeep
Meherdeep / android+basic.kt
Created October 22, 2022 22:28
VideoUIKits-Android
var agView: AgoraVideoViewer? = null
agView = AgoraVideoViewer(
this, AgoraConnectionData("my-app-id", appToken = "my-token"),
)
val set = FrameLayout.LayoutParams(
FrameLayout.LayoutParams.MATCH_PARENT,
FrameLayout.LayoutParams.MATCH_PARENT
)
@Meherdeep
Meherdeep / flutter+basic.dart
Created October 20, 2022 19:34
VideoUIKit basic guide - Flutter
import 'package:agora_uikit/agora_uikit.dart';
final AgoraClient client = AgoraClient(
agoraConnectionData: AgoraConnectionData(
appId: "<--Add your App Id here-->",
tempToken: '<--Add your temp token here-->',
channelName: "test",
username: "user",
),
);
okHttpClient.newCall(request).enqueue(new Callback() {
@Override
public void onFailure(okhttp3.Call call, IOException e) {
}
@Override
public void onResponse(okhttp3.Call call, Response response) throws IOException {
}
okHttpClient = new OkHttpClient.Builder()
.readTimeout(300,TimeUnit.SECONDS)
.writeTimeout(300,TimeUnit.SECONDS)
.proxy(new Proxy(HTTP, new InetSocketAddress("127.0.0.1", FpaProxyService.getInstance().getHttpProxyPort())))
.build();