Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[audioplayers] Fix play() didn't work after setSource() #762

Merged
merged 1 commit into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading