Skip to content

Commit

Permalink
Remove FFmpeg dependency
Browse files Browse the repository at this point in the history
* Custom frame rate detection
* No chapter detection
  • Loading branch information
moneytoo committed Dec 21, 2024
1 parent 171a2a8 commit c5f80c8
Show file tree
Hide file tree
Showing 9 changed files with 82 additions and 179 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/android-build-apk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- uses: softprops/action-gh-release@v2
with:
files: |
app/build/outputs/apk/latestUniversalFull/release/*.apk
app/build/outputs/apk/legacyUniversalFull/release/*.apk
app/build/outputs/apk/latestUniversal/release/*.apk
app/build/outputs/apk/legacyUniversal/release/*.apk
prerelease: true
draft: true
6 changes: 0 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,6 @@ If your device has a touchscreen you can use the pinch-to-zoom gesture or just t

Just pause and resume playback once again.

### Why is the APK so big?

The APK available here contains native libraries for all supported architectures (`armeabi-v7a`/`armeabi-v7a-neon`/`arm64-v8a`/`x86`/`x86_64`), which is what takes the most space. Although Just Player relies mostly on device decoders, it packs _FFmpeg_ for some advanced features (video chapters and frame rate detection).

Please note that installs and updates made through Google Play are significantly smaller thanks to Android App Bundles and delta updates.

## Other open source Android video players

Here's a comparison table presenting all available and significant open source video players for Android I was able to find. Just Player is something like ~~80%~~ 90% feature complete. It will probably never have dozens of options or some rich media library UI. It will never truly compete with feature rich VLC. It just attempts to provide functional feature set and motive others to create greater players based on amazing ExoPlayer.
Expand Down
22 changes: 4 additions & 18 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ android {
//proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
flavorDimensions "targetSdk", "distribution", "feature"
flavorDimensions "targetSdk", "distribution"
productFlavors {
latest {
dimension "targetSdk"
Expand All @@ -50,38 +50,25 @@ android {
accrescent {
dimension "distribution"
}
full {
dimension "feature"
}
lite {
dimension "feature"
versionNameSuffix "-lite"
}
}
variantFilter { variant ->
def names = variant.flavors*.name
if ((names.contains("legacy") || names.contains("lite")) && (names.contains("amazon") || names.contains("accrescent"))) {
if (names.contains("legacy") && (names.contains("amazon") || names.contains("accrescent"))) {
setIgnore(true)
}
}
applicationVariants.all { variant ->
if (variant.buildType.name == "release" && variant.flavorName == "latestUniversalFull") {
if (variant.buildType.name == "release" && variant.flavorName == "latestUniversal") {
variant.outputs.all { output ->
output.outputFileName = "${archivesBaseName}.apk"
}
}
if (variant.buildType.name == "release" && variant.flavorName == "legacyUniversalFull") {
if (variant.buildType.name == "release" && variant.flavorName == "legacyUniversal") {
variant.outputs.all { output ->
output.outputFileName = "${archivesBaseName}-legacy.apk"
}
}
}
androidComponents {
onVariants(selector().withFlavor("distribution", "amazon"), {
packaging.dex.useLegacyPackaging.set(false)
packaging.jniLibs.excludes.add('lib/armeabi-v7a/*_neon.so')
})
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
Expand Down Expand Up @@ -117,7 +104,6 @@ dependencies {
implementation 'com.google.android.material:material:1.12.0'
implementation 'androidx.coordinatorlayout:coordinatorlayout:1.2.0'
implementation "androidx.core:core:$androidxCoreVersion"
fullImplementation 'com.arthenica:ffmpeg-kit-https:6.0-2.LTS'
implementation 'androidx.appcompat:appcompat:1.7.0'
implementation 'androidx.preference:preference:1.2.1'
implementation 'com.squareup.okhttp3:okhttp:4.12.0'
Expand Down
106 changes: 0 additions & 106 deletions app/src/full/java/com/brouken/player/UtilsFeature.java

This file was deleted.

14 changes: 0 additions & 14 deletions app/src/lite/java/com/brouken/player/UtilsFeature.java

This file was deleted.

7 changes: 0 additions & 7 deletions app/src/main/java/com/brouken/player/CustomPlayerView.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import android.os.Build;
import android.util.AttributeSet;
import android.view.GestureDetector;
import android.view.HapticFeedbackConstants;
import android.view.MotionEvent;
import android.view.ScaleGestureDetector;
import android.view.View;
Expand Down Expand Up @@ -258,12 +257,6 @@ public boolean onScroll(MotionEvent motionEvent, MotionEvent motionEvent1, float
PlayerActivity.player.seekTo(position);
}
}
for (long start : PlayerActivity.chapterStarts) {
if ((seekLastPosition < start && position >= start) || (seekLastPosition > start && position <= start)) {
performHapticFeedback(HapticFeedbackConstants.CLOCK_TICK);
}
}
seekLastPosition = position;
String message = Utils.formatMilisSign(seekChange);
if (!isControllerFullyVisible()) {
message += "\n" + Utils.formatMilis(position);
Expand Down
26 changes: 1 addition & 25 deletions app/src/main/java/com/brouken/player/PlayerActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
import android.util.DisplayMetrics;
import android.util.Rational;
import android.util.TypedValue;
import android.view.HapticFeedbackConstants;
import android.view.InputDevice;
import android.view.KeyEvent;
import android.view.MotionEvent;
Expand Down Expand Up @@ -183,9 +182,6 @@ public class PlayerActivity extends Activity {
public static boolean locked = false;
private Thread nextUriThread;
public Thread frameRateSwitchThread;
public Thread chaptersThread;
private long lastScrubbingPosition;
public static long[] chapterStarts;

public static boolean restoreControllerTimeout = false;
public static boolean shortControllerTimeout = false;
Expand Down Expand Up @@ -351,7 +347,6 @@ public void onScrubStart(TimeBar timeBar, long position) {
if (restorePlayState) {
player.pause();
}
lastScrubbingPosition = position;
scrubbingNoticeable = false;
isScrubbing = true;
frameRendered = true;
Expand All @@ -364,12 +359,6 @@ public void onScrubStart(TimeBar timeBar, long position) {
@Override
public void onScrubMove(TimeBar timeBar, long position) {
reportScrubbing(position);
for (long start : chapterStarts) {
if ((lastScrubbingPosition < start && position >= start) || (lastScrubbingPosition > start && position <= start)) {
playerView.performHapticFeedback(HapticFeedbackConstants.CLOCK_TICK);
}
}
lastScrubbingPosition = position;
}

@Override
Expand Down Expand Up @@ -1256,8 +1245,6 @@ public void initializePlayer() {

locked = false;

chapterStarts = new long[0];

if (haveMedia) {
if (isNetworkUri) {
timeBar.setBufferedColor(DefaultTimeBar.DEFAULT_BUFFERED_COLOR);
Expand Down Expand Up @@ -1343,8 +1330,6 @@ public void initializePlayer() {
nextUriThread.start();
}

UtilsFeature.markChapters(this, mPrefs.mediaUri, controlView);

player.setHandleAudioBecomingNoisy(!isTvBox);
// mediaSession.setActive(true);
} else {
Expand Down Expand Up @@ -1464,15 +1449,6 @@ public void onPlaybackStateChanged(int state) {
final long position = player.getCurrentPosition();
if (position + 4000 >= duration) {
isNearEnd = true;
} else {
// Last chapter is probably "Credits" chapter
final int chapters = chapterStarts.length;
if (chapters > 1) {
final long lastChapter = chapterStarts[chapters - 1];
if (duration - lastChapter < duration / 10 && position > lastChapter) {
isNearEnd = true;
}
}
}
}
setEndControlsVisible(haveMedia && (state == Player.STATE_ENDED || isNearEnd));
Expand Down Expand Up @@ -1544,7 +1520,7 @@ public void onDisplayChanged(int displayId) {
}
displayManager.registerDisplayListener(displayListener, null);
}
switched = UtilsFeature.switchFrameRate(PlayerActivity.this, mPrefs.mediaUri, play);
switched = Utils.switchFrameRate(PlayerActivity.this, mPrefs.mediaUri, play);
}
if (!switched) {
if (displayManager != null) {
Expand Down
1 change: 0 additions & 1 deletion app/src/main/java/com/brouken/player/SettingsActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
}
Preference preferenceFrameRateMatching = findPreference("frameRateMatching");
if (preferenceFrameRateMatching != null) {
preferenceFrameRateMatching.setVisible(BuildConfig.FLAVOR_feature.equals("full"));
preferenceFrameRateMatching.setEnabled(Build.VERSION.SDK_INT >= 23);
}
ListPreference listPreferenceFileAccess = findPreference("fileAccess");
Expand Down
Loading

0 comments on commit c5f80c8

Please sign in to comment.