fix(android): catch errors in performOnPlayerView
(#3685)
Co-authored-by: JinYuSha0 <a1009943858@gmail.com>
This commit is contained in:
parent
042e13c1dc
commit
3e3532691a
@ -18,16 +18,20 @@ class VideoManagerModule(reactContext: ReactApplicationContext?) : ReactContextB
|
|||||||
|
|
||||||
private fun performOnPlayerView(reactTag: Int, callback: (ReactExoplayerView?) -> Unit) {
|
private fun performOnPlayerView(reactTag: Int, callback: (ReactExoplayerView?) -> Unit) {
|
||||||
UiThreadUtil.runOnUiThread {
|
UiThreadUtil.runOnUiThread {
|
||||||
val uiManager = UIManagerHelper.getUIManager(
|
try {
|
||||||
reactApplicationContext,
|
val uiManager = UIManagerHelper.getUIManager(
|
||||||
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) UIManagerType.FABRIC else UIManagerType.DEFAULT
|
reactApplicationContext,
|
||||||
)
|
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) UIManagerType.FABRIC else UIManagerType.DEFAULT
|
||||||
|
)
|
||||||
|
|
||||||
val view = uiManager?.resolveView(reactTag)
|
val view = uiManager?.resolveView(reactTag)
|
||||||
|
|
||||||
if (view is ReactExoplayerView) {
|
if (view is ReactExoplayerView) {
|
||||||
callback(view)
|
callback(view)
|
||||||
} else {
|
} else {
|
||||||
|
callback(null)
|
||||||
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
callback(null)
|
callback(null)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user