public void Update(Observable o, Java.Lang.Object arg) { if (arg != _player) { return; } OoyalaNotification notification = null; if (arg is OoyalaNotification) { notification = arg as OoyalaNotification; } var argString = OoyalaNotification.GetNameOrUnknown(arg); if (argString == OoyalaPlayer.TimeChangedNotificationName) { return; } if (argString == OoyalaPlayer.CurrentItemChangedNotificationName) { UpdateCustView(notification); } else if (argString == OoyalaPlayer.ErrorNotificationName) { var msg = "Error Event Received"; if (_player != null && _player.Error != null) { System.Diagnostics.Debug.WriteLine($"{msg}, {_player.Error}"); } else { System.Diagnostics.Debug.WriteLine(msg); } } if (argString == OoyalaPlayer.StateChangedNotificationName) { if (_player.IsInCastMode) { OoyalaPlayer.State state = _player.GetState(); _castViewManager.UpdateCastState(this, state); } } // Automation Hook: to write Notifications to a temporary file on the device/emulator var text = "Notification Received: " + argString + " - state: " + _player.GetState(); System.Diagnostics.Debug.WriteLine(text); }
public void UpdateCastState(Context c, OoyalaPlayer.State state) { var castDeviceName = CastManager.GetCastManager().DeviceName; if (state == OoyalaPlayer.State.Loading) { _stateTextView.Text = c.GetString(Resource.String.loading); } else if (state == OoyalaPlayer.State.Playing || state == OoyalaPlayer.State.Paused) { var statusString = $"{c.GetString(Resource.String.castingTo)} {castDeviceName}"; _stateTextView.Text = statusString; } else { _stateTextView.Text = ""; } }