Skip to content

Commit

Permalink
publish 3.3.7
Browse files Browse the repository at this point in the history
  • Loading branch information
jiajunhui committed Aug 4, 2020
1 parent a1f1ec0 commit bb2bf19
Show file tree
Hide file tree
Showing 10 changed files with 50 additions and 22 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,18 +82,18 @@ demo示例集成了播放控制组件**ControllerCover**、加载中组件**Load
dependencies {
//---------如果仅使用MediaPlayer解码,使用以下依赖。----------
//该依赖仅包含MediaPlayer解码
implementation 'com.kk.taurus.playerbase:playerbase:3.3.6'
implementation 'com.kk.taurus.playerbase:playerbase:3.3.7'
//---------如果使用ExoPlayer解码,使用以下依赖。---------
//该依赖包含exoplayer解码和MediaPlayer解码
//注意exoplayer的最小支持SDK版本为16
implementation 'cn.jiajunhui:exoplayer:336_2111_011'
implementation 'cn.jiajunhui:exoplayer:337_2117_012'
//---------如果使用ijkPlayer解码,使用以下依赖。---------
//该依赖包含ijkplayer解码和MediaPlayer解码
implementation 'cn.jiajunhui:ijkplayer:336_088_007'
implementation 'cn.jiajunhui:ijkplayer:337_088_008'
//ijk官方的解码库依赖,较少格式版本且不支持HTTPS。
implementation 'tv.danmaku.ijk.media:ijkplayer-armv7a:0.8.8'
# Other ABIs: optional
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
import com.kk.taurus.playerbase.event.OnErrorEventListener;
import com.kk.taurus.playerbase.event.OnPlayerEventListener;

/**
* 音乐播放示例
*/
public class MusicPlayActivity extends AppCompatActivity implements OnPlayerEventListener {

private AVPlayer mPlayer;
Expand Down Expand Up @@ -57,16 +60,12 @@ public void onErrorEvent(int eventCode, Bundle bundle) {
});

initMusicWave();
updateVisualizer();
}

@Override
public void onPlayerEvent(int eventCode, Bundle bundle) {
switch (eventCode){
case OnPlayerEventListener.PLAYER_EVENT_ON_PREPARED:
releaseVisualizer();
updateVisualizer();
break;
}

}

private void initMusicWave() {
Expand Down
5 changes: 4 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ project.ext {
ijksdkVersion = '0.8.8',
exoplayersdkVersion = '2.11.7',
appcompatVersion = '1.1.0',
playerbaseVersion = '3.3.6'

playerbaseIjkVersion = '337_088_008',
playerbaseExoVersion = '337_2117_012',
playerbaseVersion = '3.3.7'
]

}
2 changes: 1 addition & 1 deletion exoplayer/bintray.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'com.jfrog.bintray'

// 这个version是区分library版本的,因此当我们需要更新library时记得修改这个version
version = "336_2111_011"
version = rootProject.ext.playerbaseExoVersion

def siteUrl = 'https://github.com/jiajunhui/PlayerBase' // 项目的主页
def gitUrl = 'https://github.com/jiajunhui/PlayerBase.git' // Git仓库的url
Expand Down
4 changes: 2 additions & 2 deletions exoplayer/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ dependencies {
api "com.google.android.exoplayer:exoplayer-dash:$exoplayersdkVersion"
api "com.google.android.exoplayer:exoplayer-hls:$exoplayersdkVersion"
api "com.google.android.exoplayer:exoplayer-smoothstreaming:$exoplayersdkVersion"
// api "com.kk.taurus.playerbase:playerbase:$playerbaseVersion"
api project(':playerbase')
api "com.kk.taurus.playerbase:playerbase:$playerbaseVersion"
// api project(':playerbase')
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import com.google.android.exoplayer2.source.ExtractorMediaSource;
import com.google.android.exoplayer2.source.MediaSource;
import com.google.android.exoplayer2.source.MergingMediaSource;
import com.google.android.exoplayer2.source.ProgressiveMediaSource;
import com.google.android.exoplayer2.source.SingleSampleMediaSource;
import com.google.android.exoplayer2.source.TrackGroupArray;
import com.google.android.exoplayer2.source.dash.DashMediaSource;
Expand Down Expand Up @@ -210,7 +211,7 @@ private MediaSource getMediaSource(Uri uri, com.google.android.exoplayer2.upstre
case C.TYPE_OTHER:
default:
// This is the MediaSource representing the media to be played.
return new ExtractorMediaSource.Factory(dataSourceFactory).createMediaSource(uri);
return new ProgressiveMediaSource.Factory(dataSourceFactory).createMediaSource(uri);
}
}

Expand Down Expand Up @@ -482,17 +483,23 @@ public void onPlayerError(ExoPlaybackException error) {
submitErrorEvent(OnErrorEventListener.ERROR_EVENT_UNKNOWN, null);
return;
}
PLog.e(TAG,error.getMessage()==null?"":error.getMessage());
String errorMessage = error.getMessage()==null?"":error.getMessage();
Throwable cause = error.getCause();
String causeMessage = cause!=null?cause.getMessage():"";
PLog.e(TAG,errorMessage + ", causeMessage = " + causeMessage);
Bundle bundle = BundlePool.obtain();
bundle.putString("errorMessage", errorMessage);
bundle.putString("causeMessage", causeMessage);
int type = error.type;
switch (type){
case ExoPlaybackException.TYPE_SOURCE:
submitErrorEvent(OnErrorEventListener.ERROR_EVENT_IO, null);
submitErrorEvent(OnErrorEventListener.ERROR_EVENT_IO, bundle);
break;
case ExoPlaybackException.TYPE_RENDERER:
submitErrorEvent(OnErrorEventListener.ERROR_EVENT_COMMON, null);
submitErrorEvent(OnErrorEventListener.ERROR_EVENT_COMMON, bundle);
break;
case ExoPlaybackException.TYPE_UNEXPECTED:
submitErrorEvent(OnErrorEventListener.ERROR_EVENT_UNKNOWN, null);
submitErrorEvent(OnErrorEventListener.ERROR_EVENT_UNKNOWN, bundle);
break;
}
}
Expand Down
2 changes: 1 addition & 1 deletion ijkplayer/bintray.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'com.jfrog.bintray'

// 这个version是区分library版本的,因此当我们需要更新library时记得修改这个version
version = "336_088_007"
version = rootProject.ext.playerbaseIjkVersion

def siteUrl = 'https://github.com/jiajunhui/PlayerBase' // 项目的主页
def gitUrl = 'https://github.com/jiajunhui/PlayerBase.git' // Git仓库的url
Expand Down
4 changes: 2 additions & 2 deletions ijkplayer/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')

api "tv.danmaku.ijk.media:ijkplayer-java:$ijksdkVersion"
// api "com.kk.taurus.playerbase:playerbase:$playerbaseVersion"
api project(':playerbase')
api "com.kk.taurus.playerbase:playerbase:$playerbaseVersion"
// api project(':playerbase')
}
19 changes: 19 additions & 0 deletions ijkplayer/src/main/java/com/kk/taurus/ijkplayer/IjkPlayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import com.kk.taurus.playerbase.player.BaseInternalPlayer;

import java.util.HashMap;
import java.util.Set;

import tv.danmaku.ijk.media.player.IMediaPlayer;
import tv.danmaku.ijk.media.player.IjkMediaPlayer;
Expand Down Expand Up @@ -62,6 +63,24 @@ public IjkPlayer() {
IjkMediaPlayer.native_profileBegin("libijkplayer.so");
}

/**
* ijkplayer的配置项设置
* ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "mediacodec", 1);
*
* @param code 对应setOption方法的第一个参数
* @param bundle 对应第二个和第三个参数,key为配置项的名称,比如mediacodec,value为对应的配置值(long类型)
*/
@Override
public void option(int code, Bundle bundle) {
super.option(code, bundle);
if(bundle!=null){
Set<String> keySet = bundle.keySet();
for(String key : keySet){
mMediaPlayer.setOption(code, key, bundle.getLong(key));
}
}
}

protected IjkMediaPlayer createPlayer(){
IjkMediaPlayer ijkMediaPlayer = new IjkMediaPlayer();
// ijkMediaPlayer.native_setLogLevel(IjkMediaPlayer.IJK_LOG_DEBUG);
Expand Down
2 changes: 1 addition & 1 deletion playerbase/bintray.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'com.jfrog.bintray'

// 这个version是区分library版本的,因此当我们需要更新library时记得修改这个version
version = "3.3.6"
version = rootProject.ext.playerbaseVersion

def siteUrl = 'https://github.com/jiajunhui/PlayerBase' // 项目的主页
def gitUrl = 'https://github.com/jiajunhui/PlayerBase.git' // Git仓库的url
Expand Down

0 comments on commit bb2bf19

Please sign in to comment.