Skip to content

Commit

Permalink
Ensure event/dataEvent platform streams are broadcast streams.
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanheise committed Jul 17, 2021
1 parent f3371d8 commit 1b71307
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions just_audio_background/lib/just_audio_background.dart
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ class _JustAudioBackgroundPlugin extends JustAudioPlatform {
}

class _JustAudioPlayer extends AudioPlayerPlatform {
final eventController = StreamController<PlaybackEventMessage>();
final playerDataController = StreamController<PlayerDataMessage>();
final eventController = StreamController<PlaybackEventMessage>.broadcast();
final playerDataController = StreamController<PlayerDataMessage>.broadcast();
bool? _playing;
int? _index;
Duration? _duration;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ abstract class AudioPlayerPlatform {

AudioPlayerPlatform(this.id);

/// A stream of playback events.
/// A broadcast stream of playback events.
Stream<PlaybackEventMessage> get playbackEventMessageStream {
throw UnimplementedError(
'playbackEventMessageStream has not been implemented.');
}

/// A stream of data updates.
/// A broadcast stream of data updates.
Stream<PlayerDataMessage> get playerDataMessageStream =>
Stream<PlayerDataMessage>.empty();

Expand Down
4 changes: 2 additions & 2 deletions just_audio_web/lib/just_audio_web.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ class JustAudioPlugin extends JustAudioPlatform {

/// The web impluementation of [AudioPlayerPlatform].
abstract class JustAudioPlayer extends AudioPlayerPlatform {
final _eventController = StreamController<PlaybackEventMessage>();
final _dataEventController = StreamController<PlayerDataMessage>();
final _eventController = StreamController<PlaybackEventMessage>.broadcast();
final _dataEventController = StreamController<PlayerDataMessage>.broadcast();
ProcessingStateMessage _processingState = ProcessingStateMessage.idle;
bool _playing = false;
int? _index;
Expand Down

0 comments on commit 1b71307

Please sign in to comment.