Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Augment iAudioTrack with useful state change events #117

Open
wants to merge 5 commits into
base: 3.0
Choose a base branch
from

Conversation

codinronan
Copy link

@codinronan codinronan commented May 5, 2017

Basically, for change detection reasons my app needs access to these state changes so that I don't have to use setInterval. I need to be able to implement the OnPush change detection strategy, which is extremely hard when a setInterval is needed to detect changes to these objects.

The following events are added to IAudioTrack and implemented in both classes:

  onLoaded: Subject<IAudioTrack>;
  onPlaying: Subject<IAudioTrack>;
  onStop: Subject<IAudioTrack>;
  onPause: Subject<IAudioTrack>;
  onFinished: Subject<IAudioTrack>;
  onProgressChange: Subject<IAudioTrack>;
  onError: Subject<IAudioTrackError>;

...

export interface IAudioTrackError {
  track: IAudioTrack,
  error: ErrorEvent,
}

This also incorporates #115 so you'll see the same set of changes.

@arielfaur let me know what you think. I'm not convinced this is the best implementation but it is the most obvious.

@proustibat
Copy link

@codinronan thanks for reviewing my intents. This is exactly what I wanted.
@arielfaur let us know if theses changes are ok for you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants