How to change mesibocall background and incall sound

81 Views Asked by At

I want to change mesibo call background and PlayInCallSound, this is the code I use to change background on incoming call using IncomingListener enter image description here

How to custom background and incallsound using InProgressListener?, I already read the documentation but still have no idea, can someone provide sample code to do that?

Update: I use mesibo answer below to set defaut ui properties after initialization and its work enter image description here

Now i need to change in call sound using InProgressListener, but still didn't work, here's the code enter image description here

3

There are 3 best solutions below

1
mesibo On BEST ANSWER

The InProgressListener is invoked after the UI has already been initialized, which is too late to set UI properties like background color.

To set the UI background color and other UI properties, call the code below during app initialization:

MesiboCall.UiProperties ui = MesiboCall.getInstance().createCallProperties(true).ui;
ui.backgroundColor = 0xFF635478; // some random color
MesiboCall.getInstance().setDefaultUiProperties(ui);

Note that, mesibo uses hexadecimal ARGB color codes.

You can see an example of this in the mesibo sample app:

https://github.com/mesibo/samples/blob/master/android/kotlin/FirstAppKotlin/app/src/main/java/com/mesibo/firstapp/MainActivity.kt#L107

4
mesibo On

The CallUtils used in your code is not part of the documented mesibo API, so I don't have details on what it does. If you are using, built-in but undocumented CallUtils, your code should work but we won't recommend it. What issue are you facing with the current code?

mesibo provides a playInCallSound function to play in-call sounds, which is part of the MesiboCall.Call class. However, it has a different signature than CallUtils which you have used and requires a MesiboCall.Call instance. Please refer to the code below from GitHub:

@Override
public boolean MesiboCall_OnPlayInCallSound(MesiboCall.CallProperties p, int type, boolean play) {
        if(!play) {
            mCall.stopInCallSound();
            return true;
        }

        mCall.playInCallSound(mActivity.getApplicationContext(), (MESIBOCALL_SOUND_RINGING == type)?R.raw.mesibo_ring :R.raw.mesibo_busy, true);
        return true;
}

https://github.com/mesibo/ui-modules-android/blob/master/MesiboCall/app/src/main/java/com/mesibo/calls/app/CallFragment.java#L394

Based on your previous question about the background color, it seems you may be customizing the UI and may not have created a MesiboCall.Call instance. Can you confirm if this is the case?

If you don't use a MesiboCall.Call instance, the easiest solution would be to configure call properties. Although CallProperties does not currently define in-call sound configuration, we could easily add that. Let me know if you prefer that and I can file an internal ticket.

1
Eko Yulianto On

after update to mesibo v2.4 here's the code I use to change inCallSound

private fun makeCall(user: MesiboProfile, isVideo: Boolean) {
    val cp = MesiboCall.getInstance().createCallProperties(isVideo).apply {
        this.user = user
        inCallRingSound = R.raw.bp_calling_sound
    }
    CallManager.getInstance().callUi(cp)
}