Skip to content

Commit

Permalink
* ijkPlayer的ex_so增加avi支持
Browse files Browse the repository at this point in the history
* update ExoPlayer to 2.8.1
* ExoPlayer模式的问题修复
  • Loading branch information
CarGuoSmall committed Jun 20, 2018
1 parent f7a4153 commit 2842577
Show file tree
Hide file tree
Showing 13 changed files with 61 additions and 10 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,13 @@ IJK编码格式|**[--- 项目支持视频格式(如果遇上黑屏,没声音

## 五、近期版本

### 5.0.1(2018-xx-xx 未发布)
* Update ListGSYVideoPlayer
* ijkPlayer的ex_so增加avi支持
* update ExoPlayer to 2.8.1
* ExoPlayer模式的问题修复


### 5.0.0-beta(2018-05-24)
* 调整cache机制,抽离cache管理器。
* update ExoPlayer to 2.8.0,全面针对ExoPlayer进行优化
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ private String getUrl() {
//String url = "ijkhttphook:https://res.exexm.com/cw_145225549855002";

String url = "http://7xjmzj.com1.z0.glb.clouddn.com/20171026175005_JObCxCE2.mp4";
//String url = "http://223.110.243.138/PLTV/2510088/224/3221227177/index.m3u8";
//String url = "http://qiniu.carmmi.com/image/132451525666042.mp4";
//String url = "http://ucp.wn.sunmath.cn/file-upload/gYQJHxK9iNQKJeWyS/V80418-103803.mp4?rc_uid=7sCFCGoaF2iTc9vH9&rc_token=prJK-xGutKmy2LDQO-OZASjob0o1u_s3e5SgMHmgjtn";
//String url = "http://7xse1z.com1.z0.glb.clouddn.com/1491813192";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public void onCreate() {
//GSYVideoType.enableMediaCodecTexture();

//GSYVideoManager.instance().setVideoType(this, GSYVideoType.IJKEXOPLAYER); //EXO 1 播放内核,弃用
//GSYVideoManager.instance().setVideoType(this, GSYVideoType.IJKEXOPLAYER2); //EXO 2 播放内核
GSYVideoManager.instance().setVideoType(this, GSYVideoType.IJKEXOPLAYER2); //EXO 2 播放内核
//GSYVideoManager.instance().setVideoType(this, GSYVideoType.SYSTEMPLAYER); //系统播放器

//GSYVideoType.setShowType(GSYVideoType.SCREEN_MATCH_FULL);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,4 +228,8 @@ public int getVideoSarDen() {
return 1;
}

@Override
public boolean isSurfaceSupportLockCanvas() {
return false;
}
}
2 changes: 1 addition & 1 deletion dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ ext {

gsyVideoVersion = '5.0.0-beta'

exo_player2 = '2.8.0'
exo_player2 = '2.8.1'

permissionsdispatcher = '3.2.0'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.shuyu.gsyvideoplayer;

import android.content.Context;
import android.content.Intent;
import android.media.MediaPlayer;
import android.os.Handler;
import android.os.HandlerThread;
Expand Down Expand Up @@ -533,6 +534,15 @@ public int getRotateInfoFlag() {
return IMediaPlayer.MEDIA_INFO_VIDEO_ROTATION_CHANGED;
}


@Override
public boolean isSurfaceSupportLockCanvas() {
if (playerManager != null) {
return playerManager.isSurfaceSupportLockCanvas();
}
return false;
}

protected void sendMessage(Message message) {
mMediaHandler.sendMessage(message);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,4 +227,8 @@ public int getVideoSarDen() {
return 1;
}

@Override
public boolean isSurfaceSupportLockCanvas() {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ public interface IPlayerManager {
*/
void setSpeedPlaying(float speed, boolean soundTouch);

/**
* Surface是否支持外部lockCanvas,来自定义暂停时的绘制画面
* exoplayer目前不支持,因为外部lock后,切换surface会导致异常
*/
boolean isSurfaceSupportLockCanvas();

void setSpeed(float speed, boolean soundTouch);

void start();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,12 @@ public int getVideoSarDen() {
return 1;
}


@Override
public boolean isSurfaceSupportLockCanvas() {
return true;
}

private void initIJKOption(IjkMediaPlayer ijkMediaPlayer, List<VideoOptionModel> optionModelList) {
if (optionModelList != null && optionModelList.size() > 0) {
for (VideoOptionModel videoOptionModel : optionModelList) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,10 @@ public int getVideoSarDen() {
return 1;
}

@Override
public boolean isSurfaceSupportLockCanvas() {
return false;
}

private void setSpeed(float speed) {
if (release) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,15 +177,17 @@ protected void showPauseCover() {
if (mCurrentState == CURRENT_STATE_PAUSE && mFullPauseBitmap != null
&& !mFullPauseBitmap.isRecycled() && mShowPauseCover
&& mSurface != null && mSurface.isValid()) {
try {
RectF rectF = new RectF(0, 0, mTextureView.getWidth(), mTextureView.getHeight());
Canvas canvas = mSurface.lockCanvas(new Rect(0, 0, mTextureView.getWidth(), mTextureView.getHeight()));
if (canvas != null) {
canvas.drawBitmap(mFullPauseBitmap, null, rectF, null);
mSurface.unlockCanvasAndPost(canvas);
if (getGSYVideoManager().isSurfaceSupportLockCanvas()) {
try {
RectF rectF = new RectF(0, 0, mTextureView.getWidth(), mTextureView.getHeight());
Canvas canvas = mSurface.lockCanvas(new Rect(0, 0, mTextureView.getWidth(), mTextureView.getHeight()));
if (canvas != null) {
canvas.drawBitmap(mFullPauseBitmap, null, rectF, null);
mSurface.unlockCanvasAndPost(canvas);
}
} catch (Exception e) {
e.printStackTrace();
}
} catch (Exception e) {
e.printStackTrace();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,10 @@ public interface GSYVideoViewBridge {
int getVideoSarNum();

int getVideoSarDen();

/**
* Surface是否支持外部lockCanvas,来自定义暂停时的绘制画面
* exoplayer目前不支持,因为外部lock后,切换surface会导致异常
*/
boolean isSurfaceSupportLockCanvas();
}
1 change: 1 addition & 0 deletions module-lite-more.sh
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-demuxer=webm_dash_mani
export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-demuxer=mpeg4"
export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-demuxer=rtsp"
export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-demuxer=mjpeg"
export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-demuxer=avi"

# ./configure --list-parsers
export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-parsers"
Expand Down

0 comments on commit 2842577

Please sign in to comment.