Skip to content

Commit 640f650

Browse files
committed
修复EXO起播时画面旋转闪屏问题,升级exo-core,完善错误事件
1 parent 4f1c0a4 commit 640f650

File tree

6 files changed

+18
-15
lines changed

6 files changed

+18
-15
lines changed

app/src/main/java/com/kk/taurus/avplayer/bean/SettingItem.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ public class SettingItem {
3636
public static final int CODE_CONTROLLER_RESET = 701;
3737

3838
public static final int CODE_TEST_UPDATE_RENDER = 801;
39+
public static final int CODE_TEST_RENDER_ROTATION = 802;
3940

4041
private String itemText;
4142
private int code;
@@ -96,6 +97,7 @@ public static List<SettingItem> initSettingList(){
9697
items.add(new SettingItem("恢复Controller组件",CODE_CONTROLLER_RESET));
9798

9899
items.add(new SettingItem("刷新Render",CODE_TEST_UPDATE_RENDER));
100+
items.add(new SettingItem("画面旋转",CODE_TEST_RENDER_ROTATION));
99101

100102
return items;
101103
}

app/src/main/java/com/kk/taurus/avplayer/ui/BaseVideoViewActivity.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ public class BaseVideoViewActivity extends AppCompatActivity implements
5555
private float mVolumeLeft = 0.5f;
5656
private float mVolumeRight = 0.5f;
5757

58+
private int mRotation;
59+
5860
@Override
5961
protected void onCreate(@Nullable Bundle savedInstanceState) {
6062
super.onCreate(savedInstanceState);
@@ -256,6 +258,10 @@ public void onItemClick(SettingAdapter.SettingItemHolder holder, SettingItem ite
256258
case SettingItem.CODE_TEST_UPDATE_RENDER:
257259
mVideoView.updateRender();
258260
break;
261+
case SettingItem.CODE_TEST_RENDER_ROTATION:
262+
mRotation += 90;
263+
mVideoView.getRender().setVideoRotation(mRotation%360);
264+
break;
259265
}
260266
}
261267

build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ project.ext {
3737
lib = [
3838
//module versions
3939
ijksdkVersion = '0.8.8',
40-
exoplayersdkVersion = '2.12.0',
40+
exoplayersdkVersion = '2.12.2',
4141
appcompatVersion = '1.2.0',
4242

43-
playerbaseIjkVersion = '340_088_011',
44-
playerbaseExoVersion = '340_2120_016',
45-
playerbaseVersion = '3.4.0'
43+
playerbaseIjkVersion = '341_088_012',
44+
playerbaseExoVersion = '341_2122_017',
45+
playerbaseVersion = '3.4.1'
4646
]
4747

4848
}

exoplayer/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,6 @@ dependencies {
3434
api "com.google.android.exoplayer:exoplayer-dash:$exoplayersdkVersion"
3535
api "com.google.android.exoplayer:exoplayer-hls:$exoplayersdkVersion"
3636
api "com.google.android.exoplayer:exoplayer-smoothstreaming:$exoplayersdkVersion"
37-
// api "com.kk.taurus.playerbase:playerbase:$playerbaseVersion"
38-
api project(':playerbase')
37+
api "com.kk.taurus.playerbase:playerbase:$playerbaseVersion"
38+
// api project(':playerbase')
3939
}

exoplayer/src/main/java/com/kk/taurus/exoplayer/ExoMediaPlayer.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,7 @@ private boolean isInPlaybackState(){
376376
@Override
377377
public void onVideoSizeChanged(int width, int height,
378378
int unappliedRotationDegrees, float pixelWidthHeightRatio) {
379+
PLog.d(TAG, "onVideoSizeChanged : width = " + width + ", height = " + height + ", rotation = " + unappliedRotationDegrees);
379380
mVideoWidth = width;
380381
mVideoHeight = height;
381382
Bundle bundle = BundlePool.obtain();
@@ -417,14 +418,8 @@ public void onPlaybackStateChanged(int playbackState) {
417418
switch (playbackState){
418419
case Player.STATE_READY:
419420
isPreparing = false;
420-
Format format = mInternalPlayer.getVideoFormat();
421-
Bundle bundle = BundlePool.obtain();
422-
if(format!=null){
423-
bundle.putInt(EventKey.INT_ARG1, format.width);
424-
bundle.putInt(EventKey.INT_ARG2, format.height);
425-
}
426421
updateStatus(IPlayer.STATE_PREPARED);
427-
submitPlayerEvent(OnPlayerEventListener.PLAYER_EVENT_ON_PREPARED, bundle);
422+
submitPlayerEvent(OnPlayerEventListener.PLAYER_EVENT_ON_PREPARED, null);
428423

429424
if(mStartPos > 0 && mInternalPlayer.getDuration() > 0){
430425
mInternalPlayer.seekTo(mStartPos);

ijkplayer/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@ dependencies {
3131
implementation fileTree(include: ['*.jar'], dir: 'libs')
3232

3333
api "tv.danmaku.ijk.media:ijkplayer-java:$ijksdkVersion"
34-
// api "com.kk.taurus.playerbase:playerbase:$playerbaseVersion"
35-
api project(':playerbase')
34+
api "com.kk.taurus.playerbase:playerbase:$playerbaseVersion"
35+
// api project(':playerbase')
3636
}

0 commit comments

Comments
 (0)