Commit c2231a10 authored by jiangjiantao's avatar jiangjiantao

设置循环播放需要在开始播放之前

增加一些日志
parent b6da758b
...@@ -15,18 +15,18 @@ ...@@ -15,18 +15,18 @@
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/AppTheme"> android:theme="@style/AppTheme">
<activity <!-- <activity-->
android:name=".MainActivity" <!-- android:name=".MainActivity"-->
android:configChanges="orientation|keyboardHidden|screenSize|keyboard|navigation" <!-- android:configChanges="orientation|keyboardHidden|screenSize|keyboard|navigation"-->
android:exported="true" <!-- android:exported="true"-->
android:launchMode="singleTask" <!-- android:launchMode="singleTask"-->
android:screenOrientation="portrait"> <!-- android:screenOrientation="portrait">-->
<intent-filter> <!-- <intent-filter>-->
<action android:name="android.intent.action.MAIN" /> <!-- <action android:name="android.intent.action.MAIN" />-->
<category android:name="android.intent.category.LAUNCHER" /> <!-- <category android:name="android.intent.category.LAUNCHER" />-->
</intent-filter> <!-- </intent-filter>-->
</activity> <!-- </activity>-->
<activity <activity
android:name=".DetailActivity" android:name=".DetailActivity"
......
...@@ -49,10 +49,10 @@ public class SampleCoverVideo extends StandardGSYVideoPlayer { ...@@ -49,10 +49,10 @@ public class SampleCoverVideo extends StandardGSYVideoPlayer {
protected void init(Context context) { protected void init(Context context) {
super.init(context); super.init(context);
mCoverImage = (ImageView) findViewById(R.id.thumbImage); mCoverImage = (ImageView) findViewById(R.id.thumbImage);
if (mThumbImageViewLayout != null && if (mThumbImageViewLayout != null &&
(mCurrentState == -1 || mCurrentState == CURRENT_STATE_NORMAL || mCurrentState == CURRENT_STATE_ERROR)) { (mCurrentState == -1 || mCurrentState == CURRENT_STATE_NORMAL || mCurrentState == CURRENT_STATE_ERROR)) {
mThumbImageViewLayout.setVisibility(VISIBLE); mThumbImageViewLayout.setVisibility(VISIBLE);
BLogUtil.log("显示封面");
} }
Debuger.enable(); Debuger.enable();
} }
...@@ -165,6 +165,7 @@ public class SampleCoverVideo extends StandardGSYVideoPlayer { ...@@ -165,6 +165,7 @@ public class SampleCoverVideo extends StandardGSYVideoPlayer {
super.onSurfaceUpdated(surface); super.onSurfaceUpdated(surface);
if (mThumbImageViewLayout != null && mThumbImageViewLayout.getVisibility() == VISIBLE) { if (mThumbImageViewLayout != null && mThumbImageViewLayout.getVisibility() == VISIBLE) {
mThumbImageViewLayout.setVisibility(INVISIBLE); mThumbImageViewLayout.setVisibility(INVISIBLE);
BLogUtil.log("隐藏封面");
} }
} }
...@@ -181,6 +182,7 @@ public class SampleCoverVideo extends StandardGSYVideoPlayer { ...@@ -181,6 +182,7 @@ public class SampleCoverVideo extends StandardGSYVideoPlayer {
super.onSurfaceAvailable(surface); super.onSurfaceAvailable(surface);
if (GSYVideoType.getRenderType() != GSYVideoType.TEXTURE) { if (GSYVideoType.getRenderType() != GSYVideoType.TEXTURE) {
if (mThumbImageViewLayout != null && mThumbImageViewLayout.getVisibility() == VISIBLE) { if (mThumbImageViewLayout != null && mThumbImageViewLayout.getVisibility() == VISIBLE) {
BLogUtil.log("隐藏封面");
mThumbImageViewLayout.setVisibility(INVISIBLE); mThumbImageViewLayout.setVisibility(INVISIBLE);
} }
} }
......
...@@ -20,6 +20,7 @@ public class VideoSubView extends FrameLayout implements IPlayTarget { ...@@ -20,6 +20,7 @@ public class VideoSubView extends FrameLayout implements IPlayTarget {
private OnActionFinishListener mOnPageChangedListener; private OnActionFinishListener mOnPageChangedListener;
private SampleCoverVideo player; private SampleCoverVideo player;
private MediaBean mediaBean;
private final GSYSampleCallBack sampleCallBack = new GSYSampleCallBack(){ private final GSYSampleCallBack sampleCallBack = new GSYSampleCallBack(){
@Override @Override
...@@ -38,6 +39,7 @@ public class VideoSubView extends FrameLayout implements IPlayTarget { ...@@ -38,6 +39,7 @@ public class VideoSubView extends FrameLayout implements IPlayTarget {
public VideoSubView(@NonNull Context context, MediaBean mediaBean, final OnActionFinishListener onPageChangedListener) { public VideoSubView(@NonNull Context context, MediaBean mediaBean, final OnActionFinishListener onPageChangedListener) {
super(context); super(context);
this.mediaBean = mediaBean;
mOnPageChangedListener = onPageChangedListener; mOnPageChangedListener = onPageChangedListener;
View parent = LayoutInflater.from(context).inflate(R.layout.layout_player_view, this, true); View parent = LayoutInflater.from(context).inflate(R.layout.layout_player_view, this, true);
player = parent.findViewById(R.id.player); player = parent.findViewById(R.id.player);
...@@ -47,12 +49,17 @@ public class VideoSubView extends FrameLayout implements IPlayTarget { ...@@ -47,12 +49,17 @@ public class VideoSubView extends FrameLayout implements IPlayTarget {
player.loadCoverImage(mediaBean.getCover(),0); player.loadCoverImage(mediaBean.getCover(),0);
player.setUp(mediaBean.getUrl(), true, null); player.setUp(mediaBean.getUrl(), true, null);
player.setLooping(mediaBean.isLooping()); player.setLooping(mediaBean.isLooping());
BLogUtil.log("设置视频轮播是否循环模式="+mediaBean.isLooping());
} }
@Override @Override
public void onActive() { public void onActive() {
BLogUtil.log("视频开始播放"); BLogUtil.log("视频开始播放");
if(null != mediaBean){
// 必须得在播放之前设置循环模式
player.setLooping(mediaBean.isLooping());
BLogUtil.log("设置视频轮播是否循环模式onActive="+mediaBean.isLooping());
}
player.startPlayLogic(); player.startPlayLogic();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment