I am running demo code of Skype web sdk for the audio service in my IONIC App.
var conversation = application.conversationsManager.getConversation('tel:+XXXX');
conversation.selfParticipant.audio.state.when('Connected', function () {
console.log('Connected to audio call');
});
conversation.state.changed(function (newValue, reason, oldValue) {
console.log('Conversation state changed from', oldValue, 'to', newValue);
});
conversation.participants.added(function (participant) {
console.log('Participant:', participant.displayName(), 'has been added to the conversation');
});
conversation.audioService.start().then(function() {
console.log('The call has been started successfully');
}, function (error) {
console.log('An error occured starting the call', error);
});
When I run this code, I am getting error, Plugin not found. There's no description about what plugin they want.
Related
Guys am trying to make a voip with the help of firebase messaging as a trigger for voip when app is terminated however, over 100% of what I searched on net relies on the old firebase_messaging.configure to trigger the app to open on receiving notification function which is no longer available in the latest unless I downgrade my flutter version to ancient times which is not an option for me at this point. And the call never go through due to this changes. Can anyone please help me out.
Future initNotifications () async {
firebaseMessaging.getInitialMessage().then((RemoteMessage? message) async {
if (message?.notification != null) {
navigatorKey.currentState?.pushNamed("/on_call");
}
if (kDebugMode) {
print("app is terminated");
}
if (message != null) {
getNumber();
navigatorKey.currentState?.pushNamed("/voice_call_page");
if (kDebugMode) {
print("New notifications");
}
}
});
FirebaseMessaging.onMessage.listen(handleMessage);}
void handleMessage(RemoteMessage message) async {
navigatorKey.currentState?.pushNamed("/on_call");
if (message.notification != null) {
setState(() {
avatarLink = message.notification!.title;
callerName = message.notification!.body;
});
}
}
This only works when it is opened in app but not when the app is terminated, please help.
I'm facing a problem with Flutter Web Firebase Phone Auth Verification. In debug it is working well and showing me the reCaptcha. But when I host it through GitHub pages in release mode, it shows an error "captcha-check-failed". Even the capcha isn't showing in release mode.
The signInWithPhoneNumber function:
Future<void> loginWithPhoneRequestOTPWeb(
WidgetRef ref,
GlobalKey<FormState> formKey,
String phoneNumber,
) async {
try {
EasyLoading.show();
await FirebaseAuth.instance
.signInWithPhoneNumber(
phoneNumber,
RecaptchaVerifier(
container: 'recaptcha',
size: RecaptchaVerifierSize.compact,
theme: RecaptchaVerifierTheme.dark,
onError: (e) {
print(e);
EasyLoading.showError(e.message!);
return;
},
onExpired: () {
print('Expired');
EasyLoading.showError('Session Expired');
return;
},
onSuccess: () {
EasyLoading.dismiss();
print('Captcha Success');
},
),
)
.then((ConfirmationResult result) {
// update the verificationphone provider
ref.read(sendOtpProvider(formKey).state).update((_) => true);
ref.read(confirmationResultProvider(formKey).state).update((_) => result);
EasyLoading.showSuccess(t!.otpSentSuccessfully);
});
} on FirebaseAuthException catch (e) {
if (e.code == 'invalid-phone-number') {
print('The provided phone number is not valid.');
EasyLoading.showError('The provided phone number is not valid.');
} else if (e.code == 'too-many-requests') {
print(
'You have exceeded the number of attempts allowed for this operation.');
EasyLoading.showError(
'You have exceeded the number of attempts allowed for this operation.');
} else {
print(e.code.toString());
EasyLoading.showError(e.code.toString());
}
} catch (e) {
print(e.toString());
EasyLoading.showError(e.toString());
}
}
I've tried without the RecaptchaVerifier as it is optional parameter.
Error Screenshot:
If I've missed anything please let me know. Thank You :)
Okay, I've figure out my problem. In the firebase authentication section, there is an "Authorized domains" section. Here I've to add my domains. But firebase only takes .com domains. As a result, I used firebase hosting and it is working fine
I am developing a voice call application using Flutter Agora SDK. So far, I have been able to comfortably perform voice calls without any errors. But today, while testing it on my real device, it gives an error even though I haven't made any changes to the initializing process. Even strangely, it works without any error on the emulator, but only on the real device gives error.
Future<void> initAgora() async {
await [Permission.microphone].request();
try {
engine = await RtcEngine.createWithContext(RtcEngineContext(APP_ID));
await engine.enableAudio();
await engine.setChannelProfile(ChannelProfile.Communication);
engine.setEventHandler(
RtcEngineEventHandler(
activeSpeaker: (i) {
log("Active Speaker: $i");
},
microphoneEnabled: (enable) {
log("Microphone: " + enable.toString());
callingController.microphoneState.value = enable;
},
warning: (warningCode) {
print(warningCode.toString());
},
rtcStats: (stats) {
log("User Count: ${stats.userCount}");
},
connectionStateChanged: (state, reason) {
log("Connection Changed : ${state.toString()}, ${reason.toString()}");
},
joinChannelSuccess: (String channel, int uid, int elapsed) {
log('joinChannelSuccess $channel $uid');
},
userJoined: (int uid, int elapsed) {
log('userJoined $uid');
},
userOffline: (int uid, UserOfflineReason reason) {
log('userOffline $uid');
callingController.finishCall(uid, "user_left");
},
error: (error) {
log("ERROR: $error", name: "AGORA");
},
),
);
if (callingController.isCallerMe) {
await joinChannel();
}
} catch (e) {
print(e);
failureSnackbar(e.toString());
}
}
The error that you shared occurs when you try calling a method before the SDK has been initialised properly. Can you please check your RtcEngine config. Also, if you have enabled tokens in your project please make sure that you pass it to the config.
I am working on a flutter project which uses Laravel echo with socket.io for chats in the backend. it was quite easy to implement in the web version with the Laravel echo package, but I am clueless on what to use for Flutter to connect and listen for events. Please I need Help!
You can follow this blog.
Here are two simple methods:
sendSingleChatMessage(ChatMessageModel chatMessageModel, User toChatUser) {
print('Sending Message to: ${toChatUser.name}, ID: ${toChatUser.id}');
if (null == _socket) {
print("Socket is Null, Cannot send message");
return;
}
_socket.emit("single_chat_message", [chatMessageModel.toJson()]);
}
setOnChatMessageReceivedListener(Function onChatMessageReceived) {
_socket.on(ON_MESSAGE_RECEIVED, (data) {
print("Received $data");
onChatMessageReceived(data);
});
}
Edit:
There is another package to use in here.
// Create echo instance
Echo echo = new Echo({
'broadcaster': 'socket.io',
'client': IO.io,
});
// Listening public channel
echo.channel('public-channel').listen('PublicEvent', (e) {
print(e);
});
// Listening private channel
// Needs auth. See details how to authorize channel below in guides
echo.private('private-channel').listen('PrivateEvent', (e) {
print(e);
});
// Listening presence channel
// Needs auth. See details how to authorize channel below in guides
echo.join('presence-channel')
.here((users) {
print(users);
}).joining((user) {
print(user);
}).leaving((user) {
print(user);
}).listen('PresenceEvent', (e) {
print(e);
});
// Accessing socket instance
echo.socket.on('connect', (_) => print('connected'));
echo.socket.on('disconnect', (_) => print('disconnected'));
I am new and trying to resolve this issue but i am unable to understand where i am doing it wrong and i have tried the solution but i am not getting any solution
self.addEventListener('install', function(event) {
console.log("instALL");
event.waitUntil(
caches.open('first-app')
.then(function(cache) {
cache.addAll([
'./',
'./index.html',
'./src/css/app.css',
'./src/js/app.js'
])
})
);
return self.clients.claim();
});
console.log("DONE");
self.addEventListener('fetch', function(event) {
event.respondWith(
caches.match(event.request)
.then(function(res) {
return res;
})
);
});
I am unable to use it offline. because of error