protected override void OnStop() { base.OnStop(); LogHelper.Debug(Tag, "Activity onStop"); SupportMediaController?.UnregisterCallback(mediaControllerCallback); mediaBrowser.Disconnect(); }
public override void OnMediaControllConnected() { if (voiceSearchParams != null) { var query = voiceSearchParams.GetString(Android.App.SearchManager.Query); SupportMediaController.GetTransportControls().PlayFromSearch(query, voiceSearchParams); voiceSearchParams = null; } //TODO: CurrentFragment.OnConnected(); }
private void OnItemClick(object sender, MediaBrowserCompat.MediaItem item) { if (item.IsPlayable) { SupportMediaController.GetTransportControls() .PlayFromMediaId(item.MediaId, null); var intent = new Intent(this, typeof(MainActivity)); StartActivity(intent); } }
protected override void OnStop() { base.OnStop(); var mediaBrowser = MediaBrowser; if (mediaBrowser != null && mediaBrowser.IsConnected && mediaId != null) { mediaBrowser.Unsubscribe(mediaId); } SupportMediaController?.UnregisterCallback(mediaControllerCallback); }
protected override void OnStop() { base.OnStop(); LogHelper.Debug(Tag, "Activity onStop"); SupportMediaController?.UnregisterCallback(mediaControllerCallback); if (mediaBrowser != null && mediaBrowser.IsConnected && mediaId != null) { mediaBrowser.Unsubscribe(mediaId); } mediaBrowser?.Disconnect(); }
public void OnConnected() { mediaId = MediaBrowser.Root; // Unsubscribing before subscribing is required if this mediaId already has a subscriber // on this MediaBrowser instance. Subscribing to an already subscribed mediaId will replace // the callback, but won't trigger the initial callback.onChildrenLoaded. // // This is temporary: A bug is being fixed that will make subscribe // consistently call onChildrenLoaded initially, no matter if it is replacing an existing // subscriber or not. Currently this only happens if the mediaID has no previous // subscriber or if the media content changes on the service side, so we need to // unsubscribe first. MediaBrowser.Unsubscribe(mediaId); MediaBrowser.Subscribe(mediaId, subscriptionCallback); // Add MediaController callback so we can redraw the list when metadata changes: SupportMediaController?.RegisterCallback(mediaControllerCallback); }
protected override void OnStop() { base.OnStop(); SupportMediaController?.UnregisterCallback(callBack); MediaBrowser.Disconnect(); }
private void PlayFromMediaId(string mediaId) { SupportMediaController.GetTransportControls() .PlayFromMediaId(mediaId, null); }
private void PauseMedia() { SupportMediaController?.GetTransportControls().Pause(); }
private void PlayMedia() { SupportMediaController?.GetTransportControls().Play(); }