-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(android): migrate ReactVideoPackage to Kotlin (#3955)
- Loading branch information
1 parent
9958598
commit 702a0d9
Showing
2 changed files
with
29 additions
and
50 deletions.
There are no files selected for viewing
50 changes: 0 additions & 50 deletions
50
android/src/main/java/com/brentvatne/react/ReactVideoPackage.java
This file was deleted.
Oops, something went wrong.
29 changes: 29 additions & 0 deletions
29
android/src/main/java/com/brentvatne/react/ReactVideoPackage.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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!!)) | ||
} | ||
} |