Skip to content

Commit

Permalink
Enable constant bitrate seeking
Browse files Browse the repository at this point in the history
  • Loading branch information
nielsvanvelzen committed Aug 13, 2024
1 parent 9ac58e2 commit e65492c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,8 @@ private ExoPlayer.Builder configureExoplayerBuilder(Context context) {
httpDataSourceFactory.setReadTimeoutMs(30 * 1000);
DefaultDataSource.Factory dataSourceFactory = new DefaultDataSource.Factory(context, httpDataSourceFactory);
exoPlayerBuilder.setMediaSourceFactory(new DefaultMediaSourceFactory(dataSourceFactory, extractorsFactory));
extractorsFactory.setConstantBitrateSeekingEnabled(true);
extractorsFactory.setConstantBitrateSeekingAlwaysEnabled(true);

return exoPlayerBuilder;
}
Expand Down
5 changes: 3 additions & 2 deletions playback/media3/exoplayer/src/main/kotlin/ExoPlayerBackend.kt
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,15 @@ class ExoPlayerBackend(
}
),
DefaultExtractorsFactory().apply {
val isLowRamDevice =
context.getSystemService<ActivityManager>()?.isLowRamDevice == true
val isLowRamDevice = context.getSystemService<ActivityManager>()?.isLowRamDevice == true
setTsExtractorTimestampSearchBytes(
when (isLowRamDevice) {
true -> TS_SEARCH_BYTES_LM
false -> TS_SEARCH_BYTES_HM
}
)
setConstantBitrateSeekingEnabled(true)
setConstantBitrateSeekingAlwaysEnabled(true)
}
))
.setPauseAtEndOfMediaItems(true)
Expand Down

0 comments on commit e65492c

Please sign in to comment.