-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(android): implement live configuration management (#3792)
* perf: ensure we do not provide callback to native if no callback provided from app * chore: rework bufferConfig to make it more generic and reduce ReactExoplayerView code size * chore: improve issue template * fix(android): avoid video view flickering at playback startup * feat(android): implement live buffer configuration * chore: fix linter
- Loading branch information
Showing
7 changed files
with
110 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
android/src/main/java/com/brentvatne/exoplayer/ConfigurationUtils.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.brentvatne.exoplayer | ||
|
||
import androidx.media3.common.MediaItem.LiveConfiguration | ||
import com.brentvatne.common.api.BufferConfig | ||
import com.brentvatne.common.api.BufferConfig.Live | ||
|
||
/** | ||
* Helper functions to create exoplayer configuration | ||
*/ | ||
object ConfigurationUtils { | ||
|
||
/** | ||
* Create a media3.LiveConfiguration.Builder from parsed BufferConfig | ||
*/ | ||
@JvmStatic | ||
fun getLiveConfiguration(bufferConfig: BufferConfig): LiveConfiguration.Builder { | ||
val liveConfiguration = LiveConfiguration.Builder() | ||
val live: Live = bufferConfig.live | ||
if (bufferConfig.live.maxOffsetMs >= 0) { | ||
liveConfiguration.setMaxOffsetMs(live.maxOffsetMs) | ||
} | ||
if (bufferConfig.live.maxPlaybackSpeed >= 0) { | ||
liveConfiguration.setMaxPlaybackSpeed(live.maxPlaybackSpeed) | ||
} | ||
if (bufferConfig.live.targetOffsetMs >= 0) { | ||
liveConfiguration.setTargetOffsetMs(live.targetOffsetMs) | ||
} | ||
if (bufferConfig.live.minOffsetMs >= 0) { | ||
liveConfiguration.setMinOffsetMs(live.minOffsetMs) | ||
} | ||
if (bufferConfig.live.minPlaybackSpeed >= 0) { | ||
liveConfiguration.setMinPlaybackSpeed(live.minPlaybackSpeed) | ||
} | ||
return liveConfiguration | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters