Skip to content

Commit

Permalink
Merge pull request #93 from Jhuster/dev
Browse files Browse the repository at this point in the history
release 1.2.2
  • Loading branch information
longbai committed May 6, 2016
2 parents f5c8653 + 8d1cfd7 commit a360d22
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 15 deletions.
2 changes: 1 addition & 1 deletion PLDroidPlayerDemo/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ android {

dependencies {
compile 'com.android.support:design:23.2.1'
compile files('libs/pldroid-player-1.2.1.jar')
compile files('libs/pldroid-player-1.2.2.jar')
}
Binary file not shown.
2 changes: 0 additions & 2 deletions PLDroidPlayerDemo/app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,3 @@
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

-keep class com.pili.pldroid.player.** { *; }
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public class PLMediaPlayerActivity extends AppCompatActivity {
private int mSurfaceHeight = 0;

private String mVideoPath = null;
private boolean mIsStopped = false;

@Override
protected void onCreate(Bundle savedInstanceState) {
Expand All @@ -59,6 +60,9 @@ protected void onCreate(Bundle savedInstanceState) {
int codec = getIntent().getIntExtra("mediaCodec", 0);
mAVOptions.setInteger(AVOptions.KEY_MEDIACODEC, codec);

// whether start play automatically after prepared, default value is 1
mAVOptions.setInteger(AVOptions.KEY_START_ON_PREPARED, 0);

AudioManager audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
audioManager.requestAudioFocus(null, AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN);
}
Expand All @@ -72,7 +76,11 @@ protected void onDestroy() {
}

public void onClickPlay(View v) {
prepare();
if (mIsStopped) {
prepare();
} else {
mMediaPlayer.start();
}
}

public void onClickPause(View v) {
Expand All @@ -92,6 +100,7 @@ public void onClickStop(View v) {
mMediaPlayer.stop();
mMediaPlayer.reset();
}
mIsStopped = true;
}

public void release() {
Expand Down Expand Up @@ -175,6 +184,7 @@ public void onVideoSizeChanged(PLMediaPlayer mp, int width, int height) {
public void onPrepared(PLMediaPlayer mp) {
Log.i(TAG, "On Prepared !");
mMediaPlayer.start();
mIsStopped = false;
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,23 @@ protected void onCreate(Bundle savedInstanceState) {
int codec = getIntent().getIntExtra("mediaCodec", 0);
options.setInteger(AVOptions.KEY_MEDIACODEC, codec);

// whether start play automatically after prepared, default value is 1
options.setInteger(AVOptions.KEY_START_ON_PREPARED, 0);

mVideoView.setAVOptions(options);

// You can mirror the display
// mVideoView.setMirror(true);

// You can also use a custom `MediaController` widget
mMediaController = new MediaController(this, false, isLiveStreaming(mVideoPath));
mVideoView.setMediaController(mMediaController);

mVideoView.setOnCompletionListener(mOnCompletionListener);
mVideoView.setOnErrorListener(mOnErrorListener);

// After setVideoPath, the play will start automatically
mVideoView.setVideoPath(mVideoPath);
mVideoView.start();
}

@Override
Expand Down Expand Up @@ -153,6 +159,7 @@ public boolean onError(PLMediaPlayer mp, int errorCode) {
finish();
// If you want to retry, do like this:
// mVideoView.setVideoPath(mVideoPath);
// mVideoView.start();
// Return true means the error has been handled
// If return false, then `onCompletion` will be called
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,19 @@ protected void onCreate(Bundle savedInstanceState) {
int codec = getIntent().getIntExtra("mediaCodec", 0);
options.setInteger(AVOptions.KEY_MEDIACODEC, codec);

// whether start play automatically after prepared, default value is 1
options.setInteger(AVOptions.KEY_START_ON_PREPARED, 0);

mVideoView.setAVOptions(options);

// Set some listeners
mVideoView.setOnPreparedListener(mOnPreparedListener);
mVideoView.setOnInfoListener(mOnInfoListener);
mVideoView.setOnVideoSizeChangedListener(mOnVideoSizeChangedListener);
mVideoView.setOnBufferingUpdateListener(mOnBufferingUpdateListener);
mVideoView.setOnCompletionListener(mOnCompletionListener);
mVideoView.setOnSeekCompleteListener(mOnSeekCompleteListener);
mVideoView.setOnErrorListener(mOnErrorListener);

// After setVideoPath, the play will start automatically
// mVideoView.start() is not required
mVideoView.setVideoPath(mVideoPath);

// You can also use a custom `MediaController` widget
Expand Down Expand Up @@ -112,13 +112,6 @@ public void onClickSwitchScreen(View v) {
}
}

private PLMediaPlayer.OnPreparedListener mOnPreparedListener = new PLMediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(PLMediaPlayer plMediaPlayer) {
Log.d(TAG, "onPrepared ! ");
}
};

private PLMediaPlayer.OnInfoListener mOnInfoListener = new PLMediaPlayer.OnInfoListener() {
@Override
public boolean onInfo(PLMediaPlayer plMediaPlayer, int what, int extra) {
Expand Down Expand Up @@ -162,6 +155,7 @@ public boolean onError(PLMediaPlayer plMediaPlayer, int errorCode) {
finish();
// If you want to retry, do like this:
// mVideoView.setVideoPath(mVideoPath);
// mVideoView.start();
// Return true means the error has been handled
// If return false, then `onCompletion` will be called
return true;
Expand Down
4 changes: 4 additions & 0 deletions PLDroidPlayerDemo/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,7 @@ allprojects {
jcenter()
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}
16 changes: 16 additions & 0 deletions ReleaseNotes/release-notes-1.2.2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# PLDroidPlayer Release Notes for 1.2.2

## 简介
PLDroidPlayer 为 Android 开发者提供直播播放 SDK

## 记录

### 播放器
- 发布 pldroid-player-1.2.2.jar
- `AVOptions` 新增 `KEY_START_ON_PREPARED` 参数,便于配置是否自动开始播放
- `PLVideoTextureView` 新增 `setMirror` 接口,可实现画面镜像变换
- 新增 `setVolume` 接口,可实现播放器音量的设置,或静音功能

### 播放器 Demo

- 更新 demo ,优化演示细节
Binary file not shown.

0 comments on commit a360d22

Please sign in to comment.