Search in sources :

Example 6 with PipRoundVideoView

use of org.telegram.ui.Components.PipRoundVideoView in project Telegram-FOSS by Telegram-FOSS-Team.

the class MediaController method setCurrentVideoVisible.

public void setCurrentVideoVisible(boolean visible) {
    if (currentAspectRatioFrameLayout == null) {
        return;
    }
    if (visible) {
        if (pipRoundVideoView != null) {
            pipSwitchingState = 2;
            pipRoundVideoView.close(true);
            pipRoundVideoView = null;
        } else {
            if (currentAspectRatioFrameLayout.getParent() == null) {
                currentTextureViewContainer.addView(currentAspectRatioFrameLayout);
            }
            videoPlayer.setTextureView(currentTextureView);
        }
    } else {
        if (currentAspectRatioFrameLayout.getParent() != null) {
            pipSwitchingState = 1;
            currentTextureViewContainer.removeView(currentAspectRatioFrameLayout);
        } else {
            if (pipRoundVideoView == null) {
                try {
                    pipRoundVideoView = new PipRoundVideoView();
                    pipRoundVideoView.show(baseActivity, () -> cleanupPlayer(true, true));
                } catch (Exception e) {
                    pipRoundVideoView = null;
                }
            }
            if (pipRoundVideoView != null) {
                videoPlayer.setTextureView(pipRoundVideoView.getTextureView());
            }
        }
    }
}
Also used : PipRoundVideoView(org.telegram.ui.Components.PipRoundVideoView) FileNotFoundException(java.io.FileNotFoundException)

Aggregations

PipRoundVideoView (org.telegram.ui.Components.PipRoundVideoView)6 FileNotFoundException (java.io.FileNotFoundException)3 SuppressLint (android.annotation.SuppressLint)2 Point (android.graphics.Point)2 SurfaceTexture (android.graphics.SurfaceTexture)2 EmbedBottomSheet (org.telegram.ui.Components.EmbedBottomSheet)2 ThemeEditorView (org.telegram.ui.Components.ThemeEditorView)2 VideoPlayer (org.telegram.ui.Components.VideoPlayer)2 Intent (android.content.Intent)1 SharedPreferences (android.content.SharedPreferences)1 Uri (android.net.Uri)1 View (android.view.View)1 ImageView (android.widget.ImageView)1 TextView (android.widget.TextView)1 RecyclerView (androidx.recyclerview.widget.RecyclerView)1 File (java.io.File)1 ParseException (java.text.ParseException)1 MessageObject (org.telegram.messenger.MessageObject)1 TLRPC (org.telegram.tgnet.TLRPC)1 SimpleTextView (org.telegram.ui.ActionBar.SimpleTextView)1