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

[Android] Audio not playing #1706

Open
2 tasks done
docaohuynh opened this issue Nov 18, 2023 · 16 comments
Open
2 tasks done

[Android] Audio not playing #1706

docaohuynh opened this issue Nov 18, 2023 · 16 comments
Labels
bug platform-android Affects the android platform

Comments

@docaohuynh
Copy link

Checklist

  • I read the troubleshooting guide before raising this issue
  • I made sure that the issue I am raising doesn't already exist

Current bug behaviour

I run example code on actual device Oppo F1s (Android 6) but audio not playing
I try using another lib just_audio it working

Expected behaviour

Audio playing on Oppo F1s

Steps to reproduce

  1. Execute flutter run on the example code

Code sample

Code sample
void main() {
}

Affected platforms

Android

Platform details

Android 6 device Oppo F1s

AudioPlayers Version

latest

Build mode

release

Audio Files/URLs/Sources

No response

Screenshots

No response

Logs

my relevant logs
Full Logs
my full logs or a link to a gist

Flutter doctor:

Output of: flutter doctor -v

Related issues / more information

No response

Working on PR

no way

@docaohuynh docaohuynh added the bug label Nov 18, 2023
@Gustl22
Copy link
Collaborator

Gustl22 commented Nov 18, 2023

What audio are you playing? Can you state the source? Can you insert the logs plz? Thx :)

@Gustl22 Gustl22 added platform-android Affects the android platform waiting for report Wait for the author to respond to the conversation labels Nov 18, 2023
@docaohuynh
Copy link
Author

@Gustl22 I run on example source https://github.com/bluefireteam/audioplayers/tree/main/packages/audioplayers/example
It is not play any source at on. I was not seen logs in my device

@docaohuynh
Copy link
Author

I found some error logs may it help

AudioLogLevel.error: AudioPlayers Exception: AudioPlayerException(
UrlSource(url: https://luan.xyz/files/audio/nasa_on_a_mission.mp3), 
PlatformException(AndroidAudioError, MEDIA_ERROR_UNKNOWN {what:-38}, MEDIA_ERROR_UNKNOWN {extra:0}, null)
AudioLogLevel.error: AudioPlayers Exception: AudioPlayerException(
AssetSource(path: nasa_on_a_mission.mp3), 
PlatformException(AndroidAudioError, MEDIA_ERROR_UNKNOWN {what:-38}, MEDIA_ERROR_UNKNOWN {extra:0}, null)

@Gustl22
Copy link
Collaborator

Gustl22 commented Nov 20, 2023

Did you follow these steps: https://github.com/bluefireteam/audioplayers/blob/main/contributing.md#environment-setup ?
So you use the latest version on branch main?

Does it work on your emulator?

I tried it right now and the source is playing without issues. I cannot reproduce it :/

@docaohuynh
Copy link
Author

Did you follow these steps Yes
So you use the latest version on branch main? Yes

@Gustl22 I had tested on 4 devices but this only happened on Oppo F1s (android 6)

My flutter doctor

[✓] Flutter (Channel stable, 3.13.7, on macOS 13.4 22F66 darwin-x64, locale en-VN)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 14.3)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.3)
[✓] VS Code (version 1.84.2)
[✓] Connected device (2 available)
[✓] Network resources

@Gustl22
Copy link
Collaborator

Gustl22 commented Nov 20, 2023

Thanks @docaohuynh, do these devices run all on Android 6? Maybe this can be solved via #1526. I don't think it's directly related to AudioPlayers but rather a fault in the Android native implementation.

@Gustl22 Gustl22 removed the waiting for report Wait for the author to respond to the conversation label Nov 20, 2023
@docaohuynh
Copy link
Author

@Gustl22 Only Oppo F1s run Android 6 others Android 9, 12, 13. I don't have other device run on Android 6 to tested. waiting for ExoPlayer implement

@arreshashikant
Copy link

PlatformException(AndroidAudioError, MEDIA_ERROR_UNKNOWN {what:-38}, MEDIA_ERROR_UNKNOWN {extra:0}, null)

Happening on Pixel 4a, Android 13

[✓] Flutter (Channel stable, 3.13.9, on macOS 13.5.2 22G91 darwin-arm64, locale en-IN)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
[✓] Xcode - develop for iOS and macOS (Xcode 14.3.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.3)

audioplayers: ^5.2.0

@BrunoJay
Copy link

PlatformException(AndroidAudioError, MEDIA_ERROR_UNKNOWN {what:-38}, MEDIA_ERROR_UNKNOWN {extra:0}, null)

Happening on
OS version: android13
Model:Galaxy S21 FE 5G

audioplayers: ^5.2.0

@newproplus
Copy link

I found the same issue.

OS version: android12
audioplayers version: 5.2.1

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.16.3, on Debian GNU/Linux 12 (bookworm) 6.1.0-15-amd64, locale zh_CN.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Chrome - develop for the web
[✓] Linux toolchain - develop for Linux desktop
[✓] Android Studio (version 2022.3)
[✓] VS Code (version 1.85.0)
[✓] Connected device (3 available)
[✓] Network resources

• No issues found!

@serg10andres
Copy link

Same problem

@Kind-Unes
Copy link

any solutions ?

@Gustl22
Copy link
Collaborator

Gustl22 commented Apr 16, 2024

The solution is probably #1691, but it takes a while for Flutter to review all the necessary PRs.

@prajyotpdev
Copy link

Previously my code was like :
final audioPlayer = AudioPlayer();
audioPlayer.setSourceUrl("https://www.learningcontainer.com/wp-content/uploads/2020/02/Kalimba.mp3");
I ran thorugh error :
PlatformException(AndroidAudioError, Failed to set source. For troubleshooting

After sometime it trigggered as it was just async await issue of url. Since, url sends some data to audioplayer to play at first
It need sometime to init and which was causing the error of playing on the first step itself.
Simply putting
"await" helped me !!

solved code:
final audioPlayer = AudioPlayer();
await audioPlayer.setSourceUrl("https://www.learningcontainer.com/wp-content/uploads/2020/02/Kalimba.mp3");

@IRiS-Sk13
Copy link

@Gustl22
Any update on this, please? is the Exo player supported in Flutter?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug platform-android Affects the android platform
Projects
None yet
Development

No branches or pull requests

10 participants