fix(android): catch errors in performOnPlayerView (#3685)

Co-authored-by: JinYuSha0 <a1009943858@gmail.com>
This commit is contained in:
邵瑾瑜
2024-04-18 16:18:14 +08:00
committed by GitHub
parent 042e13c1dc
commit 3e3532691a

View File

@@ -18,6 +18,7 @@ class VideoManagerModule(reactContext: ReactApplicationContext?) : ReactContextB
private fun performOnPlayerView(reactTag: Int, callback: (ReactExoplayerView?) -> Unit) {
UiThreadUtil.runOnUiThread {
try {
val uiManager = UIManagerHelper.getUIManager(
reactApplicationContext,
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) UIManagerType.FABRIC else UIManagerType.DEFAULT
@@ -30,6 +31,9 @@ class VideoManagerModule(reactContext: ReactApplicationContext?) : ReactContextB
} else {
callback(null)
}
} catch (e: Exception) {
callback(null)
}
}
}