Skip to content

Commit

Permalink
Merge branch 'initig-fix_ios_wrong_position_report'
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanheise committed Feb 13, 2022
2 parents b1a7d50 + a24d975 commit fde34ce
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
4 changes: 4 additions & 0 deletions just_audio/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.9.20

* Fix initial position on iOS/macOS when switching sources (@addie9000).

## 0.9.19

* Dispose players on iOS/macOS hot restart.
Expand Down
4 changes: 3 additions & 1 deletion just_audio/darwin/Classes/AudioPlayer.m
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,8 @@ - (void)broadcastPlaybackEvent {
}

- (int)getCurrentPosition {
// XXX: During load, the second case will be selected returning 0.
// TODO: Provide a similar case as _seekPos for _initialPos.
if (CMTIME_IS_VALID(_seekPos)) {
return (int)(1000 * CMTimeGetSeconds(_seekPos));
} else if (_indexedAudioSources && _indexedAudioSources.count > 0) {
Expand Down Expand Up @@ -578,7 +580,6 @@ - (void)load:(NSDictionary *)source initialPosition:(CMTime)initialPosition init
}
_loadResult = result;
_processingState = loading;
[self updatePosition];
_index = (initialIndex != (id)[NSNull null]) ? [initialIndex intValue] : 0;
// Remove previous observers
if (_indexedAudioSources) {
Expand Down Expand Up @@ -628,6 +629,7 @@ - (void)load:(NSDictionary *)source initialPosition:(CMTime)initialPosition init
[self addItemObservers:source.playerItem];
source.playerItem.audioSource = source;
}
[self updatePosition];
[self updateOrder];
// Set up an empty player
if (!_player) {
Expand Down
2 changes: 1 addition & 1 deletion just_audio/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: just_audio
description: A feature-rich audio player for Flutter. Loop, clip and concatenate any sound from any source (asset/file/URL/stream) in a variety of audio formats with gapless playback.
version: 0.9.19
version: 0.9.20
homepage: https://github.com/ryanheise/just_audio/tree/master/just_audio

environment:
Expand Down

0 comments on commit fde34ce

Please sign in to comment.