public static void Notify(this IBackgroundMediaNotifier notifier, BackgroundNotificationType type, object value = null)
        {
            //Debug.WriteLine("NotifierExtensions.Notify() " + _id);

            var valueSet = new ValueSet {
                { type.ToString(), value }
            };

            notifier.Notify(valueSet);
        }
        public MediaPlayerHandle(CoreDispatcher dispatcher)
        {
            BackgroundSettings.RemoveForegroundId();

            _dispatcher = dispatcher;

            _notifier = new BackgroundNotifier(_id);

            _subscriptionHandle = new BackgroundSubscriptionHandle(OnMessageReceivedFromBackground);

            _notificationQueue = new ValueSetWorkerQueue(HandleNotification);

            BackgroundSettings.SetForegroundId(_id);
        }
Esempio n. 3
0
        public MediaPlayerHandle(CoreDispatcher dispatcher)
        {
            BackgroundSettings.RemoveForegroundId();

            _dispatcher = dispatcher;

            _notifier = new BackgroundNotifier(_id);

            _subscriptionHandle = new BackgroundSubscriptionHandle(OnMessageReceivedFromBackground);

            _notificationQueue = new ValueSetWorkerQueue(HandleNotification);

            BackgroundSettings.SetForegroundId(_id);
        }
Esempio n. 4
0
        public MediaPlayerSession(MediaPlayer mediaPlayer, Guid backgroundId, IBackgroundMediaNotifier notifier,
            Action<MediaPlayer, object> onCurrentStateChanged)
        {
            if (null == mediaPlayer)
                throw new ArgumentNullException("mediaPlayer");
            if (null == notifier)
                throw new ArgumentNullException("notifier");
            if (null == onCurrentStateChanged)
                throw new ArgumentNullException("onCurrentStateChanged");

            MediaPlayer = mediaPlayer;
            _backgroundId = backgroundId;
            _notifier = notifier;
            _onCurrentStateChanged = onCurrentStateChanged;

            SubscribeMediaPlayer();
        }
Esempio n. 5
0
        public MediaPlayerSession(MediaPlayer mediaPlayer, Guid backgroundId, IBackgroundMediaNotifier notifier,
                                  Action <MediaPlayer, object> onCurrentStateChanged)
        {
            if (null == mediaPlayer)
            {
                throw new ArgumentNullException("mediaPlayer");
            }
            if (null == notifier)
            {
                throw new ArgumentNullException("notifier");
            }
            if (null == onCurrentStateChanged)
            {
                throw new ArgumentNullException("onCurrentStateChanged");
            }

            MediaPlayer            = mediaPlayer;
            _backgroundId          = backgroundId;
            _notifier              = notifier;
            _onCurrentStateChanged = onCurrentStateChanged;

            SubscribeMediaPlayer();
        }