Can it be resolved by handling onNetworkRestored / onNetworkConnectionReconnect events?
Actually, if the physical network is down, you can't rely on receiving these events.
onNetworkRestoredWhen the user sets the network down due to a failed http request, i.e., calling
CODE
KONtx.application.setNetworkRequestFailed(true);
in their request handler, this flips a boolean variable. Then, when another http request succeeds, calling
CODE
KONtx.application.setNetworkRequestFailed(false);
would then fire the event and reset the boolean.
So, if the physical network goes down, you'll never receive this event.
onNetworkConnectionReconnectThis event is only fired if the network had gone down and then came back up. At this point, a timer is set to be fired after 60 seconds that would fire this event. While you may eventually receive this event, having the user/viewer wait a full minute is probably not a good user experience.
The intent of this event is to be doubly (or trebly) sure that the network is stable before firing this event, so any subscribers could be totally certain that it would then be ok to fire off a request.
Now, the best way to handle network disconnection states is to listen for the
onNetworkHideDialog event. This is a newer event, and most frameworks won't have it yet. However, it is possible to handle a physical network disconnect in a legacy manner by listening to the
onNetworkConnectionDisconnect and
onNetworkConnectionStillDisconnected events.
CODE
onNetworkConnectionDisconnect: function(event) {
KONtx.application.previousView();
//KONtx.mediaplayer.control.stop(); //maybe a good idea to stop the player;
event.preventDefault();
},
onNetworkConnectionStillDisconnected: function(event) {
event.preventDefault();
},
Note that you should only subscribe/unsubscribe these handlers in your fullscreen video view.
View the
source.