jitsi / jitsi-meet-sdk-samples

Jitsi Meet mobile SDK examples (Android, iOS and React Native)
Apache License 2.0
283 stars 240 forks source link

Custom Toolbar Buttons on android #245

Closed noobiewoobie closed 3 months ago

noobiewoobie commented 3 months ago

I followed the instructions provided in the guide for android implementation at https://jitsi.github.io/handbook/docs/dev-guide/dev-guide-android-sdk#jitsimeetconferenceoptions for adding custom buttons in the tool bar.

customButtons

But I guess the information in the guide is outdated. Because it shows adding custom tool bar buttons using an Arraylist of bundle. But when I try to add buttons same way the sdk gives error because there is no such method in sdk which allows setting config using an arraylist.

sdkerror

So how can I add multiple custom buttons ? Or do I need to call the method separately with bundle for each button I want to add ? I am using latest sdk version 9.2.2

Calinteodor commented 3 months ago

Please try updating to 10.0.0

noobiewoobie commented 3 months ago

I tried the updated sdk. The only fix in the sdk is that a new method has been added for setting an arraylist of buttons.The broadcasted event has not been checked. On clicking the button an event of type CUSTOM_MENU_BUTTON_PRESSED is broadcasted but the sdk has CUSTOM_OVERFLOW_MENU_BUTTON_PRESSED so catching this event is not possible.

Calinteodor commented 3 months ago

You can check how this is implemented here https://github.com/jitsi/jitsi-meet-sdk-samples/tree/master/android. Maybe you missed something.

noobiewoobie commented 3 months ago

No I did not miss anything. After changing to 10.0.0 , I was able to add extra buttons and perform clicks but the event type is not in the sdk. So, I am not receiving the event. Infact here's the log when a button is pressed you can check the event type:

ExternalAPI Sending event: CUSTOM_MENU_BUTTON_PRESSED with data: {"text":"Button two","id":"btn2"}

buttonsLog

and this is in the sdk

events

Calinteodor commented 3 months ago

I think what you are looking for is CUSTOM_OVERFLOW_MENU_BUTTON_PRESSED. https://jitsi.github.io/handbook/docs/dev-guide/dev-guide-android-sdk#custom_overflow_menu_button_pressed

noobiewoobie commented 3 months ago

Well what I want is to simply add some custom buttons and be able to handle their clicks. Firstly the issue was that the sdk didn't had any method for setting multiple buttons using an arraylist and now when it does have then it's sending the event as an action type which is not even present in the sdk. Latest sdk sends the click event as CUSTOM_MENU_BUTTON_PRESSED and the sdk doesn't have that defined in it's action types. So, can you tell me which sdk version has it working fine. Where I can add the buttons and catch the click events. Also fyi , CUSTOM_OVERFLOW_MENU_BUTTON_PRESSED is never getting sent. Everytime CUSTOM_MENU_BUTTON_PRESSED is getting sent for every button press. Can you tell me which event type should I use from the sdk to catch these click event ?

Calinteodor commented 3 months ago

You need to use type CUSTOM_OVERFLOW_MENU_BUTTON_PRESSED and after your custom button is clicked, it will return:

ExternalAPI Sending event: CUSTOM_MENU_BUTTON_PRESSED with data: {"text":"${text}","id":"${id}"}

noobiewoobie commented 3 months ago

I tried it and it is never received in the broadcast receiver. How will it be received when the event being sent is CUSTOM_MENU_BUTTON_PRESSED ? If the even being sent would have been CUSTOM_OVERFLOW_MENU_BUTTON_PRESSED then using it as the type would have worked fine. On the other hand, if the sdk had CUSTOM_MENU_BUTTON_PRESSED as and event type then using it to recieve the event would have also worked. For one single event two different things are being used. If sender is sending CUSTOM_MENU_BUTTON_PRESSED , how will the receiver receive CUSTOM_OVERFLOW_MENU_BUTTON_PRESSED ? It's as simple as that.

Calinteodor commented 3 months ago

You're right. Because of the naming difference the event is only being sent but never received.

noobiewoobie commented 3 months ago

So , I guess this feature cannot be used untill it gets fixed. Possibly in the next update!! ??

Calinteodor commented 3 months ago

Can you try updating to 10.0.1 and test it. Thank you!

noobiewoobie commented 3 months ago

yes it works now