refactor: internal refactor for prepare new arch (#3980)
* chore(js): fix typo * refactor(js): refactor type code for codegen * refactor(js): refactor Video component - parse shutterColor value within JS - remove internal fullscreen state * chore(js): add deprecation warning comment * fix(js): fix return type * fix(js): fix import path * refactor(android): apply changed API for new arch * refactor(ios): apply changed API for new arch * fix(ios): fix wrong name * refactor: refactor VideoDecoderProperties - rename and add wrapper * refactor(android): Code fixes for backward compatibility with Kotlin
This commit is contained in:
@@ -1,12 +1,10 @@
|
||||
package com.brentvatne.react
|
||||
|
||||
import com.brentvatne.common.toolbox.ReactBridgeUtils
|
||||
import com.brentvatne.exoplayer.ReactExoplayerView
|
||||
import com.facebook.react.bridge.Promise
|
||||
import com.facebook.react.bridge.ReactApplicationContext
|
||||
import com.facebook.react.bridge.ReactContextBaseJavaModule
|
||||
import com.facebook.react.bridge.ReactMethod
|
||||
import com.facebook.react.bridge.ReadableMap
|
||||
import com.facebook.react.bridge.UiThreadUtil
|
||||
import com.facebook.react.uimanager.UIManagerHelper
|
||||
import com.facebook.react.uimanager.common.UIManagerType
|
||||
@@ -37,31 +35,33 @@ class VideoManagerModule(reactContext: ReactApplicationContext?) : ReactContextB
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
fun setPlayerPauseState(paused: Boolean?, reactTag: Int) {
|
||||
fun setPlayerPauseStateCmd(reactTag: Int, paused: Boolean?) {
|
||||
performOnPlayerView(reactTag) {
|
||||
it?.setPausedModifier(paused!!)
|
||||
}
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
fun seek(info: ReadableMap, reactTag: Int) {
|
||||
if (!info.hasKey("time")) {
|
||||
return
|
||||
}
|
||||
|
||||
val time = ReactBridgeUtils.safeGetInt(info, "time")
|
||||
fun seekCmd(reactTag: Int, time: Float, tolerance: Float) {
|
||||
performOnPlayerView(reactTag) {
|
||||
it?.seekTo((time * 1000f).roundToInt().toLong())
|
||||
}
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
fun setVolume(volume: Float, reactTag: Int) {
|
||||
fun setVolumeCmd(reactTag: Int, volume: Float) {
|
||||
performOnPlayerView(reactTag) {
|
||||
it?.setVolumeModifier(volume)
|
||||
}
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
fun setFullScreenCmd(reactTag: Int, fullScreen: Boolean) {
|
||||
performOnPlayerView(reactTag) {
|
||||
it?.setFullscreen(fullScreen)
|
||||
}
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
fun getCurrentPosition(reactTag: Int, promise: Promise) {
|
||||
performOnPlayerView(reactTag) {
|
||||
@@ -69,13 +69,6 @@ class VideoManagerModule(reactContext: ReactApplicationContext?) : ReactContextB
|
||||
}
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
fun setFullScreen(fullScreen: Boolean, reactTag: Int) {
|
||||
performOnPlayerView(reactTag) {
|
||||
it?.setFullscreen(fullScreen)
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val REACT_CLASS = "VideoManager"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user