Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ It properly syncs audio with video track when using Bluetooth earphones/speaker.
* **Video**: H.263, H.264 AVC (Baseline Profile; Main Profile on Android 6+), H.265 HEVC, MPEG-4 SP, VP8, VP9, AV1
* **Containers**: MP4, MOV, WebM, MKV, Ogg, MPEG-TS, MPEG-PS, FLV, AVI (🚧)
* **Streaming**: DASH, HLS, SmoothStreaming, RTSP
* **Subtitles**: SRT, SSA/ASS ([limited styling](https://github.com/google/ExoPlayer/issues/8435)), TTML, VTT, DVB
* **Subtitles**: SRT, SSA/ASS ([powered by libass-android](https://github.com/peerless2012/libass-android)), TTML, VTT, DVB

HDR (HDR10+ and Dolby Vision) video playback on compatible/supported hardware.

Expand Down
5 changes: 5 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,11 @@ dependencies {
implementation 'androidx.preference:preference:1.2.1'
implementation 'com.squareup.okhttp3:okhttp:5.3.2'
implementation 'com.sigpwned:chardet4j:77.1.0'
implementation('io.github.peerless2012:ass-media:0.4.0') {
exclude group: "androidx.media3", module: "media3-ui"
exclude group: "androidx.media3", module: "media3-extractor"
exclude group: "androidx.media3", module: "media3-exoplayer"
}
implementation project(path: ':doubletapplayerview')
implementation project(path: ':android-file-chooser')
implementation fileTree(dir: "libs", include: ["lib-*.aar"])
Expand Down
16 changes: 15 additions & 1 deletion app/src/main/java/com/brouken/player/PlayerActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@
import androidx.media3.common.TrackSelectionOverride;
import androidx.media3.common.TrackSelectionParameters;
import androidx.media3.common.Tracks;
import androidx.media3.datasource.DataSource;
import androidx.media3.datasource.DefaultDataSource;
import androidx.media3.datasource.DefaultHttpDataSource;
import androidx.media3.exoplayer.DefaultRenderersFactory;
import androidx.media3.exoplayer.ExoPlaybackException;
Expand Down Expand Up @@ -111,6 +113,9 @@
import java.util.Objects;
import java.util.concurrent.TimeUnit;

import io.github.peerless2012.ass.media.kt.AssPlayerKt;
import io.github.peerless2012.ass.media.type.AssRenderType;

public class PlayerActivity extends Activity {

private PlayerListener playerListener;
Expand Down Expand Up @@ -1231,6 +1236,7 @@ public void initializePlayer() {
.setTrackSelector(trackSelector)
.setMediaSourceFactory(new DefaultMediaSourceFactory(this, extractorsFactory));

DataSource.Factory dataSourceFactory = null;
if (haveMedia && isNetworkUri) {
if (mPrefs.mediaUri.getScheme().toLowerCase().startsWith("http")) {
HashMap<String, String> headers = new HashMap<>();
Expand All @@ -1240,11 +1246,19 @@ public void initializePlayer() {
DefaultHttpDataSource.Factory defaultHttpDataSourceFactory = new DefaultHttpDataSource.Factory();
defaultHttpDataSourceFactory.setDefaultRequestProperties(headers);
playerBuilder.setMediaSourceFactory(new DefaultMediaSourceFactory(defaultHttpDataSourceFactory, extractorsFactory));
dataSourceFactory = defaultHttpDataSourceFactory;
}
}
}

player = playerBuilder.build();
player = AssPlayerKt.buildWithAssSupport(
playerBuilder,
this,
AssRenderType.OVERLAY_OPEN_GL,
playerView.getSubtitleView(),
dataSourceFactory != null? dataSourceFactory : new DefaultDataSource.Factory(this),
extractorsFactory,
renderersFactory);

AudioAttributes audioAttributes = new AudioAttributes.Builder()
.setUsage(C.USAGE_MEDIA)
Expand Down