twilio / twilio-video-app-android

A collaboration application built with the Twilio Video Android SDK

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Enable PictureInPicture feature for Video Activity

james04gr opened this issue · comments

Since Android 8.0 (API 26) allows activities to launch in PictureInPicture mode it would be very useful and helpful that you integrate this in the twilio-video-app example that you have.

Hi @james04gr . Thanks for reaching out regarding this enhancement! This would definitely be a great feature to add to the app. We'll add this to our backlog as an enhancement. Also, feel free to open a pull request if you'd like to see this integrated into the app sooner.

Hi, I have achieved PIP mode in my video calling app. I will try to generate PR for it.

Hi, I have achieved PIP mode in my video calling app. I will try to generate PR for it.

Hello. I would really appreciate if you could do so, since i want to integrate it in my webrtc app also! Thank you

Closing this issue as it will be covered in #212

Whoops wrong ticket. Reopening...

Any update on this feature?

嗨,我已经在我的视频通话应用程序中实现了 PIP 模式。我会尝试为它生成 PR。

Can you share the demo of pip?

@15652627534

    // add in video activity
    private boolean startPictureInPicture() {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
            enterPictureInPictureMode(
                    new PictureInPictureParams.Builder()
                            .setAspectRatio(getPipRatio()) //new Rational(2, 4) // This has lower and upper
                            .build()
            );
            return true;
        }
        return false;
    }


//override method for check is in pip mode or not
@SuppressLint("MissingSuperCall")
    @Override
    public void onPictureInPictureModeChanged(boolean isInPictureInPictureMode, Configuration newConfig) {
        if (isInPictureInPictureMode) {
            
        } else {

        }
     
    }

//add in manifest 
<activity
            android:name=".VideoActivity"
            android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation"
            android:excludeFromRecents="true"
            android:launchMode="singleTask"
            android:screenOrientation="portrait"
            android:supportsPictureInPicture="true" />