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); }
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(); }
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(); }