Fixes bug where canceling cast dialog would lockout cast button #4

Merged
kfj001 merged 1 commits from bug_fix_cast_button into main 2026-05-15 23:14:38 -07:00
@@ -186,6 +186,9 @@ class MainActivity : AudioServiceActivity(), MethodChannel.MethodCallHandler, Ev
chooserDialog = MediaRouteChooserDialog(themedContext)
chooserDialog?.routeSelector = routeSelector
chooserDialog?.setCanceledOnTouchOutside(true)
chooserDialog?.setOnDismissListener {
handlePickerDismissed()
}
chooserDialog?.show()
emitStatus("connecting")
@@ -194,6 +197,17 @@ class MainActivity : AudioServiceActivity(), MethodChannel.MethodCallHandler, Ev
}
}
private fun handlePickerDismissed() {
chooserDialog = null
val currentSession = castContext?.sessionManager?.currentCastSession
val currentStatus = statusPayload["status"] as? String
if (currentSession == null && currentStatus == "connecting") {
emitStatus("idle")
}
}
private fun startCastingLiveStream(call: MethodCall, result: MethodChannel.Result) {
val arguments = call.arguments as? Map<*, *>
if (arguments == null) {