PlaybackEvent default constructor parameters.

This commit is contained in:
Ryan Heise 2020-12-12 00:35:02 +11:00
parent 7a125149d9
commit fb7d33f0c6
1 changed files with 10 additions and 20 deletions

View File

@ -78,17 +78,7 @@ class AudioPlayer {
AudioPlayer._internal(this._id, bool handleInterruptions) AudioPlayer._internal(this._id, bool handleInterruptions)
: _platform = _init(_id) { : _platform = _init(_id) {
_playbackEvent = PlaybackEvent( _playbackEventSubject.add(_playbackEvent = PlaybackEvent());
processingState: ProcessingState.none,
updatePosition: Duration.zero,
updateTime: DateTime.now(),
bufferedPosition: Duration.zero,
duration: null,
icyMetadata: null,
currentIndex: null,
androidAudioSessionId: null,
);
_playbackEventSubject.add(_playbackEvent);
_processingStateSubject.addStream(playbackEventStream _processingStateSubject.addStream(playbackEventStream
.map((event) => event.processingState) .map((event) => event.processingState)
.distinct() .distinct()
@ -851,15 +841,15 @@ class PlaybackEvent {
final int androidAudioSessionId; final int androidAudioSessionId;
PlaybackEvent({ PlaybackEvent({
@required this.processingState, this.processingState = ProcessingState.none,
@required this.updateTime, DateTime updateTime,
@required this.updatePosition, this.updatePosition = Duration.zero,
@required this.bufferedPosition, this.bufferedPosition = Duration.zero,
@required this.duration, this.duration,
@required this.icyMetadata, this.icyMetadata,
@required this.currentIndex, this.currentIndex,
@required this.androidAudioSessionId, this.androidAudioSessionId,
}); }) : this.updateTime = updateTime ?? DateTime.now();
PlaybackEvent copyWith({ PlaybackEvent copyWith({
ProcessingState processingState, ProcessingState processingState,