QQ exchange group: 611902811, interested can exchange

IJKPlayer-android

Advantages: The extraction of iJkPlayer removes several irrelevant variables and methods from the ijkVideoView.java class, otherwise identical to iJkPlayer itself. In this way, iJkPlayer can be copied directly after upgrade without any changes.

Upgrade the EXOplayer module in ijkPlayer that has been in version R1.x. x to version R.2.X. x. In addition, I have added RTMP, RTSP support, playback rate and so on to iJkplayer-exo2. If you want to add more, please refer to EXOplayer to add it. In addition, the global suspension window and page suspension window are implemented.

rendering

2021/05/20

Added TextureView support for zooming, rotation, and panning Optimized playback logic, clearer code;

2018/09/04

Added subtitle display, support ass, SRT, STL format

1. Since there is no corresponding video, the subtitles are only displayed according to the time after parsing

If you can’t download it, you can find it below

2. The subtitle file must be in utf-8 format, otherwise it will not be parsed. You can use NotePad++ to convert the format

Download the Demo

Start by opening /Bilibili/ijkplayer and using git

git clone https://github.com/Bilibili/ijkplayer.git
Copy the code

Then create a new Module in your existing project, as shown below:



Then copy the files we need from the Bilibili/ ijkPlayer project, as shown below:



Don’t forget to rely on the required dependencies in your Module’s build.gradle

The compile 'TV. Danmaku. Ijk. Media: ijkplayer - Java: 0.8.4' compile 'TV. Danmaku. Ijk. Media: ijkplayer - armv7a: 0.8.4' compile 'TV. Danmaku. Ijk. Media: ijkplayer - exobiology: 0.8.4'Copy the code

If you want to support EXOplayer R2.x. x version dependency

The compile 'org. Dync. Kathline: ijkplayer - exo2:0.8.4' / / a conflict can use the following to remove duplicate the compile (' org. Dync. Kathline: ijkplayer - exo2:0.8.4 ') { exclude group: 'tv.danmaku.ijk.media', module: 'ijkplayer-java' }Copy the code



Once we’re done, the iJkVideoView.java file will fail, but all we need to do is delete the variables and methods that failed, and once we’ve done that, we’ll start playing.

In addition, we can add several additional methods to iJkVideoView.java. Here I offer mine:

/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / additional methods / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / * * * reference {@ the link Renderview #AR_ASPECT_FIT_PARENT}, {@link IRenderView#AR_ASPECT_FILL_PARENT}, {@link IRenderView#AR_ASPECT_WRAP_CONTENT} * {@link IRenderView#AR_16_9_FIT_PARENT}, {@link IRenderView#AR_4_3_FIT_PARENT} * set the playzone stretch type */ public void setAspectRatio(int aspectRatio) { for (int i = 0; i < s_allAspectRatio.length; i++) { if (s_allAspectRatio[i] == aspectRatio) { mCurrentAspectRatioIndex = i; if (mRenderView ! = null) { mRenderView.setAspectRatio(mCurrentAspectRatio); } break; Public void setPlayerRotation(int rotation) {mVideoRotationDegree = rotation; if (mRenderView ! = null) { mRenderView.setVideoRotation(mVideoRotationDegree); }} /** * Set the playback rate, Public void setPlayRate(@floatRange (from=0.2, To =2.0)float rate) {if(mMediaPlayer instanceof IjkMediaPlayer){((IjkMediaPlayer)mMediaPlayer).setSpeed(rate); }else { Toast.makeText(getContext(), getResources().getString(R.string.TrackType_unknown), Toast.LENGTH_SHORT).show(); }}Copy the code

SetPlayRate () requires the following code to be set in createPlayer() :

ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "soundtouch", 1);
Copy the code

The tone will not change under android6.0 if you set it to double speed