public PlaybackController(IAudioPlayer audioPlayer, IRequestExecutor requestExecutor) { this.audioPlayerProxy = new StatefullAudioPlayer(audioPlayer); this.requestExecutor = new RequestExecutionAdapter(requestExecutor); audioPlayerProxy.EndOfStreamReached += new EventHandler <EndOfStreamReachedEventArgs>(audioPlayerProxy_EndOfStreamReached); //bring the position to zero if we reach the end of stream audioPlayerProxy.CurrentPositionObservable .Where(_ => audioPlayerProxy.Status == MediaStatus.Running) .Where(currentPosition => currentPosition == audioPlayerProxy.CurrentTrackDuration) .Subscribe(_ => audioPlayerProxy.SkipTo(0)); audioPlayerProxy.CurrentPositionObservable .Where(_ => audioPlayerProxy.Status == MediaStatus.Running) .Select(_ => audioPlayerProxy.CurrentTrackDuration) .Where(duration => duration > 0) .DistinctUntilChanged() .Subscribe(duration => { currentDurationObservable.OnNext(duration); currentMix.GetCurrentTrack().Duration = audioPlayerProxy.CurrentTrackDuration; }); currentMixObservable.OnNext(Mix.NoMixAvailable); }
public void SetUp() { origSched = RxApp.DeferredScheduler; RxApp.DeferredScheduler = new TestScheduler(); statefullAudioPlayer = new StatefullAudioPlayer(new AudioPlayerStub()); properAudioFilePath = @"..\..\..\..\Data\Audio files\XAqxNO.48k.v3.m4a"; }