Skip to content

Commit

Permalink
potential fix for: #1118, #1384
Browse files Browse the repository at this point in the history
  • Loading branch information
Gustl22 committed Apr 17, 2023
1 parent df43b19 commit c2ea6d1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/audioplayers_windows/windows/audio_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,17 @@ void AudioPlayer::OnMediaStateChange(
}
}

void AudioPlayer::OnPrepared() {
if (this->_eventChannel) {
this->_eventHandler->Success(
std::make_unique<flutter::EncodableValue>(flutter::EncodableMap(
{{flutter::EncodableValue("event"),
flutter::EncodableValue("audio.onPrepared")},
{flutter::EncodableValue("value"),
flutter::EncodableValue(true)}})));
}
}

void AudioPlayer::OnPlaybackEnded() {
SeekTo(0);
if (GetLooping()) {
Expand Down Expand Up @@ -165,6 +176,7 @@ void AudioPlayer::OnLog(const std::string& message) {
}

void AudioPlayer::SendInitialized() {
OnPrepared();
OnDurationUpdate();
OnTimeUpdate();
}
Expand Down
2 changes: 2 additions & 0 deletions packages/audioplayers_windows/windows/audio_player.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ class AudioPlayer {

void OnSeekCompleted();

void OnPrepared();

std::string _playerId;

flutter::MethodChannel<flutter::EncodableValue>* _methodChannel;
Expand Down

0 comments on commit c2ea6d1

Please sign in to comment.