wip: Implement events

This commit is contained in:
2026-04-10 23:28:46 +02:00
parent 626380bcc4
commit f6721de3a6
36 changed files with 1824 additions and 111 deletions
@@ -0,0 +1,80 @@
///
/// Func_void.kt
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
/// https://github.com/mrousavy/nitro
/// Copyright © Marc Rousavy @ Margelo
///
package com.margelo.nitro.omni
import androidx.annotation.Keep
import com.facebook.jni.HybridData
import com.facebook.proguard.annotations.DoNotStrip
import dalvik.annotation.optimization.FastNative
/**
* Represents the JavaScript callback `() => void`.
* This can be either implemented in C++ (in which case it might be a callback coming from JS),
* or in Kotlin/Java (in which case it is a native callback).
*/
@DoNotStrip
@Keep
@Suppress("ClassName", "RedundantUnitReturnType")
fun interface Func_void: () -> Unit {
/**
* Call the given JS callback.
* @throws Throwable if the JS function itself throws an error, or if the JS function/runtime has already been deleted.
*/
@DoNotStrip
@Keep
override fun invoke(): Unit
}
/**
* Represents the JavaScript callback `() => void`.
* This is implemented in C++, via a `std::function<...>`.
* The callback might be coming from JS.
*/
@DoNotStrip
@Keep
@Suppress(
"KotlinJniMissingFunction", "unused",
"RedundantSuppression", "RedundantUnitReturnType", "FunctionName",
"ConvertSecondaryConstructorToPrimary", "ClassName", "LocalVariableName",
)
class Func_void_cxx: Func_void {
@DoNotStrip
@Keep
private val mHybridData: HybridData
@DoNotStrip
@Keep
private constructor(hybridData: HybridData) {
mHybridData = hybridData
}
@DoNotStrip
@Keep
override fun invoke(): Unit
= invoke_cxx()
@FastNative
private external fun invoke_cxx(): Unit
}
/**
* Represents the JavaScript callback `() => void`.
* This is implemented in Java/Kotlin, via a `() -> Unit`.
* The callback is always coming from native.
*/
@DoNotStrip
@Keep
@Suppress("ClassName", "RedundantUnitReturnType", "unused")
class Func_void_java(private val function: () -> Unit): Func_void {
@DoNotStrip
@Keep
override fun invoke(): Unit {
return this.function()
}
}
@@ -0,0 +1,80 @@
///
/// Func_void_Rendition.kt
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
/// https://github.com/mrousavy/nitro
/// Copyright © Marc Rousavy @ Margelo
///
package com.margelo.nitro.omni
import androidx.annotation.Keep
import com.facebook.jni.HybridData
import com.facebook.proguard.annotations.DoNotStrip
import dalvik.annotation.optimization.FastNative
/**
* Represents the JavaScript callback `(rendition: struct) => void`.
* This can be either implemented in C++ (in which case it might be a callback coming from JS),
* or in Kotlin/Java (in which case it is a native callback).
*/
@DoNotStrip
@Keep
@Suppress("ClassName", "RedundantUnitReturnType")
fun interface Func_void_Rendition: (Rendition) -> Unit {
/**
* Call the given JS callback.
* @throws Throwable if the JS function itself throws an error, or if the JS function/runtime has already been deleted.
*/
@DoNotStrip
@Keep
override fun invoke(rendition: Rendition): Unit
}
/**
* Represents the JavaScript callback `(rendition: struct) => void`.
* This is implemented in C++, via a `std::function<...>`.
* The callback might be coming from JS.
*/
@DoNotStrip
@Keep
@Suppress(
"KotlinJniMissingFunction", "unused",
"RedundantSuppression", "RedundantUnitReturnType", "FunctionName",
"ConvertSecondaryConstructorToPrimary", "ClassName", "LocalVariableName",
)
class Func_void_Rendition_cxx: Func_void_Rendition {
@DoNotStrip
@Keep
private val mHybridData: HybridData
@DoNotStrip
@Keep
private constructor(hybridData: HybridData) {
mHybridData = hybridData
}
@DoNotStrip
@Keep
override fun invoke(rendition: Rendition): Unit
= invoke_cxx(rendition)
@FastNative
private external fun invoke_cxx(rendition: Rendition): Unit
}
/**
* Represents the JavaScript callback `(rendition: struct) => void`.
* This is implemented in Java/Kotlin, via a `(Rendition) -> Unit`.
* The callback is always coming from native.
*/
@DoNotStrip
@Keep
@Suppress("ClassName", "RedundantUnitReturnType", "unused")
class Func_void_Rendition_java(private val function: (Rendition) -> Unit): Func_void_Rendition {
@DoNotStrip
@Keep
override fun invoke(rendition: Rendition): Unit {
return this.function(rendition)
}
}
@@ -0,0 +1,80 @@
///
/// Func_void_Track.kt
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
/// https://github.com/mrousavy/nitro
/// Copyright © Marc Rousavy @ Margelo
///
package com.margelo.nitro.omni
import androidx.annotation.Keep
import com.facebook.jni.HybridData
import com.facebook.proguard.annotations.DoNotStrip
import dalvik.annotation.optimization.FastNative
/**
* Represents the JavaScript callback `(track: struct) => void`.
* This can be either implemented in C++ (in which case it might be a callback coming from JS),
* or in Kotlin/Java (in which case it is a native callback).
*/
@DoNotStrip
@Keep
@Suppress("ClassName", "RedundantUnitReturnType")
fun interface Func_void_Track: (Track) -> Unit {
/**
* Call the given JS callback.
* @throws Throwable if the JS function itself throws an error, or if the JS function/runtime has already been deleted.
*/
@DoNotStrip
@Keep
override fun invoke(track: Track): Unit
}
/**
* Represents the JavaScript callback `(track: struct) => void`.
* This is implemented in C++, via a `std::function<...>`.
* The callback might be coming from JS.
*/
@DoNotStrip
@Keep
@Suppress(
"KotlinJniMissingFunction", "unused",
"RedundantSuppression", "RedundantUnitReturnType", "FunctionName",
"ConvertSecondaryConstructorToPrimary", "ClassName", "LocalVariableName",
)
class Func_void_Track_cxx: Func_void_Track {
@DoNotStrip
@Keep
private val mHybridData: HybridData
@DoNotStrip
@Keep
private constructor(hybridData: HybridData) {
mHybridData = hybridData
}
@DoNotStrip
@Keep
override fun invoke(track: Track): Unit
= invoke_cxx(track)
@FastNative
private external fun invoke_cxx(track: Track): Unit
}
/**
* Represents the JavaScript callback `(track: struct) => void`.
* This is implemented in Java/Kotlin, via a `(Track) -> Unit`.
* The callback is always coming from native.
*/
@DoNotStrip
@Keep
@Suppress("ClassName", "RedundantUnitReturnType", "unused")
class Func_void_Track_java(private val function: (Track) -> Unit): Func_void_Track {
@DoNotStrip
@Keep
override fun invoke(track: Track): Unit {
return this.function(track)
}
}
@@ -0,0 +1,80 @@
///
/// Func_void_std__optional_Track_.kt
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
/// https://github.com/mrousavy/nitro
/// Copyright © Marc Rousavy @ Margelo
///
package com.margelo.nitro.omni
import androidx.annotation.Keep
import com.facebook.jni.HybridData
import com.facebook.proguard.annotations.DoNotStrip
import dalvik.annotation.optimization.FastNative
/**
* Represents the JavaScript callback `(track: optional) => void`.
* This can be either implemented in C++ (in which case it might be a callback coming from JS),
* or in Kotlin/Java (in which case it is a native callback).
*/
@DoNotStrip
@Keep
@Suppress("ClassName", "RedundantUnitReturnType")
fun interface Func_void_std__optional_Track_: (Track?) -> Unit {
/**
* Call the given JS callback.
* @throws Throwable if the JS function itself throws an error, or if the JS function/runtime has already been deleted.
*/
@DoNotStrip
@Keep
override fun invoke(track: Track?): Unit
}
/**
* Represents the JavaScript callback `(track: optional) => void`.
* This is implemented in C++, via a `std::function<...>`.
* The callback might be coming from JS.
*/
@DoNotStrip
@Keep
@Suppress(
"KotlinJniMissingFunction", "unused",
"RedundantSuppression", "RedundantUnitReturnType", "FunctionName",
"ConvertSecondaryConstructorToPrimary", "ClassName", "LocalVariableName",
)
class Func_void_std__optional_Track__cxx: Func_void_std__optional_Track_ {
@DoNotStrip
@Keep
private val mHybridData: HybridData
@DoNotStrip
@Keep
private constructor(hybridData: HybridData) {
mHybridData = hybridData
}
@DoNotStrip
@Keep
override fun invoke(track: Track?): Unit
= invoke_cxx(track)
@FastNative
private external fun invoke_cxx(track: Track?): Unit
}
/**
* Represents the JavaScript callback `(track: optional) => void`.
* This is implemented in Java/Kotlin, via a `(Track?) -> Unit`.
* The callback is always coming from native.
*/
@DoNotStrip
@Keep
@Suppress("ClassName", "RedundantUnitReturnType", "unused")
class Func_void_std__optional_Track__java(private val function: (Track?) -> Unit): Func_void_std__optional_Track_ {
@DoNotStrip
@Keep
override fun invoke(track: Track?): Unit {
return this.function(track)
}
}
@@ -0,0 +1,80 @@
///
/// Func_void_std__string.kt
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
/// https://github.com/mrousavy/nitro
/// Copyright © Marc Rousavy @ Margelo
///
package com.margelo.nitro.omni
import androidx.annotation.Keep
import com.facebook.jni.HybridData
import com.facebook.proguard.annotations.DoNotStrip
import dalvik.annotation.optimization.FastNative
/**
* Represents the JavaScript callback `(status: string) => void`.
* This can be either implemented in C++ (in which case it might be a callback coming from JS),
* or in Kotlin/Java (in which case it is a native callback).
*/
@DoNotStrip
@Keep
@Suppress("ClassName", "RedundantUnitReturnType")
fun interface Func_void_std__string: (String) -> Unit {
/**
* Call the given JS callback.
* @throws Throwable if the JS function itself throws an error, or if the JS function/runtime has already been deleted.
*/
@DoNotStrip
@Keep
override fun invoke(status: String): Unit
}
/**
* Represents the JavaScript callback `(status: string) => void`.
* This is implemented in C++, via a `std::function<...>`.
* The callback might be coming from JS.
*/
@DoNotStrip
@Keep
@Suppress(
"KotlinJniMissingFunction", "unused",
"RedundantSuppression", "RedundantUnitReturnType", "FunctionName",
"ConvertSecondaryConstructorToPrimary", "ClassName", "LocalVariableName",
)
class Func_void_std__string_cxx: Func_void_std__string {
@DoNotStrip
@Keep
private val mHybridData: HybridData
@DoNotStrip
@Keep
private constructor(hybridData: HybridData) {
mHybridData = hybridData
}
@DoNotStrip
@Keep
override fun invoke(status: String): Unit
= invoke_cxx(status)
@FastNative
private external fun invoke_cxx(status: String): Unit
}
/**
* Represents the JavaScript callback `(status: string) => void`.
* This is implemented in Java/Kotlin, via a `(String) -> Unit`.
* The callback is always coming from native.
*/
@DoNotStrip
@Keep
@Suppress("ClassName", "RedundantUnitReturnType", "unused")
class Func_void_std__string_java(private val function: (String) -> Unit): Func_void_std__string {
@DoNotStrip
@Keep
override fun invoke(status: String): Unit {
return this.function(status)
}
}
@@ -0,0 +1,80 @@
///
/// Func_void_std__string_std__string.kt
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
/// https://github.com/mrousavy/nitro
/// Copyright © Marc Rousavy @ Margelo
///
package com.margelo.nitro.omni
import androidx.annotation.Keep
import com.facebook.jni.HybridData
import com.facebook.proguard.annotations.DoNotStrip
import dalvik.annotation.optimization.FastNative
/**
* Represents the JavaScript callback `(type: string, message: string) => void`.
* This can be either implemented in C++ (in which case it might be a callback coming from JS),
* or in Kotlin/Java (in which case it is a native callback).
*/
@DoNotStrip
@Keep
@Suppress("ClassName", "RedundantUnitReturnType")
fun interface Func_void_std__string_std__string: (String, String) -> Unit {
/**
* Call the given JS callback.
* @throws Throwable if the JS function itself throws an error, or if the JS function/runtime has already been deleted.
*/
@DoNotStrip
@Keep
override fun invoke(type: String, message: String): Unit
}
/**
* Represents the JavaScript callback `(type: string, message: string) => void`.
* This is implemented in C++, via a `std::function<...>`.
* The callback might be coming from JS.
*/
@DoNotStrip
@Keep
@Suppress(
"KotlinJniMissingFunction", "unused",
"RedundantSuppression", "RedundantUnitReturnType", "FunctionName",
"ConvertSecondaryConstructorToPrimary", "ClassName", "LocalVariableName",
)
class Func_void_std__string_std__string_cxx: Func_void_std__string_std__string {
@DoNotStrip
@Keep
private val mHybridData: HybridData
@DoNotStrip
@Keep
private constructor(hybridData: HybridData) {
mHybridData = hybridData
}
@DoNotStrip
@Keep
override fun invoke(type: String, message: String): Unit
= invoke_cxx(type,message)
@FastNative
private external fun invoke_cxx(type: String, message: String): Unit
}
/**
* Represents the JavaScript callback `(type: string, message: string) => void`.
* This is implemented in Java/Kotlin, via a `(String, String) -> Unit`.
* The callback is always coming from native.
*/
@DoNotStrip
@Keep
@Suppress("ClassName", "RedundantUnitReturnType", "unused")
class Func_void_std__string_std__string_java(private val function: (String, String) -> Unit): Func_void_std__string_std__string {
@DoNotStrip
@Keep
override fun invoke(type: String, message: String): Unit {
return this.function(type, message)
}
}
@@ -0,0 +1,212 @@
///
/// HybridOmniEventMapSpec.kt
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
/// https://github.com/mrousavy/nitro
/// Copyright © Marc Rousavy @ Margelo
///
package com.margelo.nitro.omni
import androidx.annotation.Keep
import com.facebook.jni.HybridData
import com.facebook.proguard.annotations.DoNotStrip
import com.margelo.nitro.core.HybridObject
/**
* A Kotlin class representing the OmniEventMap HybridObject.
* Implement this abstract class to create Kotlin-based instances of OmniEventMap.
*/
@DoNotStrip
@Keep
@Suppress(
"KotlinJniMissingFunction", "unused",
"RedundantSuppression", "RedundantUnitReturnType", "SimpleRedundantLet",
"LocalVariableName", "PropertyName", "PrivatePropertyName", "FunctionName"
)
abstract class HybridOmniEventMapSpec: HybridObject() {
// Properties
// Methods
abstract fun addOnEndListener(cb: () -> Unit): Unit
@DoNotStrip
@Keep
private fun addOnEndListener_cxx(cb: Func_void): Unit {
val __result = addOnEndListener(cb)
return __result
}
abstract fun removeOnEndListener(cb: () -> Unit): Unit
@DoNotStrip
@Keep
private fun removeOnEndListener_cxx(cb: Func_void): Unit {
val __result = removeOnEndListener(cb)
return __result
}
abstract fun addOnPrevListener(cb: () -> Unit): Unit
@DoNotStrip
@Keep
private fun addOnPrevListener_cxx(cb: Func_void): Unit {
val __result = addOnPrevListener(cb)
return __result
}
abstract fun removeOnPrevListener(cb: () -> Unit): Unit
@DoNotStrip
@Keep
private fun removeOnPrevListener_cxx(cb: Func_void): Unit {
val __result = removeOnPrevListener(cb)
return __result
}
abstract fun addOnNextListener(cb: () -> Unit): Unit
@DoNotStrip
@Keep
private fun addOnNextListener_cxx(cb: Func_void): Unit {
val __result = addOnNextListener(cb)
return __result
}
abstract fun removeOnNextListener(cb: () -> Unit): Unit
@DoNotStrip
@Keep
private fun removeOnNextListener_cxx(cb: Func_void): Unit {
val __result = removeOnNextListener(cb)
return __result
}
abstract fun addOnErrorListener(cb: (type: String, message: String) -> Unit): Unit
@DoNotStrip
@Keep
private fun addOnErrorListener_cxx(cb: Func_void_std__string_std__string): Unit {
val __result = addOnErrorListener(cb)
return __result
}
abstract fun removeOnErrorListener(cb: (type: String, message: String) -> Unit): Unit
@DoNotStrip
@Keep
private fun removeOnErrorListener_cxx(cb: Func_void_std__string_std__string): Unit {
val __result = removeOnErrorListener(cb)
return __result
}
abstract fun addOnAudioFocusChangeListener(cb: (status: String) -> Unit): Unit
@DoNotStrip
@Keep
private fun addOnAudioFocusChangeListener_cxx(cb: Func_void_std__string): Unit {
val __result = addOnAudioFocusChangeListener(cb)
return __result
}
abstract fun removeOnAudioFocusChangeListener(cb: (status: String) -> Unit): Unit
@DoNotStrip
@Keep
private fun removeOnAudioFocusChangeListener_cxx(cb: Func_void_std__string): Unit {
val __result = removeOnAudioFocusChangeListener(cb)
return __result
}
abstract fun addOnVideoTrackChangeListener(cb: (track: Track) -> Unit): Unit
@DoNotStrip
@Keep
private fun addOnVideoTrackChangeListener_cxx(cb: Func_void_Track): Unit {
val __result = addOnVideoTrackChangeListener(cb)
return __result
}
abstract fun removeOnVideoTrackChangeListener(cb: (track: Track) -> Unit): Unit
@DoNotStrip
@Keep
private fun removeOnVideoTrackChangeListener_cxx(cb: Func_void_Track): Unit {
val __result = removeOnVideoTrackChangeListener(cb)
return __result
}
abstract fun addOnAudioTrackChangeListener(cb: (track: Track) -> Unit): Unit
@DoNotStrip
@Keep
private fun addOnAudioTrackChangeListener_cxx(cb: Func_void_Track): Unit {
val __result = addOnAudioTrackChangeListener(cb)
return __result
}
abstract fun removeOnAudioTrackChangeListener(cb: (track: Track) -> Unit): Unit
@DoNotStrip
@Keep
private fun removeOnAudioTrackChangeListener_cxx(cb: Func_void_Track): Unit {
val __result = removeOnAudioTrackChangeListener(cb)
return __result
}
abstract fun addOnSubtitleChangeListener(cb: (track: Track?) -> Unit): Unit
@DoNotStrip
@Keep
private fun addOnSubtitleChangeListener_cxx(cb: Func_void_std__optional_Track_): Unit {
val __result = addOnSubtitleChangeListener(cb)
return __result
}
abstract fun removeOnSubtitleChangeListener(cb: (track: Track?) -> Unit): Unit
@DoNotStrip
@Keep
private fun removeOnSubtitleChangeListener_cxx(cb: Func_void_std__optional_Track_): Unit {
val __result = removeOnSubtitleChangeListener(cb)
return __result
}
abstract fun addOnRenditionChangeListener(cb: (rendition: Rendition) -> Unit): Unit
@DoNotStrip
@Keep
private fun addOnRenditionChangeListener_cxx(cb: Func_void_Rendition): Unit {
val __result = addOnRenditionChangeListener(cb)
return __result
}
abstract fun removeOnRenditionChangeListener(cb: (rendition: Rendition) -> Unit): Unit
@DoNotStrip
@Keep
private fun removeOnRenditionChangeListener_cxx(cb: Func_void_Rendition): Unit {
val __result = removeOnRenditionChangeListener(cb)
return __result
}
// Default implementation of `HybridObject.toString()`
override fun toString(): String {
return "[HybridObject OmniEventMap]"
}
// C++ backing class
@DoNotStrip
@Keep
protected open class CxxPart(javaPart: HybridOmniEventMapSpec): HybridObject.CxxPart(javaPart) {
// C++ JHybridOmniEventMapSpec::CxxPart::initHybrid(...)
external override fun initHybrid(): HybridData
}
override fun createCxxPart(): CxxPart {
return CxxPart(this)
}
companion object {
protected const val TAG = "HybridOmniEventMapSpec"
}
}
@@ -25,6 +25,10 @@ import com.margelo.nitro.core.HybridObject
)
abstract class HybridOmniPlayerSpec: HybridObject() {
// Properties
@get:DoNotStrip
@get:Keep
abstract val eventMap: HybridOmniEventMapSpec
@get:DoNotStrip
@get:Keep
@set:DoNotStrip
@@ -39,6 +43,22 @@ abstract class HybridOmniPlayerSpec: HybridObject() {
@get:Keep
abstract val hasNext: Boolean
@get:DoNotStrip
@get:Keep
abstract val videos: Array<Track>
@get:DoNotStrip
@get:Keep
abstract val audios: Array<Track>
@get:DoNotStrip
@get:Keep
abstract val subtitles: Array<Track>
@get:DoNotStrip
@get:Keep
abstract val rendition: Array<Rendition>
@get:DoNotStrip
@get:Keep
abstract val status: PlayerStatus
@@ -72,22 +92,6 @@ abstract class HybridOmniPlayerSpec: HybridObject() {
@set:DoNotStrip
@set:Keep
abstract var volume: Double
@get:DoNotStrip
@get:Keep
abstract val videos: Array<Track>
@get:DoNotStrip
@get:Keep
abstract val audios: Array<Track>
@get:DoNotStrip
@get:Keep
abstract val subtitles: Array<Track>
@get:DoNotStrip
@get:Keep
abstract val rendition: Array<Rendition>
// Methods
@DoNotStrip
@@ -16,10 +16,10 @@ import com.facebook.proguard.annotations.DoNotStrip
@DoNotStrip
@Keep
enum class PlayerStatus(@DoNotStrip @Keep val value: Int) {
IDLE(0),
LOADING(1),
READYTOPLAY(2),
ERROR(3);
ERROR(0),
IDLE(1),
LOADING(2),
READYTOPLAY(3);
companion object
}