Skip to content

Commit

Permalink
1.升级ijkplayer至0.8.8
Browse files Browse the repository at this point in the history
2.抖音demo
  • Loading branch information
Doikki committed Apr 2, 2018
1 parent 969e180 commit 37eec8f
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 14 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ A video player based on [IjkPlayer](https://github.com/Bilibili/ijkplayer).
* **支持悬浮窗播放。**
* **支持广告播放。**
* **支持弹幕,使用了[DanmakuFlameMaster](https://github.com/Bilibili/DanmakuFlameMaster)**
* **抖音demo。**

[demo下载](https://fir.im/1r3u)
## 使用
Expand All @@ -40,7 +41,7 @@ Step 1.Add it in your root build.gradle at the end of repositories:
Step 2. Add the dependency
dependencies {
compile 'com.github.dueeeke:dkplayer:1.4.3'
compile 'com.github.dueeeke:dkplayer:1.5'
}
```
或者将library下载并导入项目中使用
Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ android {
applicationId "com.dueeeke.dkplayer"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 11
versionName "1.4.3"
versionCode 12
versionName "1.5"
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
setStatusBarTransparent();

mIjkVideoView = new IjkVideoView(this);
mIjkVideoView.enableMediaCodec();
mIjkVideoView.setScreenScale(IjkVideoView.SCREEN_SCALE_MATCH_PARENT);
mIjkVideoView.setLooping();
mDouYinController = new DouYinController(this);
mIjkVideoView.setVideoController(mDouYinController);
mVerticalViewPager = findViewById(R.id.vvp);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.dueeeke.dkplayer.R;
import com.dueeeke.videoplayer.controller.BaseVideoController;
import com.dueeeke.videoplayer.player.IjkVideoView;
import com.dueeeke.videoplayer.util.L;

/**
* 抖音
Expand Down Expand Up @@ -48,15 +49,15 @@ public void setPlayState(int playState) {

switch (playState) {
case IjkVideoView.STATE_IDLE:
L.e("STATE_IDLE");
thumb.setVisibility(VISIBLE);
break;
case IjkVideoView.STATE_PLAYING:
postDelayed(new Runnable() {
@Override
public void run() {
thumb.setVisibility(GONE);
}
}, 400);
L.e("STATE_PLAYING");
thumb.setVisibility(GONE);
break;
case IjkVideoView.STATE_PREPARED:
L.e("STATE_PREPARED");
break;
}
}
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/layout/item_douyin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<ImageView
android:id="@+id/thumb"
android:layout_width="match_parent"
android:layout_height="match_parent" />
android:layout_height="match_parent"
android:scaleType="fitXY"/>

</FrameLayout>
4 changes: 2 additions & 2 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ android {
defaultConfig {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 11
versionName "1.4.3"
versionCode 12
versionName "1.5"
}

sourceSets {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,6 @@ public void onPrepared() {
if (mCurrentPosition > 0) {
seekTo(mCurrentPosition);
}
start();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,12 @@ public boolean isFullScreen() {
return isFullScreen;
}

@Override
public void onPrepared() {
super.onPrepared();
if (useAndroidMediaPlayer) mMediaPlayer.start();
}

@Override
public void onError() {
super.onError();
Expand Down

0 comments on commit 37eec8f

Please sign in to comment.