Fixes bug where canceling cast dialog would lockout cast button
This commit is contained in:
@@ -186,6 +186,9 @@ class MainActivity : AudioServiceActivity(), MethodChannel.MethodCallHandler, Ev
|
|||||||
chooserDialog = MediaRouteChooserDialog(themedContext)
|
chooserDialog = MediaRouteChooserDialog(themedContext)
|
||||||
chooserDialog?.routeSelector = routeSelector
|
chooserDialog?.routeSelector = routeSelector
|
||||||
chooserDialog?.setCanceledOnTouchOutside(true)
|
chooserDialog?.setCanceledOnTouchOutside(true)
|
||||||
|
chooserDialog?.setOnDismissListener {
|
||||||
|
handlePickerDismissed()
|
||||||
|
}
|
||||||
chooserDialog?.show()
|
chooserDialog?.show()
|
||||||
|
|
||||||
emitStatus("connecting")
|
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) {
|
private fun startCastingLiveStream(call: MethodCall, result: MethodChannel.Result) {
|
||||||
val arguments = call.arguments as? Map<*, *>
|
val arguments = call.arguments as? Map<*, *>
|
||||||
if (arguments == null) {
|
if (arguments == null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user