fix(provider): make source optional

This commit is contained in:
2026-07-21 19:50:30 +02:00
parent a335509b4e
commit 6eb02d32cb
17 changed files with 57 additions and 36 deletions
@@ -30,7 +30,7 @@ abstract class HybridOmniPlayerFactorySpec: HybridObject() {
// Methods
@DoNotStrip
@Keep
abstract fun createPlayer(props: Source): HybridOmniPlayerSpec
abstract fun createPlayer(props: Source?): HybridOmniPlayerSpec
// Default implementation of `HybridObject.toString()`
override fun toString(): String {
@@ -110,7 +110,7 @@ abstract class HybridOmniPlayerSpec: HybridObject() {
// Methods
@DoNotStrip
@Keep
abstract fun setSource(src: Source): Unit
abstract fun setSource(src: Source?): Unit
@DoNotStrip
@Keep
@@ -38,6 +38,9 @@ data class Source(
val mixAudio: MixAudioMode?,
@DoNotStrip
@Keep
val castId: String?,
@DoNotStrip
@Keep
val castData: Map<String, String>?
) {
/* primary constructor */
@@ -51,6 +54,7 @@ data class Source(
&& Objects.deepEquals(this.fonts, other.fonts)
&& Objects.deepEquals(this.metadata, other.metadata)
&& Objects.deepEquals(this.mixAudio, other.mixAudio)
&& Objects.deepEquals(this.castId, other.castId)
&& Objects.deepEquals(this.castData, other.castData)
}
@@ -62,6 +66,7 @@ data class Source(
fonts,
metadata,
mixAudio,
castId,
castData
).contentDeepHashCode()
}
@@ -74,8 +79,8 @@ data class Source(
@Keep
@Suppress("unused")
@JvmStatic
private fun fromCpp(src: Array<VideoSrc>, startTime: Double?, subtitles: Array<Subtitle>, fonts: Array<String>?, metadata: Metadata?, mixAudio: MixAudioMode?, castData: Map<String, String>?): Source {
return Source(src, startTime, subtitles, fonts, metadata, mixAudio, castData)
private fun fromCpp(src: Array<VideoSrc>, startTime: Double?, subtitles: Array<Subtitle>, fonts: Array<String>?, metadata: Metadata?, mixAudio: MixAudioMode?, castId: String?, castData: Map<String, String>?): Source {
return Source(src, startTime, subtitles, fonts, metadata, mixAudio, castId, castData)
}
}
}