提交 9457dcdf 编写于 作者: S shuyu

1.3.3

上级 fd7ab56d
......@@ -19,13 +19,13 @@
<dependency>
<groupId>com.shuyu</groupId>
<artifactId>gsyVideoPlayer</artifactId>
<version>1.3.2</version>
<version>1.3.3</version>
<type>pom</type>
</dependency>
```
```
compile 'com.shuyu:gsyVideoPlayer:1.3.2'
compile 'com.shuyu:gsyVideoPlayer:1.3.3'
```
## 效果,录屏下的屏幕旋转和实际有些出入
......@@ -45,11 +45,12 @@ compile 'com.shuyu:gsyVideoPlayer:1.3.2'
* <h4>3、详情模式</h4>
<img src="https://github.com/CarGuo/GSYVideoPlayer/blob/master/04.gif" width="240px" height="426px"/>
### 1.3.2 解决了因为兼容FragmentActivity导致actionbar隐藏失败问题。
### 1.3.3 优化了一些内存泄漏问题,更新了demo
### 1.3.1 更新了lastListener的判空问题,建议更新到这个版本
### 1.3.2 解决了因为兼容FragmentActivity导致actionbar隐藏失败问题
### 1.3.1 更新了lastListener的判空问题,建议更新到这个版本。
### 1.3.0 支持配置缓存路径,添加了ListVideoUtils的一些接口
......
......@@ -35,7 +35,9 @@ android {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
def viewDependencies = rootProject.ext.viewDependencies
def dataDependencies = rootProject.ext.dataDependencies
apt viewDependencies.apt_butterKnife
compile viewDependencies.butterKnife
//debugCompile dataDependencies.leakcanary
compile project(':gsyVideoPlayer')
}
......@@ -81,8 +81,7 @@ public class DetailPlayer extends FragmentActivity {
@Override
public void onBackPressed() {
if (isFull) {
detailPlayer.getBackButton().performClick();
if (StandardGSYVideoPlayer.backFromWindowFull(this)) {
return;
}
super.onBackPressed();
......@@ -92,6 +91,8 @@ public class DetailPlayer extends FragmentActivity {
protected void onDestroy() {
super.onDestroy();
GSYVideoPlayer.releaseAllVideos();
if (orientationUtils != null)
orientationUtils.releaseListener();
}
private void toFull() {
......
......@@ -2,7 +2,7 @@ package com.example.gsyvideoplayer;
import android.app.Application;
import com.shuyu.gsyvideoplayer.GSYVideoManager;
//import com.squareup.leakcanary.LeakCanary;
/**
* Created by shuyu on 2016/11/11.
......@@ -13,5 +13,11 @@ public class GSYApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
//if (LeakCanary.isInAnalyzerProcess(this)) {
// This process is dedicated to LeakCanary for heap analysis.
// You should not init your app in this process.
//return;
//}
//LeakCanary.install(this);
}
}
......@@ -38,6 +38,8 @@ public class PlayActivity extends AppCompatActivity {
private boolean isTransition;
private Transition transition;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
......@@ -111,9 +113,15 @@ public class PlayActivity extends AppCompatActivity {
super.onResume();
}
@TargetApi(Build.VERSION_CODES.KITKAT)
@Override
protected void onDestroy() {
super.onDestroy();
if (orientationUtils != null)
orientationUtils.releaseListener();
if (isTransition && transition != null) {
transition.removeListener(onTransitionListener);
}
}
@Override
......@@ -148,18 +156,22 @@ public class PlayActivity extends AppCompatActivity {
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private boolean addTransitionListener() {
final Transition transition = getWindow().getSharedElementEnterTransition();
transition = getWindow().getSharedElementEnterTransition();
if (transition != null) {
transition.addListener(new OnTransitionListener() {
@Override
public void onTransitionEnd(Transition transition) {
videoPlayer.startPlayLogic();
transition.removeListener(this);
}
});
transition.addListener(onTransitionListener);
return true;
}
return false;
}
OnTransitionListener onTransitionListener = new OnTransitionListener() {
@TargetApi(Build.VERSION_CODES.KITKAT)
@Override
public void onTransitionEnd(Transition transition) {
videoPlayer.startPlayLogic();
transition.removeListener(onTransitionListener);
}
};
}
......@@ -22,6 +22,7 @@ ext {
//DataLibraries
videocache = '2.6.3'
leakcanary = '1.5'
androidDependencies = [
recyclerView: "com.android.support:recyclerview-v7:${supportLibraryVersion}",
......@@ -46,5 +47,6 @@ ext {
dataDependencies = [
videocache: "com.danikula:videocache:${videocache}",
leakcanary: "com.squareup.leakcanary:leakcanary-android:${leakcanary}",
]
}
......@@ -18,7 +18,7 @@ org.gradle.jvmargs=-Xmx1536m
BINTRAY_USER=
BINTRAY_KEY=
PROJ_GROUP=com.shuyu
PROJ_VERSION=1.3.2
PROJ_VERSION=1.3.3
PROJ_NAME=gsyVideo
PROJ_WEBSITEURL=hhttps://github.com/CarGuo/GSYVideoPlayer
PROJ_ISSUETRACKERURL=
......
......@@ -66,7 +66,7 @@ public abstract class GSYVideoPlayer extends GSYBaseVideoPlayer implements View.
public static boolean WIFI_TIP_DIALOG_SHOWED = false;
protected static Timer UPDATE_PROGRESS_TIMER;
protected Timer UPDATE_PROGRESS_TIMER;
protected View mStartButton;
......@@ -176,7 +176,7 @@ public abstract class GSYVideoPlayer extends GSYBaseVideoPlayer implements View.
mFullscreenButton.setOnTouchListener(this);
mScreenWidth = getContext().getResources().getDisplayMetrics().widthPixels;
mScreenHeight = getContext().getResources().getDisplayMetrics().heightPixels;
mAudioManager = (AudioManager) getContext().getApplicationContext().getSystemService(Context.AUDIO_SERVICE);
mAudioManager = (AudioManager) getContext().getSystemService(Context.AUDIO_SERVICE);
}
/**
......@@ -255,6 +255,9 @@ public abstract class GSYVideoPlayer extends GSYBaseVideoPlayer implements View.
cancelProgressTimer();
GSYVideoManager.instance().releaseMediaPlayer();
}
if (mAudioManager != null) {
mAudioManager.abandonAudioFocus(onAudioFocusChangeListener);
}
break;
case CURRENT_STATE_PREPAREING:
resetProgressAndTime();
......@@ -356,9 +359,7 @@ public abstract class GSYVideoPlayer extends GSYBaseVideoPlayer implements View.
GSYVideoManager.instance().setPlayTag(mPlayTag);
GSYVideoManager.instance().setPlayPosition(mPlayPosition);
addTextureView();
AudioManager mAudioManager = (AudioManager) getContext().getSystemService(Context.AUDIO_SERVICE);
mAudioManager.requestAudioFocus(onAudioFocusChangeListener, AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN_TRANSIENT);
((Activity) getContext()).getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
GSYVideoManager.instance().prepare(mUrl, mMapHeadData, mLooping, mSpeed);
setStateAndUi(CURRENT_STATE_PREPAREING);
......@@ -492,6 +493,7 @@ public abstract class GSYVideoPlayer extends GSYBaseVideoPlayer implements View.
public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) {
GSYVideoManager.instance().setDisplay(null);
surface.release();
cancelProgressTimer();
return true;
}
......@@ -721,7 +723,6 @@ public abstract class GSYVideoPlayer extends GSYBaseVideoPlayer implements View.
}
if (!mIfCurrentIsFullscreen)
GSYVideoManager.instance().setLastListener(null);
AudioManager mAudioManager = (AudioManager) getContext().getSystemService(Context.AUDIO_SERVICE);
mAudioManager.abandonAudioFocus(onAudioFocusChangeListener);
((Activity) getContext()).getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
}
......@@ -747,7 +748,6 @@ public abstract class GSYVideoPlayer extends GSYBaseVideoPlayer implements View.
GSYVideoManager.instance().setCurrentVideoHeight(0);
GSYVideoManager.instance().setCurrentVideoWidth(0);
AudioManager mAudioManager = (AudioManager) getContext().getSystemService(Context.AUDIO_SERVICE);
mAudioManager.abandonAudioFocus(onAudioFocusChangeListener);
((Activity) getContext()).getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
}
......
......@@ -160,7 +160,6 @@ public class OrientationUtils {
public void releaseListener() {
if (orientationEventListener != null) {
orientationEventListener.disable();
orientationEventListener = null;
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册