Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onConferenceTerminated is not invoked #7010

Closed
erandakarachchi opened this issue Jun 10, 2020 · 13 comments
Closed

onConferenceTerminated is not invoked #7010

erandakarachchi opened this issue Jun 10, 2020 · 13 comments
Labels
android Issue related to the Android operating system api Issue related to the external API (iframe) mobile Issue related to any mobile system running Jitsi Meet question Not an issue but a question

Comments

@erandakarachchi
Copy link

erandakarachchi commented Jun 10, 2020

Description:

I have used Jitsi pre build sdk from maven. and implemented my class as follows.

implementation ('org.jitsi.react:jitsi-meet-sdk:2.+') { transitive = true }

public class JitsiCallActivity extends JitsiMeetActivity{

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_jitsi_call);
        roomId = getIntent().getStringExtra("room_id");

        initConference();
        launchMeeting(roomId);
    }

    @Override
    protected void initialize() {
        Log.d("JITSI","INITIALIZED");
        super.initialize();
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        Log.d("DES","ON DESTROY");
    }

    @Override
    public void onConferenceTerminated(Map<String, Object> data) {
         Log.d("JITSI","MEET TERMINATED");
        super.onConferenceTerminated(data);
    }

    private void initConference(){
        URL serverURL;
        boolean isVideoCall = false;
        try {
            serverURL = new URL(KeyValues.JITSI_MEET_HOST);
        } catch (MalformedURLException e) {
            e.printStackTrace();
            throw new RuntimeException("Invalid server URL!");
        }

        JitsiMeetUserInfo userInfo = new JitsiMeetUserInfo();


        JitsiMeetConferenceOptions defaultOptions
                = new JitsiMeetConferenceOptions.Builder()
                .setServerURL(serverURL)
                .setWelcomePageEnabled(false)
                .setFeatureFlag("chat.enabled",false)
                .setFeatureFlag("call-integration.enabled", false)
                .setVideoMuted(false)
                .setUserInfo(userInfo)
                .setSubject("Sample room ")
                .build();
        JitsiMeet.setDefaultConferenceOptions(defaultOptions);

        Log.d("JITSI","CALL INIT");
    }
    private void launchMeeting(String roomName){
        JitsiMeetConferenceOptions options
                = new JitsiMeetConferenceOptions.Builder()
                .setRoom(roomName)
                .build();
        JitsiMeetActivity.launch(this, options);
        this.finish();
    }
}

But the onConferenceTerminated method doesn't seems to be calling.

Expected behavior:

Invoke the onConferenceTerminated method after user left the conference.

Actual behavior:

onConferenceTerminated is not invoked.

Server information:

  • Jitsi Meet version:
  • Operating System:Ubuntu
    -Building Platform : Mac OS Catalina Version 10.15.3 (19D76)

Client information:

  • Browser / app version:Android 10 on google pixel.
  • Operating System:Android

Additional information:

I've tested with the project in jitsi-meet. It seems to work fine.

I couldn't figure out what was missing here.

@Echolon
Copy link

Echolon commented Jun 10, 2020

Hi,
If you have a question about Jitsi Meet that is not a bug report or feature request, please post it in https://community.jitsi.org

To me it seem that you request help on you own changes to the code? If so please go to the community forum.


I'm a community contributor and not directly affiliated with the Jitsi team.

@Echolon Echolon added api Issue related to the external API (iframe) config Configuration related issues packaging Issue related to packaging or build topics question Not an issue but a question android Issue related to the Android operating system mobile Issue related to any mobile system running Jitsi Meet labels Jun 10, 2020
@saghul saghul removed config Configuration related issues packaging Issue related to packaging or build topics labels Jun 11, 2020
@saghul
Copy link
Member

saghul commented Jun 11, 2020

    JitsiMeetActivity.launch(this, options);
    this.finish();

Well, you are launching a new JitsiMeetActivity and finishing the current one. So it's behaving as expected.

You need to use the join method in your activity which extends from JitsiMeetActiovity if you want to customize the behavior instead of launching a new one.

@erandakarachchi
Copy link
Author

erandakarachchi commented Jun 11, 2020

@saghul Hi,

I'm getting what you are saying here. but I'm unable to implement it.

JitsiMeetActivity doesn't seems to have join() method.

JitsiMeetActivity.join(); //No such method.

JitsiMeetView seems to have a .join() method but, couldn't implement it to my JitsiCallActivity

could you please provide a code example?

@saghul
Copy link
Member

saghul commented Jun 11, 2020

Look at the examples here: https://github.com/jitsi/jitsi-meet-sdk-samples I don't think you need to subclass the activity at all.

@erandakarachchi
Copy link
Author

erandakarachchi commented Jun 11, 2020

@saghul

I was trying to implement my Jitisi class as follows.

https://community.jitsi.org/t/i-have-integrated-jitsi-meet-android-sdk-and-not-able-to-get-callbacks-on-hangup-button-click-and-others/21674/20

changed as follows,

public class JitsiCallActivity extends AppCompatActivity

But the example doesn't seems to implementing onConferenceTerminated() method.

any help?

@saghul
Copy link
Member

saghul commented Jun 11, 2020

It's not needed since the activity finishes on its own.

@erandakarachchi
Copy link
Author

@saghul I need to notify the other users in the conference when a one user leaves. So my current plan is to invoke a method in the onConferenceTerminated and notify other users through a push notification.

So it is important to me to override the onConferenceTerminated method to make a request to my backend.

Thanks

@erandakarachchi
Copy link
Author

erandakarachchi commented Jun 11, 2020

@saghul after few hours of researching I found that following code works.

I was able to work on this by implementing JitsiMeetViewListener to my activity.

public class JitsiCallActivity extends FragmentActivity implements JitsiMeetActivityInterface, JitsiMeetViewListener {
    private JitsiMeetView view;

    @Override
    protected void onActivityResult(
            int requestCode,
            int resultCode,
            Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        JitsiMeetActivityDelegate.onActivityResult(
                this, requestCode, resultCode, data);
    }

    @Override
    public void onBackPressed() {
        JitsiMeetActivityDelegate.onBackPressed();
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        view = new JitsiMeetView(this);
        JitsiMeetConferenceOptions options = getOptions();
        view.join(options);

        setContentView(view);
        view.setListener(this);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();

        view.dispose();
        view = null;

        JitsiMeetActivityDelegate.onHostDestroy(this);
    }

    @Override
    public void onNewIntent(Intent intent) {
        super.onNewIntent(intent);
        JitsiMeetActivityDelegate.onNewIntent(intent);
    }

    @Override
    public void onRequestPermissionsResult(
            final int requestCode,
            final String[] permissions,
            final int[] grantResults) {
        JitsiMeetActivityDelegate.onRequestPermissionsResult(requestCode, permissions, grantResults);
    }

    @Override
    protected void onResume() {
        super.onResume();

        JitsiMeetActivityDelegate.onHostResume(this);
    }

    @Override
    protected void onStop() {
        super.onStop();

        JitsiMeetActivityDelegate.onHostPause(this);
    }

    @Override
    public void requestPermissions(String[] strings, int i, PermissionListener permissionListener) {

    }

    protected JitsiMeetConferenceOptions getOptions(){
        URL serverURL;
        try {
            serverURL = new URL(KeyValues.JITSI_MEET_HOST);
        } catch (MalformedURLException e) {
            e.printStackTrace();
            throw new RuntimeException("Invalid server URL!");
        }
        JitsiMeetUserInfo userInfo = new JitsiMeetUserInfo();
        userInfo.setDisplayName("user");


        return  new JitsiMeetConferenceOptions.Builder()
                .setServerURL(serverURL)
                .setWelcomePageEnabled(false)
                .setFeatureFlag("chat.enabled",false)
                .setVideoMuted(false)
                .setUserInfo(userInfo)
                .setSubject("SAMPLE ROOM")//Set call subject here. use to display phone number here.
                .setRoom("helloall")
                .build();

    }

    @Override
    public void onConferenceJoined(Map<String, Object> map) {

    }

    @Override
    public void onConferenceTerminated(Map<String, Object> map) {
        Log.d("SAMPLE","TERMINATED");
        finish();
    }

    @Override
    public void onConferenceWillJoin(Map<String, Object> map) {

    }
}

@sunilkumarjena21
Copy link

sunilkumarjena21 commented Aug 28, 2020

Hi @erandakarachchi @saghul ,

After implementing this custom activity 'onConferenceTerminated' & 'onConferenceJoined' working perfectly fine.
Issue I'm facing:The camera & microphone is not working in this case unlike the ' JitsiMeetActivity.launch(context, options)' case.
Even its not asking for the dynamic permissions when tapping on the microphone & Camera icons.

Any guess on the issue?

Thanks in advance!

@erandakarachchi
Copy link
Author

erandakarachchi commented Aug 29, 2020

hi @sunilkumarjena21

Not sure what the issue is. but here is a sample application that I've created and it's working fine.

Code

@sunilkumarjena21
Copy link

sunilkumarjena21 commented Aug 29, 2020

HI @erandakarachchi ,
Thanks for your swift response.
I clone your code.And run it onSamsung Galaxy S9.
Not able to unmute Microphone & Camera when tapping on the microphone & Camera icon on 'VideoChatActivity'.

Can you please try running your above project & let me know,if you can reproduce the same at your end?

Thanks in advance!

@erandakarachchi
Copy link
Author

erandakarachchi commented Aug 29, 2020

@sunilkumarjena21
Yes. I was able to replicate it on MI Note 10 and Google Pixel. Didn't have much time to dive into it. Tried by explicitly allowing camera and microphone permissions. But I was unable to access the camera or microphone.
What is your jitsi SDK version?

@sunilkumarjena21
Copy link

sunilkumarjena21 commented Aug 29, 2020

Hi @erandakarachchi ,

My Jitsi version: 'implementation ('org.jitsi.react:jitsi-meet-sdk:2.8.3') { transitive = true }'

I guess upgrading the version solves this issue.

Just one last question ..How to enable PIP mode in this Custom activity.?

' override fun onUserLeaveHint() {
this.view?.enterPictureInPicture()
} '

Thanks in advance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
android Issue related to the Android operating system api Issue related to the external API (iframe) mobile Issue related to any mobile system running Jitsi Meet question Not an issue but a question
Projects
None yet
Development

No branches or pull requests

4 participants