提交 40afa17c 编写于 作者: S shuyu

1.3.7 优化了暂停的时候全屏/恢复全屏会是黑色的问题

上级 18d2a091
......@@ -3,6 +3,7 @@ package com.shuyu.gsyvideoplayer.utils;
import android.app.Activity;
import android.content.Context;
import android.content.ContextWrapper;
import android.graphics.Point;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Build;
......@@ -15,6 +16,8 @@ import android.util.TypedValue;
import android.view.View;
import android.view.WindowManager;
import com.shuyu.gsyvideoplayer.GSYVideoManager;
import java.io.File;
import java.util.Formatter;
import java.util.Locale;
......@@ -262,4 +265,29 @@ public class CommonUtil {
}
}
public static Point getPauseBitmapSize(int w, int h) {
int videoHeight = 0;
int videoWidth = 0;
if (GSYVideoManager.instance().getMediaPlayer() != null) {
videoHeight = GSYVideoManager.instance().getCurrentVideoHeight();
videoWidth = GSYVideoManager.instance().getCurrentVideoWidth();
}
if (videoHeight == 0 || videoWidth == 0) {
videoWidth = w;
videoHeight = h;
}
if (videoWidth > w || videoHeight > h) {
videoWidth = w;
videoHeight = h;
}
return new Point(videoWidth, videoHeight);
}
}
......@@ -11,6 +11,7 @@ import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.FrameLayout;
import android.widget.ImageView;
......@@ -383,7 +384,8 @@ public abstract class GSYBaseVideoPlayer extends FrameLayout implements GSYMedia
private void pauseFullCoverLogic() {
if (mCurrentState == GSYVideoPlayer.CURRENT_STATE_PAUSE && mTextureView != null
&& (mFullPauseBitmap == null || mFullPauseBitmap.isRecycled())) {
mFullPauseBitmap = mTextureView.getBitmap();
Point point = CommonUtil.getPauseBitmapSize(getWidth(), getHeight());
mFullPauseBitmap = mTextureView.getBitmap(point.x, point.y);
}
}
......@@ -399,8 +401,9 @@ public abstract class GSYBaseVideoPlayer extends FrameLayout implements GSYMedia
&& !gsyVideoPlayer.mFullPauseBitmap.isRecycled()) {
mFullPauseBitmap = gsyVideoPlayer.mFullPauseBitmap;
} else {
Point point = CommonUtil.getPauseBitmapSize(getWidth(), getHeight());
//不在了说明已经播放过,还是暂停的话,我们拿回来就好
mFullPauseBitmap = gsyVideoPlayer.mTextureView.getBitmap();
mFullPauseBitmap = gsyVideoPlayer.mTextureView.getBitmap(point.x, point.y);
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册