@@ -67,6 +67,8 @@ public class FTXLivePlayer extends FTXLivePlayerRenderHost implements TXFlutterL
6767 private FTXRenderView mCurRenderView ;
6868 private final Handler mUIHandler = new Handler (Looper .getMainLooper ());
6969 private boolean mIsMute = false ;
70+ private int mCurrentVideoWidth = 0 ;
71+ private int mCurrentVideoHeight = 0 ;
7072
7173 private final FTXPIPManager .PipCallback pipCallback = new FTXPIPManager .PipCallback () {
7274 @ Override
@@ -178,6 +180,8 @@ int stopPlay(boolean isNeedClearLastImg) {
178180 result = mLivePlayer .stopPlay ();
179181 }
180182 mUIHandler .removeCallbacksAndMessages (null );
183+ mCurrentVideoWidth = 0 ;
184+ mCurrentVideoHeight = 0 ;
181185 if (isNeedClearLastImg && null != mCurRenderView ) {
182186 LiteavLog .i (TAG , "stopPlay target clear last img, player:" + hashCode ());
183187 mCurRenderView .clearTexture ();
@@ -370,11 +374,19 @@ public IntMsg enterPictureInPictureMode(@NonNull PipParamsPlayerMsg pipParamsMsg
370374 mPipManager .toAndroidPath (pipParamsMsg .getPauseIconForAndroid ()),
371375 mPipManager .toAndroidPath (pipParamsMsg .getForwardIconForAndroid ()),
372376 getPlayerId (), false , false , true );
373- pipParams .setIsPlaying (isPlayerPlaying ());
374- int pipResult = mPipManager .enterPip (pipParams , new TXPlayerHolder (mLivePlayer , mIsPaused ));
375- // After the startup is successful, pause the video on the current interface.
376- if (pipResult == FTXEvent .NO_ERROR ) {
377- pausePlayer ();
377+ int pipResult = FTXEvent .ERROR_PIP_MISS_PLAYER ;
378+ if (null != mLivePlayer ) {
379+ pipParams .setIsPlaying (isPlayerPlaying ());
380+ if (mCurrentVideoWidth > 0 && mCurrentVideoHeight > 0 ) {
381+ pipParams .setRadio (mCurrentVideoWidth , mCurrentVideoHeight );
382+ } else {
383+ LiteavLog .e (TAG , "miss video size when enter PIP" );
384+ }
385+ pipResult = mPipManager .enterPip (pipParams , new TXPlayerHolder (mLivePlayer , mIsPaused ));
386+ // After the startup is successful, pause the video on the current interface.
387+ if (pipResult == FTXEvent .NO_ERROR ) {
388+ pausePlayer ();
389+ }
378390 }
379391 return TXCommonUtil .intMsgWith ((long ) pipResult );
380392 }
@@ -532,6 +544,8 @@ public void onVideoResolutionChanged(V2TXLivePlayer player, int width, int heigh
532544 width , height ));
533545 int code = TXLiveConstants .PLAY_EVT_CHANGE_RESOLUTION ;
534546 mLivePlayer .notifyPlayerEvent (code , bundle );
547+ mLivePlayer .mCurrentVideoWidth = width ;
548+ mLivePlayer .mCurrentVideoHeight = height ;
535549 }
536550
537551 @ Override
0 commit comments