Skip to content

Commit

Permalink
[audioplayers] Fix play() didn't work after setSource() (#762)
Browse files Browse the repository at this point in the history
  • Loading branch information
JSUYA authored Nov 4, 2024
1 parent 5fbf478 commit d5f304e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 13 deletions.
3 changes: 2 additions & 1 deletion packages/audioplayers/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## NEXT
## 3.0.2

* Update minimum Flutter and Dart version to 3.13 and 3.1.
* Fix play() didn't work after setSource().

## 3.0.1

Expand Down
4 changes: 2 additions & 2 deletions packages/audioplayers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ This package is not an _endorsed_ implementation of `audioplayers`. Therefore, y
```yaml
dependencies:
audioplayers: ^5.1.0
audioplayers_tizen: ^3.0.1
audioplayers_tizen: ^3.0.2

```

Expand Down Expand Up @@ -69,4 +69,4 @@ For detailed information on Tizen privileges, see [Tizen Docs: API Privileges](h
## Limitations

- `onPlayerComplete` event will not be fired when `ReleaseMode` is set to loop which differs from the behavior specified in the [documentation](https://pub.dev/documentation/audioplayers/latest/audioplayers/AudioPlayer/onPlayerComplete.html). And playback rate will reset to 1.0 when audio is replayed.
- `setVolume` will have no effect on TV devices.
- `setVolume` will have no effect on TV devices.
2 changes: 1 addition & 1 deletion packages/audioplayers/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: audioplayers_tizen
description: Tizen implementation of the audioplayers plugin.
homepage: https://github.com/flutter-tizen/plugins
repository: https://github.com/flutter-tizen/plugins/tree/master/packages/audioplayers
version: 3.0.1
version: 3.0.2

environment:
sdk: ">=3.1.0 <4.0.0"
Expand Down
16 changes: 7 additions & 9 deletions packages/audioplayers/tizen/src/audio_player.cc
Original file line number Diff line number Diff line change
Expand Up @@ -138,17 +138,15 @@ void AudioPlayer::Seek(int32_t position) {
}

void AudioPlayer::SetUrl(const std::string &url) {
if (url != url_) {
url_ = url;
ResetPlayer();

int ret = player_set_uri(player_, url.c_str());
if (ret != PLAYER_ERROR_NONE) {
throw AudioPlayerError("player_set_uri failed", get_error_message(ret));
}
url_ = url;
ResetPlayer();

PreparePlayer();
int ret = player_set_uri(player_, url.c_str());
if (ret != PLAYER_ERROR_NONE) {
throw AudioPlayerError("player_set_uri failed", get_error_message(ret));
}

PreparePlayer();
audio_data_.clear();
}

Expand Down

0 comments on commit d5f304e

Please sign in to comment.