Skip to content

Commit

Permalink
refactor(android): migrate ReactVideoPackage to Kotlin (#3955)
Browse files Browse the repository at this point in the history
  • Loading branch information
seyedmostafahasani authored Jun 30, 2024
1 parent 9958598 commit 702a0d9
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 50 deletions.
50 changes: 0 additions & 50 deletions android/src/main/java/com/brentvatne/react/ReactVideoPackage.java

This file was deleted.

29 changes: 29 additions & 0 deletions android/src/main/java/com/brentvatne/react/ReactVideoPackage.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.brentvatne.react

import com.brentvatne.exoplayer.DefaultReactExoplayerConfig
import com.brentvatne.exoplayer.ReactExoplayerConfig
import com.brentvatne.exoplayer.ReactExoplayerViewManager
import com.facebook.react.ReactPackage
import com.facebook.react.bridge.JavaScriptModule
import com.facebook.react.bridge.NativeModule
import com.facebook.react.bridge.ReactApplicationContext
import com.facebook.react.uimanager.ViewManager

class ReactVideoPackage @JvmOverloads constructor(private var config: ReactExoplayerConfig? = null) : ReactPackage {

override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> =
listOf(
VideoDecoderPropertiesModule(reactContext),
VideoManagerModule(reactContext)
)

// Deprecated RN 0.47
fun createJSModules(): List<Class<out JavaScriptModule>> = emptyList()

override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> {
if (config == null) {
config = DefaultReactExoplayerConfig(reactContext)
}
return listOf(ReactExoplayerViewManager(config!!))
}
}

0 comments on commit 702a0d9

Please sign in to comment.