Skip to content

Commit

Permalink
Merge pull request #36 from jpxiong/master
Browse files Browse the repository at this point in the history
release v1.1.4
  • Loading branch information
jpxiong committed Nov 17, 2015
2 parents 651d425 + 43a850e commit 13a63d5
Show file tree
Hide file tree
Showing 17 changed files with 87 additions and 16 deletions.
2 changes: 1 addition & 1 deletion PLDroidPlayerDemo/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.0.0'
compile files('libs/ijkmediaplayer.jar')
compile files('libs/pldroid-player-1.1.3.jar')
compile files('libs/pldroid-player-1.1.4.jar')
}
Binary file removed PLDroidPlayerDemo/app/libs/pldroid-player-1.1.3.jar
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import android.view.WindowManager;
import android.widget.Button;

import com.pili.pldroid.player.AVOptions;
import com.pili.pldroid.player.AudioPlayer;
import com.pili.pldroid.player.PlayerCode;
import com.pili.pldroid.playerdemo.R;
Expand Down Expand Up @@ -67,14 +68,26 @@ public void onClick(View view) {
boolean useFastForward = true;
boolean disableProgressBar = false;
// Tip: you can custom the variable depending on your situation
mIsLiveStream = !Util.isUrlLocalFile(mAudioPath);
mIsLiveStream = true;
if (mIsLiveStream) {
disableProgressBar = true;
useFastForward = false;
}
mMediaController = new MediaController(this, useFastForward, disableProgressBar);
mAudioPlayer = new AudioPlayer(this);

AVOptions options = new AVOptions();
options.setInteger(AVOptions.KEY_MEDIACODEC, 1); // 1 -> enable, 0 -> disable

Log.i(TAG, "mIsLiveStream:" + mIsLiveStream);
if (mIsLiveStream) {
options.setInteger(AVOptions.KEY_BUFFER_TIME, 1000); // the unit of buffer time is ms
options.setInteger(AVOptions.KEY_GET_AV_FRAME_TIMEOUT, 8 * 1000); // the unit of timeout is ms
options.setString(AVOptions.KEY_FFLAGS, AVOptions.VALUE_FFLAGS_NOBUFFER); // "nobuffer"
options.setInteger(AVOptions.KEY_LIVE_STREAMING, 1);
}
mAudioPlayer.setAVOptions(options);

mMediaController.setMediaPlayer(mAudioPlayer);
mAudioPlayer.setMediaController(mMediaController);
mAudioPlayer.setOnErrorListener(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public void onClick(View view) {

Log.i(TAG, "mVideoPath:" + mVideoPath);
// Tip: you can custom the variable depending on your situation
mIsLiveStream = Util.isLiveStreaming(mVideoPath);
mIsLiveStream = true;
if (mIsLiveStream) {
disableProgressBar = true;
useFastForward = false;
Expand All @@ -87,7 +87,7 @@ public void onClick(View view) {
Log.i(TAG, "mIsLiveStream:" + mIsLiveStream);
if (mIsLiveStream) {
options.setInteger(AVOptions.KEY_BUFFER_TIME, 1000); // the unit of buffer time is ms
options.setInteger(AVOptions.KEY_GET_AV_FRAME_TIMEOUT, 3 * 1000); // the unit of timeout is ms
options.setInteger(AVOptions.KEY_GET_AV_FRAME_TIMEOUT, 8 * 1000); // the unit of timeout is ms
options.setString(AVOptions.KEY_FFLAGS, AVOptions.VALUE_FFLAGS_NOBUFFER); // "nobuffer"
options.setInteger(AVOptions.KEY_LIVE_STREAMING, 1);
}
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified PLDroidPlayerDemo/app/src/main/jniLibs/x86/libpldroidplayer.so
Binary file not shown.
12 changes: 6 additions & 6 deletions PLDroidPlayerDemo/app/src/main/res/layout/activity_player.xml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/background_material_dark" >
android:background="@color/background_material_light" >

<com.pili.pldroid.player.widget.VideoView
android:id="@+id/video_view"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center" />
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true" />

<Button
android:id="@+id/back_btn"
Expand Down Expand Up @@ -48,4 +48,4 @@
android:layout_height="60dip" />
</LinearLayout>

</FrameLayout>
</RelativeLayout>
52 changes: 46 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,34 @@ public void onPrepared(IMediaPlayer mp) {

5 设置 `AVOptions`
```JAVA
AVOptions options = new AVOptions();
options.setInteger(AVOptions.KEY_GET_AV_FRAME_TIMEOUT, 3 * 1000); // the unit of timeout is ms
options.setInteger(AVOptions.KEY_MEDIACODEC, 1); // 1 -> enable, 0 -> disable
options.setString(AVOptions.KEY_FFLAGS, AVOptions.VALUE_FFLAGS_NOBUFFER); // "nobuffer"
options.setInteger(AVOptions.KEY_BUFFER_TIME, 1000); // the unit of buffer time is ms
mVideoView.setAVOptions(options);
// Tip: you can custom the variable depending on your situation
if (mIsLiveStream) {
options.setInteger(AVOptions.KEY_BUFFER_TIME, 1000); // the unit of buffer time is ms
options.setInteger(AVOptions.KEY_GET_AV_FRAME_TIMEOUT, 10 * 1000); // the unit of timeout is ms
options.setString(AVOptions.KEY_FFLAGS, AVOptions.VALUE_FFLAGS_NOBUFFER); // "nobuffer"
options.setInteger(AVOptions.KEY_LIVE_STREAMING, 1);
}
mAudioPlayer.setAVOptions(options);
```
> `AVOptions.KEY_FFLAGS` , `AVOptions.KEY_BUFFER_TIME` 仅对 RTMP 有效;`AVOptions` 需要在 `start()`/`setVideoPath()` 前设置

6 全屏播放

您只需在 `VideoView` 的布局文件中设置对应的属性即可,例如:

```
<com.pili.pldroid.player.widget.VideoView
android:id="@+id/video_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:layout_alignParentTop="true"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
/>
```

#### 纯音频播放
1 实例化 `AudioPlayer`
```JAVA
Expand All @@ -148,6 +167,18 @@ mAudioPlayer.setOnInfoListener(this);
mAudioPlayer.setOnPreparedListener(this);
```

5 设置 `AVOptions`
```JAVA
// Tip: you can custom the variable depending on your situation
if (mIsLiveStream) {
options.setInteger(AVOptions.KEY_BUFFER_TIME, 1000); // the unit of buffer time is ms
options.setInteger(AVOptions.KEY_GET_AV_FRAME_TIMEOUT, 10 * 1000); // the unit of timeout is ms
options.setString(AVOptions.KEY_FFLAGS, AVOptions.VALUE_FFLAGS_NOBUFFER); // "nobuffer"
options.setInteger(AVOptions.KEY_LIVE_STREAMING, 1);
}
mAudioPlayer.setAVOptions(options);
```

## 依赖库
* ffmpeg
* libyuv
Expand All @@ -158,6 +189,14 @@ mAudioPlayer.setOnPreparedListener(this);

### 播放器

* 1.1.4 ([Release Notes][7])
- 发布 pldroid-player-1.1.4.jar
- 更新 libpldroidplayer.so
- 新增播放器全屏播放支持
- 新增纯音频播放 `AVOptions` 支持
- 修复播放过程中,概率性异常地回调 `onCompletion` 问题
- `VideoView` 布局的展示代码

* 1.1.3 ([Release Notes][6])
- 发布 pldroid-player-1.1.3.jar
- 更新 libpldroidplayer.so
Expand Down Expand Up @@ -209,3 +248,4 @@ mAudioPlayer.setOnPreparedListener(this);
[4]: /ReleaseNotes/release-notes-1.1.1.md
[5]: /ReleaseNotes/release-notes-1.1.2.md
[6]: /ReleaseNotes/release-notes-1.1.3.md
[7]: /ReleaseNotes/release-notes-1.1.4.md
18 changes: 18 additions & 0 deletions ReleaseNotes/release-notes-1.1.4.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# PLDroidPlayer Release Notes for 1.1.4

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

## 记录

### 播放器

- 发布 pldroid-player-1.1.4.jar
- 更新 libpldroidplayer.so
- 新增播放器全屏播放支持
- 新增纯音频播放 `AVOptions` 支持
- 修复播放过程中,概率性异常地回调 `onCompletion` 问题

### 播放器 Demo

- `VideoView` 布局的展示代码
Binary file modified releases/arm64-v8a/libpldroidplayer.so
Binary file not shown.
Binary file modified releases/armeabi-v7a/libpldroidplayer.so
Binary file not shown.
Binary file modified releases/armeabi/libpldroidplayer.so
Binary file not shown.
Binary file added releases/pldroid-player-1.1.4.jar
Binary file not shown.
Binary file modified releases/x86/libpldroidplayer.so
Binary file not shown.

0 comments on commit 13a63d5

Please sign in to comment.