Exemple #1
0
        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);
        }