feat(android): allow building exoplayer from source (#3932)
* feat(android): allow to build from source code * fix(android): allow to build plugin from source
This commit is contained in:
@@ -43,6 +43,7 @@ def ExoplayerDependenciesList = [
|
||||
"useExoplayerHls",
|
||||
"useExoplayerRtsp",
|
||||
]
|
||||
def media3_buildFromSource = safeExtGet('buildFromMedia3Source').toBoolean() ?: false
|
||||
|
||||
def ExoplayerDependencies = ExoplayerDependenciesList.collectEntries { property ->
|
||||
[(property): safeExtGet(property)?.toBoolean() ?: false]
|
||||
@@ -52,14 +53,17 @@ ExoplayerDependenciesList.each { propertyName ->
|
||||
def propertyValue = ExoplayerDependencies[propertyName]
|
||||
println "$propertyName: $propertyValue"
|
||||
}
|
||||
println "buildFromSource: $media3_buildFromSource"
|
||||
|
||||
// This string is used to define build path.
|
||||
// As react native build output directory is react-native path of the module.
|
||||
// We need to force a new path on each configuration change.
|
||||
// If you add a new build parameter, please add the new value in this string
|
||||
def configStringPath = ExoplayerDependencies.collect { property, value ->
|
||||
property + value
|
||||
}.join('').md5()
|
||||
def configStringPath = ExoplayerDependencies
|
||||
.collect { property, value -> property + value}
|
||||
.join('')
|
||||
.concat("buildFromSource:$media3_buildFromSource")
|
||||
.md5()
|
||||
|
||||
if (isNewArchitectureEnabled()) {
|
||||
apply plugin: "com.facebook.react"
|
||||
@@ -191,46 +195,87 @@ dependencies {
|
||||
implementation "androidx.activity:activity-ktx:$androidxActivity_version"
|
||||
|
||||
// For media playback using ExoPlayer
|
||||
implementation "androidx.media3:media3-exoplayer:$media3_version"
|
||||
if (media3_buildFromSource) {
|
||||
implementation(project(":media-lib-exoplayer"))
|
||||
} else {
|
||||
implementation "androidx.media3:media3-exoplayer:$media3_version"
|
||||
}
|
||||
|
||||
if (ExoplayerDependencies["useExoplayerSmoothStreaming"]) {
|
||||
// For Smooth Streaming playback support with ExoPlayer
|
||||
implementation "androidx.media3:media3-exoplayer-smoothstreaming:$media3_version"
|
||||
if (media3_buildFromSource) {
|
||||
implementation(project(":media-lib-exoplayer-smoothstreaming"))
|
||||
} else {
|
||||
implementation "androidx.media3:media3-exoplayer-smoothstreaming:$media3_version"
|
||||
}
|
||||
}
|
||||
|
||||
if (ExoplayerDependencies["useExoplayerDash"]) {
|
||||
// For DASH playback support with ExoPlayer
|
||||
implementation "androidx.media3:media3-exoplayer-dash:$media3_version"
|
||||
if (media3_buildFromSource) {
|
||||
implementation(project(":media-lib-exoplayer-dash"))
|
||||
} else {
|
||||
implementation "androidx.media3:media3-exoplayer-dash:$media3_version"
|
||||
}
|
||||
}
|
||||
|
||||
if (ExoplayerDependencies["useExoplayerHls"]) {
|
||||
// For HLS playback support with ExoPlayer
|
||||
implementation "androidx.media3:media3-exoplayer-hls:$media3_version"
|
||||
// For HLS playback support with ExoPlayer
|
||||
if (media3_buildFromSource) {
|
||||
implementation(project(":media-lib-exoplayer-hls"))
|
||||
} else {
|
||||
implementation "androidx.media3:media3-exoplayer-hls:$media3_version"
|
||||
}
|
||||
}
|
||||
|
||||
// For RTSP playback support with ExoPlayer
|
||||
if (ExoplayerDependencies["useExoplayerRtsp"]) {
|
||||
implementation "androidx.media3:media3-exoplayer-rtsp:$media3_version"
|
||||
if (media3_buildFromSource) {
|
||||
implementation(project(":media-lib-exoplayer-rtsp"))
|
||||
} else {
|
||||
implementation "androidx.media3:media3-exoplayer-rtsp:$media3_version"
|
||||
}
|
||||
}
|
||||
|
||||
// For ad insertion using the Interactive Media Ads SDK with ExoPlayer
|
||||
if (ExoplayerDependencies["useExoplayerIMA"]) {
|
||||
implementation "androidx.media3:media3-exoplayer-ima:$media3_version"
|
||||
if (media3_buildFromSource) {
|
||||
implementation(project(":media-lib-exoplayer-ima"))
|
||||
} else {
|
||||
implementation "androidx.media3:media3-exoplayer-ima:$media3_version"
|
||||
}
|
||||
}
|
||||
|
||||
// For loading data using the OkHttp network stack
|
||||
implementation "androidx.media3:media3-datasource-okhttp:$media3_version"
|
||||
if (media3_buildFromSource) {
|
||||
// For loading data using the OkHttp network stack
|
||||
implementation(project(":media-lib-datasource-okhttp"))
|
||||
|
||||
// For building media playback UIs
|
||||
implementation "androidx.media3:media3-ui:$media3_version"
|
||||
// For building media playback UIs
|
||||
implementation(project(":media-lib-ui"))
|
||||
|
||||
// For exposing and controlling media sessions
|
||||
implementation "androidx.media3:media3-session:$media3_version"
|
||||
// For exposing and controlling media sessions
|
||||
implementation(project(":media-lib-session"))
|
||||
|
||||
// Common functionality for loading data
|
||||
implementation "androidx.media3:media3-datasource:$media3_version"
|
||||
// Common functionality used across multiple media libraries
|
||||
implementation "androidx.media3:media3-common:$media3_version"
|
||||
// Common functionality for loading data
|
||||
implementation(project(":media-lib-datasource"))
|
||||
|
||||
// Common functionality used across multiple media libraries
|
||||
implementation(project(":media-lib-common"))
|
||||
} else {
|
||||
// For loading data using the OkHttp network stack
|
||||
implementation "androidx.media3:media3-datasource-okhttp:$media3_version"
|
||||
|
||||
// For building media playback UIs
|
||||
implementation "androidx.media3:media3-ui:$media3_version"
|
||||
|
||||
// For exposing and controlling media sessions
|
||||
implementation "androidx.media3:media3-session:$media3_version"
|
||||
|
||||
// Common functionality for loading data
|
||||
implementation "androidx.media3:media3-datasource:$media3_version"
|
||||
|
||||
// Common functionality used across multiple media libraries
|
||||
implementation "androidx.media3:media3-common:$media3_version"
|
||||
}
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||
}
|
||||
|
@@ -12,3 +12,4 @@ RNVideo_useExoplayerDash=true
|
||||
RNVideo_useExoplayerHls=true
|
||||
RNVideo_androidxCoreVersion=1.9.0
|
||||
RNVideo_androidxActivityVersion=1.7.0
|
||||
RNVideo_buildFromMedia3Source=false
|
||||
|
Reference in New Issue
Block a user