Skip to content

Commit

Permalink
增加exo解码能力,解决部分视频exo,ijk解码都是有声音没图像的问题,引入的第三方库要求最低5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
muziling committed Apr 3, 2024
1 parent 9ed0846 commit 083b265
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 42 deletions.
8 changes: 6 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ android {

defaultConfig {
applicationId 'com.github.tvbox.osc.tk'
minSdkVersion 19
minSdkVersion 21
targetSdkVersion 29
versionCode 1
versionName "1.0.".concat(buildTime())
Expand Down Expand Up @@ -102,14 +102,18 @@ dependencies {
implementation 'org.greenrobot:eventbus:3.3.1'
implementation 'com.orhanobut:hawk:2.0.1'
implementation 'net.sourceforge.streamsupport:android-retrofuture:1.7.4'
implementation 'androidx.annotation:annotation:1.6.0'
// implementation 'androidx.annotation:annotation:1.6.0'
implementation "androidx.media3:media3-exoplayer:1.1.1"
implementation "androidx.media3:media3-ui:1.1.1"
implementation "androidx.media3:media3-datasource:1.1.1"
implementation "androidx.media3:media3-exoplayer-dash:1.1.1"
implementation "androidx.media3:media3-exoplayer-hls:1.1.1"
implementation "androidx.media3:media3-exoplayer-rtsp:1.1.1"
implementation "androidx.media3:media3-datasource-rtmp:1.1.1"
implementation 'androidx.media3:media3-common:1.1.1'
implementation "com.github.anilbeesetti.nextlib:nextlib-media3ext:0.5.0" // To add media3 software decoders and extensions
//implementation "com.github.anilbeesetti.nextlib:nextlib-mediainfo:0.5.0" // To get media info through ffmpeg


implementation "com.aliyun.sdk.android:AliyunPlayer:5.5.2.0-full"
implementation 'com.alivc.conan:AlivcConan:0.9.5'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@
import androidx.media3.exoplayer.DefaultRenderersFactory;
import androidx.media3.exoplayer.ExoPlayer;
import androidx.media3.exoplayer.LoadControl;
import androidx.media3.exoplayer.source.DefaultMediaSourceFactory;
import androidx.media3.exoplayer.source.MediaSource;
import androidx.media3.exoplayer.trackselection.DefaultTrackSelector;
import androidx.media3.exoplayer.trackselection.TrackSelectionArray;
import androidx.media3.extractor.ExtractorsFactory;
import androidx.media3.ui.PlayerView;

import com.github.tvbox.osc.base.App;
Expand All @@ -33,6 +35,7 @@
import java.util.Locale;
import java.util.Map;

import io.github.anilbeesetti.nextlib.media3ext.ffdecoder.NextRenderersFactory;
import xyz.doikki.videoplayer.player.AbstractPlayer;
import xyz.doikki.videoplayer.util.PlayerUtils;

Expand Down Expand Up @@ -66,7 +69,7 @@ public ExoMediaPlayer(Context context) {
@Override
public void initPlayer() {
if (mRenderersFactory == null) {
mRenderersFactory = new DefaultRenderersFactory(mAppContext);
mRenderersFactory = new NextRenderersFactory(mAppContext);
}
//https://github.com/androidx/media/blob/release/libraries/decoder_ffmpeg/README.md
if ("MiTV-MFTR0".equals(Build.MODEL)) {
Expand All @@ -93,6 +96,7 @@ public void initPlayer() {
mMediaPlayer = new ExoPlayer.Builder(mAppContext)
.setLoadControl(mLoadControl)
.setRenderersFactory(mRenderersFactory)
.setMediaSourceFactory(new DefaultMediaSourceFactory(mAppContext, ExtractorsFactory.EMPTY))
.setTrackSelector(mTrackSelector).build();

setOptions();
Expand Down

This file was deleted.

4 changes: 2 additions & 2 deletions quickjs/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ android {
compileSdk 33

defaultConfig {
minSdk 18
targetSdk 28
minSdk 21
targetSdk 29
}
}

Expand Down

0 comments on commit 083b265

Please sign in to comment.