Skip to content

Commit

Permalink
Merge branch 'feature/coverage' into minor
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanheise committed Feb 1, 2025
2 parents e9f1e6e + 57c73e0 commit 1b47c6e
Show file tree
Hide file tree
Showing 2 changed files with 153 additions and 49 deletions.
42 changes: 33 additions & 9 deletions just_audio/lib/just_audio.dart
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,10 @@ class AudioPlayer {
/// false.
bool get allowsExternalPlayback => _allowsExternalPlayback;

/// The `crossorigin` attribute set the `<audio>` element backing this player
/// instance on web.
WebCrossOrigin? get webCrossOrigin => _webCrossOrigin;

/// The current position of the player.
Duration get position => _getPositionFor(_playbackEvent);

Expand Down Expand Up @@ -644,18 +648,14 @@ class AudioPlayer {
StreamSubscription<Duration?>? durationSubscription;
StreamSubscription<PlaybackEvent>? playbackEventSubscription;
void yieldPosition(Timer timer) {
if (controller.isClosed) {
if (controller.isClosed || _durationSubject.isClosed) {
timer.cancel();
durationSubscription?.cancel();
playbackEventSubscription?.cancel();
return;
}
if (_durationSubject.isClosed) {
timer.cancel();
durationSubscription?.cancel();
playbackEventSubscription?.cancel();
// This will in turn close _positionSubject.
controller.close();
if (!controller.isClosed) {
// This will in turn close _positionSubject.
controller.close();
}
return;
}
if (playing) {
Expand Down Expand Up @@ -3718,6 +3718,30 @@ class _IdleAudioPlayer extends AudioPlayerPlatform {
AndroidLoudnessEnhancerSetTargetGainRequest request) async {
return AndroidLoudnessEnhancerSetTargetGainResponse();
}

@override
Future<AndroidEqualizerBandSetGainResponse> androidEqualizerBandSetGain(
AndroidEqualizerBandSetGainRequest request) async {
return AndroidEqualizerBandSetGainResponse();
}

@override
Future<AndroidEqualizerGetParametersResponse> androidEqualizerGetParameters(
AndroidEqualizerGetParametersRequest request) async {
return AndroidEqualizerGetParametersResponse(
parameters: AndroidEqualizerParametersMessage(
minDecibels: 0.0,
maxDecibels: 10.0,
bands: [],
),
);
}

@override
Future<SetAllowsExternalPlaybackResponse> setAllowsExternalPlayback(
SetAllowsExternalPlaybackRequest request) async {
return SetAllowsExternalPlaybackResponse();
}
}

/// Holds the initial requested position and index for a newly loaded audio
Expand Down
Loading

0 comments on commit 1b47c6e

Please sign in to comment.