提交 e808d31c authored 作者: kongdywang's avatar kongdywang

1. Fix an issue where the window size and aspect ratio of the picture-in-picture…

1. Fix an issue where the window size and aspect ratio of the picture-in-picture mode do not match when entering picture-in-picture during Android live streaming. 2. Remove the delay operation for rotating the screen in the player component.
上级 6619ac8e
...@@ -67,6 +67,8 @@ public class FTXLivePlayer extends FTXLivePlayerRenderHost implements TXFlutterL ...@@ -67,6 +67,8 @@ public class FTXLivePlayer extends FTXLivePlayerRenderHost implements TXFlutterL
private FTXRenderView mCurRenderView; private FTXRenderView mCurRenderView;
private final Handler mUIHandler = new Handler(Looper.getMainLooper()); private final Handler mUIHandler = new Handler(Looper.getMainLooper());
private boolean mIsMute = false; private boolean mIsMute = false;
private int mCurrentVideoWidth = 0;
private int mCurrentVideoHeight = 0;
private final FTXPIPManager.PipCallback pipCallback = new FTXPIPManager.PipCallback() { private final FTXPIPManager.PipCallback pipCallback = new FTXPIPManager.PipCallback() {
@Override @Override
...@@ -178,6 +180,8 @@ public class FTXLivePlayer extends FTXLivePlayerRenderHost implements TXFlutterL ...@@ -178,6 +180,8 @@ public class FTXLivePlayer extends FTXLivePlayerRenderHost implements TXFlutterL
result = mLivePlayer.stopPlay(); result = mLivePlayer.stopPlay();
} }
mUIHandler.removeCallbacksAndMessages(null); mUIHandler.removeCallbacksAndMessages(null);
mCurrentVideoWidth = 0;
mCurrentVideoHeight = 0;
if (isNeedClearLastImg && null != mCurRenderView) { if (isNeedClearLastImg && null != mCurRenderView) {
LiteavLog.i(TAG, "stopPlay target clear last img, player:" + hashCode()); LiteavLog.i(TAG, "stopPlay target clear last img, player:" + hashCode());
mCurRenderView.clearTexture(); mCurRenderView.clearTexture();
...@@ -370,11 +374,19 @@ public class FTXLivePlayer extends FTXLivePlayerRenderHost implements TXFlutterL ...@@ -370,11 +374,19 @@ public class FTXLivePlayer extends FTXLivePlayerRenderHost implements TXFlutterL
mPipManager.toAndroidPath(pipParamsMsg.getPauseIconForAndroid()), mPipManager.toAndroidPath(pipParamsMsg.getPauseIconForAndroid()),
mPipManager.toAndroidPath(pipParamsMsg.getForwardIconForAndroid()), mPipManager.toAndroidPath(pipParamsMsg.getForwardIconForAndroid()),
getPlayerId(), false, false, true); getPlayerId(), false, false, true);
pipParams.setIsPlaying(isPlayerPlaying()); int pipResult = FTXEvent.ERROR_PIP_MISS_PLAYER;
int pipResult = mPipManager.enterPip(pipParams, new TXPlayerHolder(mLivePlayer, mIsPaused)); if (null != mLivePlayer) {
// After the startup is successful, pause the video on the current interface. pipParams.setIsPlaying(isPlayerPlaying());
if (pipResult == FTXEvent.NO_ERROR) { if (mCurrentVideoWidth > 0 && mCurrentVideoHeight > 0) {
pausePlayer(); pipParams.setRadio(mCurrentVideoWidth, mCurrentVideoHeight);
} else {
LiteavLog.e(TAG, "miss video size when enter PIP");
}
pipResult = mPipManager.enterPip(pipParams, new TXPlayerHolder(mLivePlayer, mIsPaused));
// After the startup is successful, pause the video on the current interface.
if (pipResult == FTXEvent.NO_ERROR) {
pausePlayer();
}
} }
return TXCommonUtil.intMsgWith((long) pipResult); return TXCommonUtil.intMsgWith((long) pipResult);
} }
...@@ -532,6 +544,8 @@ public class FTXLivePlayer extends FTXLivePlayerRenderHost implements TXFlutterL ...@@ -532,6 +544,8 @@ public class FTXLivePlayer extends FTXLivePlayerRenderHost implements TXFlutterL
width, height)); width, height));
int code = TXLiveConstants.PLAY_EVT_CHANGE_RESOLUTION; int code = TXLiveConstants.PLAY_EVT_CHANGE_RESOLUTION;
mLivePlayer.notifyPlayerEvent(code, bundle); mLivePlayer.notifyPlayerEvent(code, bundle);
mLivePlayer.mCurrentVideoWidth = width;
mLivePlayer.mCurrentVideoHeight = height;
} }
@Override @Override
......
...@@ -934,10 +934,8 @@ class FullScreenController { ...@@ -934,10 +934,8 @@ class FullScreenController {
SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: SystemUiOverlay.values); SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: SystemUiOverlay.values);
} else if (orientationDirection == TXVodPlayEvent.ORIENTATION_LANDSCAPE_RIGHT) { } else if (orientationDirection == TXVodPlayEvent.ORIENTATION_LANDSCAPE_RIGHT) {
enterFullScreen(); enterFullScreen();
Future.delayed(Duration(milliseconds: 500), (){ SystemChrome.setPreferredOrientations(Platform.isIOS ? [DeviceOrientation.landscapeRight] : [DeviceOrientation.landscapeLeft]);
SystemChrome.setPreferredOrientations(Platform.isIOS ? [DeviceOrientation.landscapeRight] : [DeviceOrientation.landscapeLeft]); SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersive);
SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersive);
});
} else if (orientationDirection == TXVodPlayEvent.ORIENTATION_PORTRAIT_DOWN) { } else if (orientationDirection == TXVodPlayEvent.ORIENTATION_PORTRAIT_DOWN) {
} else if (orientationDirection == TXVodPlayEvent.ORIENTATION_LANDSCAPE_LEFT) { } else if (orientationDirection == TXVodPlayEvent.ORIENTATION_LANDSCAPE_LEFT) {
SystemChrome.setPreferredOrientations(Platform.isIOS ? [DeviceOrientation.landscapeLeft] : [DeviceOrientation.landscapeRight]); SystemChrome.setPreferredOrientations(Platform.isIOS ? [DeviceOrientation.landscapeLeft] : [DeviceOrientation.landscapeRight]);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论