mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-13 16:05:18 +00:00
fix: remove unnecessary broadcast stream conversions
This commit is contained in:
parent
e1c0f5cf1e
commit
bf04962e90
@ -4,40 +4,40 @@ mixin SpotubeAudioPlayersStreams on AudioPlayerInterface {
|
|||||||
// stream getters
|
// stream getters
|
||||||
Stream<Duration> get durationStream {
|
Stream<Duration> get durationStream {
|
||||||
// if (mkSupportedPlatform) {
|
// if (mkSupportedPlatform) {
|
||||||
return _mkPlayer.streams.duration.asBroadcastStream();
|
return _mkPlayer.streams.duration;
|
||||||
// } else {
|
// } else {
|
||||||
// return _justAudio!.durationStream
|
// return _justAudio!.durationStream
|
||||||
// .where((event) => event != null)
|
// .where((event) => event != null)
|
||||||
// .map((event) => event!)
|
// .map((event) => event!)
|
||||||
// .asBroadcastStream();
|
// ;
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
Stream<Duration> get positionStream {
|
Stream<Duration> get positionStream {
|
||||||
// if (mkSupportedPlatform) {
|
// if (mkSupportedPlatform) {
|
||||||
return _mkPlayer.streams.position.asBroadcastStream();
|
return _mkPlayer.streams.position;
|
||||||
// } else {
|
// } else {
|
||||||
// return _justAudio!.positionStream.asBroadcastStream();
|
// return _justAudio!.positionStream;
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
Stream<Duration> get bufferedPositionStream {
|
Stream<Duration> get bufferedPositionStream {
|
||||||
// if (mkSupportedPlatform) {
|
// if (mkSupportedPlatform) {
|
||||||
// audioplayers doesn't have the capability to get buffered position
|
// audioplayers doesn't have the capability to get buffered position
|
||||||
return _mkPlayer.streams.buffer.asBroadcastStream();
|
return _mkPlayer.streams.buffer;
|
||||||
// } else {
|
// } else {
|
||||||
// return _justAudio!.bufferedPositionStream.asBroadcastStream();
|
// return _justAudio!.bufferedPositionStream;
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
Stream<void> get completedStream {
|
Stream<void> get completedStream {
|
||||||
// if (mkSupportedPlatform) {
|
// if (mkSupportedPlatform) {
|
||||||
return _mkPlayer.streams.completed.asBroadcastStream();
|
return _mkPlayer.streams.completed;
|
||||||
// } else {
|
// } else {
|
||||||
// return _justAudio!.playerStateStream
|
// return _justAudio!.playerStateStream
|
||||||
// .where(
|
// .where(
|
||||||
// (event) => event.processingState == ja.ProcessingState.completed)
|
// (event) => event.processingState == ja.ProcessingState.completed)
|
||||||
// .asBroadcastStream();
|
// ;
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,51 +52,46 @@ mixin SpotubeAudioPlayersStreams on AudioPlayerInterface {
|
|||||||
100)
|
100)
|
||||||
.toInt(),
|
.toInt(),
|
||||||
)
|
)
|
||||||
.where((event) => event >= percent)
|
.where((event) => event >= percent);
|
||||||
.asBroadcastStream();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Stream<bool> get playingStream {
|
Stream<bool> get playingStream {
|
||||||
// if (mkSupportedPlatform) {
|
// if (mkSupportedPlatform) {
|
||||||
return _mkPlayer.streams.playing.asBroadcastStream();
|
return _mkPlayer.streams.playing;
|
||||||
// } else {
|
// } else {
|
||||||
// return _justAudio!.playingStream.asBroadcastStream();
|
// return _justAudio!.playingStream;
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
Stream<bool> get shuffledStream {
|
Stream<bool> get shuffledStream {
|
||||||
// if (mkSupportedPlatform) {
|
// if (mkSupportedPlatform) {
|
||||||
return _mkPlayer.shuffleStream.asBroadcastStream();
|
return _mkPlayer.shuffleStream;
|
||||||
// } else {
|
// } else {
|
||||||
// return _justAudio!.shuffleModeEnabledStream.asBroadcastStream();
|
// return _justAudio!.shuffleModeEnabledStream;
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
Stream<PlaybackLoopMode> get loopModeStream {
|
Stream<PlaybackLoopMode> get loopModeStream {
|
||||||
// if (mkSupportedPlatform) {
|
// if (mkSupportedPlatform) {
|
||||||
return _mkPlayer.loopModeStream
|
return _mkPlayer.loopModeStream.map(PlaybackLoopMode.fromPlaylistMode);
|
||||||
.map(PlaybackLoopMode.fromPlaylistMode)
|
|
||||||
.asBroadcastStream();
|
|
||||||
// } else {
|
// } else {
|
||||||
// return _justAudio!.loopModeStream
|
// return _justAudio!.loopModeStream
|
||||||
// .map(PlaybackLoopMode.fromLoopMode)
|
// .map(PlaybackLoopMode.fromLoopMode)
|
||||||
// .asBroadcastStream();
|
// ;
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
Stream<double> get volumeStream {
|
Stream<double> get volumeStream {
|
||||||
// if (mkSupportedPlatform) {
|
// if (mkSupportedPlatform) {
|
||||||
return _mkPlayer.streams.volume
|
return _mkPlayer.streams.volume.map((event) => event / 100);
|
||||||
.map((event) => event / 100)
|
|
||||||
.asBroadcastStream();
|
|
||||||
// } else {
|
// } else {
|
||||||
// return _justAudio!.volumeStream.asBroadcastStream();
|
// return _justAudio!.volumeStream;
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
Stream<bool> get bufferingStream {
|
Stream<bool> get bufferingStream {
|
||||||
// if (mkSupportedPlatform) {
|
// if (mkSupportedPlatform) {
|
||||||
return Stream.value(false).asBroadcastStream();
|
return Stream.value(false);
|
||||||
// } else {
|
// } else {
|
||||||
// return _justAudio!.playerStateStream
|
// return _justAudio!.playerStateStream
|
||||||
// .map(
|
// .map(
|
||||||
@ -104,17 +99,17 @@ mixin SpotubeAudioPlayersStreams on AudioPlayerInterface {
|
|||||||
// event.processingState == ja.ProcessingState.buffering ||
|
// event.processingState == ja.ProcessingState.buffering ||
|
||||||
// event.processingState == ja.ProcessingState.loading,
|
// event.processingState == ja.ProcessingState.loading,
|
||||||
// )
|
// )
|
||||||
// .asBroadcastStream();
|
// ;
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
Stream<AudioPlaybackState> get playerStateStream {
|
Stream<AudioPlaybackState> get playerStateStream {
|
||||||
// if (mkSupportedPlatform) {
|
// if (mkSupportedPlatform) {
|
||||||
return _mkPlayer.playerStateStream.asBroadcastStream();
|
return _mkPlayer.playerStateStream;
|
||||||
// } else {
|
// } else {
|
||||||
// return _justAudio!.playerStateStream
|
// return _justAudio!.playerStateStream
|
||||||
// .map(AudioPlaybackState.fromJaPlayerState)
|
// .map(AudioPlaybackState.fromJaPlayerState)
|
||||||
// .asBroadcastStream();
|
// ;
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -124,7 +119,7 @@ mixin SpotubeAudioPlayersStreams on AudioPlayerInterface {
|
|||||||
// } else {
|
// } else {
|
||||||
// return _justAudio!.sequenceStateStream
|
// return _justAudio!.sequenceStateStream
|
||||||
// .map((event) => event?.currentIndex ?? -1)
|
// .map((event) => event?.currentIndex ?? -1)
|
||||||
// .asBroadcastStream();
|
// ;
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user