stop method
Stops what the UI Kit is playing: a message sound, the incoming
call's ringtone (and its vibration), and the outgoing call's ringback.
Since 6.2.0 the ringtone and the ringback play on players of their own,
but they still stop here, as they did before. An onCancelled that
takes an outgoing call's End over can stop the ringback with it.
An incoming call's onAccept and onDecline need not call it: the
UI Kit stops the ringtone at the tap. Calling it there does harm: at
Accept it gives the audio back while the call connects (music resumes
during "Connecting..."), and at Decline it also stops the ringback of
a call the user is placing.
The UI Kit's own call screens do not call this: each stops only the sound it started, so one closing cannot silence the next call's.
Implementation
void stop() async {
if (kIsWeb) return;
unawaited(CallTone.stopAll());
unawaited(IncomingRingtone.stopAll());
await UIConstants.channel.invokeMethod("stopPlayer", {});
}