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

PlatformException(AndroidAudioError, Failed to set source. #1797

Open
2 tasks done
mohsinnaqvi606 opened this issue May 7, 2024 · 2 comments
Open
2 tasks done

PlatformException(AndroidAudioError, Failed to set source. #1797

mohsinnaqvi606 opened this issue May 7, 2024 · 2 comments
Labels

Comments

@mohsinnaqvi606
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

Unable to handle exceptions thrown by native code after timeout (30 seconds).
Even native code is throwing this exception

AudioPlayers Exception: AudioPlayerException(
I/flutter (14893): 	UrlSource(url: https://carestratusdev.blob.core.windows.net/voicemail/2021/08/02/dd8e9379-cee9-4cac-8faa-6b948bcfb477.mp3?sv=2023-11-03&st=2024-05-07T06%3A56%3A50Z&se=2024-05-07T07%3A26%3A50Z&sr=b&sp=r&sig=F6wQwHVDhRaHE9YvWf5Ed6rUZmRTM047GWkZDL%2B1V1c%3D, mimeType: null), 
I/flutter (14893): 	PlatformException(AndroidAudioError, Failed to set source. For troubleshooting, see: https://github.com/bluefireteam/audioplayers/blob/main/troubleshooting.md, MEDIA_ERROR_UNKNOWN {what:1}, MEDIA_ERROR_SYSTEM, null)

Expected behaviour

There should be a way to set Timeout and then handle exceptions in Flutter. If there is an error in play audio (wrong URL), I want to show the error to the user and update the UI accordingly.

Steps to reproduce

  1. Execute flutter run on the code sample
  2. wait for 30 seconds (which is default timeout)

Code sample

Code sample
  void playAudio() async {

    String url = "https://carestratusdev.blob.core.windows.net/voicemail/2021/08/02/dd8e9379-cee9-4cac-8faa-6b948bcfb477.mp3?sv=2023-11-03&st=2024-05-07T06%3A56%3A50Z&se=2024-05-07T07%3A26%3A50Z&sr=b&sp=r&sig=F6wQwHVDhRaHE9YvWf5Ed6rUZmRTM047GWkZDL%2B1V1c%3D";

    AudioPlayer audioPlayer = AudioPlayer();

    /// reset values on completion
    audioPlayer.onPlayerComplete.listen((event) {});

    /// Get current value
    audioPlayer.onPositionChanged.listen((duration) {});

    /// Get total duration
    audioPlayer.onDurationChanged.listen((duration) {});

    audioPlayer.play(UrlSource(url));
  }

Affected platforms

Android, iOS

Platform details

  • Platform 1: IOS 17.3
  • Platform 2: Android 14
  • Platform 3: M2 mac mini

AudioPlayers Version

6.0.0

Build mode

debug, profile, release

Audio Files/URLs/Sources

Screenshots

image

Logs

Code block with 2-3 relevant log lines

I/flutter (14893): AudioPlayers Exception: AudioPlayerException(
I/flutter (14893): 	UrlSource(url: https://carestratusdev.blob.core.windows.net/voicemail/2021/08/02/dd8e9379-cee9-4cac-8faa-6b948bcfb477.mp3?sv=2023-11-03&st=2024-05-07T06%3A56%3A50Z&se=2024-05-07T07%3A26%3A50Z&sr=b&sp=r&sig=F6wQwHVDhRaHE9YvWf5Ed6rUZmRTM047GWkZDL%2B1V1c%3D, mimeType: null), 
I/flutter (14893): 	PlatformException(AndroidAudioError, Failed to set source. For troubleshooting, see: https://github.com/bluefireteam/audioplayers/blob/main/troubleshooting.md, MEDIA_ERROR_UNKNOWN {what:1}, MEDIA_ERROR_SYSTEM, null)
E/flutter (14893): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: 
Full Logs
E/MediaPlayerNative(14893): error (1, -2147483648)
E/MediaPlayer(14893): Error (1,-2147483648)
I/flutter (14893): AudioPlayers Exception: AudioPlayerException(
I/flutter (14893): 	UrlSource(url: https://carestratusdev.blob.core.windows.net/voicemail/2021/08/02/dd8e9379-cee9-4cac-8faa-6b948bcfb477.mp3?sv=2023-11-03&st=2024-05-07T06%3A56%3A50Z&se=2024-05-07T07%3A26%3A50Z&sr=b&sp=r&sig=F6wQwHVDhRaHE9YvWf5Ed6rUZmRTM047GWkZDL%2B1V1c%3D, mimeType: null), 
I/flutter (14893): 	PlatformException(AndroidAudioError, Failed to set source. For troubleshooting, see: https://github.com/bluefireteam/audioplayers/blob/main/troubleshooting.md, MEDIA_ERROR_UNKNOWN {what:1}, MEDIA_ERROR_SYSTEM, null)
E/flutter (14893): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(AndroidAudioError, Failed to set source. For troubleshooting, see: https://github.com/bluefireteam/audioplayers/blob/main/troubleshooting.md, MEDIA_ERROR_UNKNOWN {what:1}, MEDIA_ERROR_SYSTEM, null)
E/flutter (14893): 
E/flutter (14893): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(AndroidAudioError, Failed to set source. For troubleshooting, see: https://github.com/bluefireteam/audioplayers/blob/main/troubleshooting.md, MEDIA_ERROR_UNKNOWN {what:1}, MEDIA_ERROR_SYSTEM, null)
E/flutter (14893): 
V/MediaPlayer(14893): resetDrmState:  mDrmInfo=null mDrmProvisioningThread=null mPrepareDrmInProgress=false mActiveDrmScheme=false
V/MediaPlayer(14893): cleanDrmObj: mDrmObj=null mDrmSessionId=null
V/MediaPlayer(14893): resetDrmState:  mDrmInfo=null mDrmProvisioningThread=null mPrepareDrmInProgress=false mActiveDrmScheme=false
V/MediaPlayer(14893): cleanDrmObj: mDrmObj=null mDrmSessionId=null

Flutter doctor:

  • Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11572160)
  • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.3)
  • Xcode at /Applications/Xcode.app/Contents/Developer
  • Build 15E204a
  • CocoaPods version 1.15.2

[✓] Chrome - develop for the web
  • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2023.3)
  • Android Studio at /Applications/Android Studio.app/Contents
  • Flutter plugin can be installed from:
    🔨 https://plugins.jetbrains.com/plugin/9212-flutter
  • Dart plugin can be installed from:
    🔨 https://plugins.jetbrains.com/plugin/6351-dart
  • Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11572160)

[✓] Connected device (6 available)
  • Infinix X690B (mobile)      • 055832508C002250                     • android-arm64  • Android 10 (API 29)
  • sdk gphone64 arm64 (mobile) • emulator-5554                        • android-arm64  • Android 14 (API 34) (emulator)
  • iPhone (mobile)             • 00008020-00020CCC14BB002E            • ios            • iOS 17.4.1 21E236
  • iPhone 13 Pro Max (mobile)  • 9A44EAB2-9FE4-4ECB-B2AF-2AA9FB3F91E3 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-17-4 (simulator)
  • macOS (desktop)             • macos                                • darwin-arm64   • macOS 14.4.1 23E224 darwin-arm64
  • Chrome (web)                • chrome                               • web-javascript • Google Chrome 124.0.6367.119

[✓] Network resources
  • All expected network resources are available.

• No issues found!

Related issues / more information

No response

Working on PR

no way

@Gustl22
Copy link
Collaborator

Gustl22 commented May 13, 2024

Hi there. Did you check out the log stream?
https://github.com/bluefireteam/audioplayers/blob/main/getting_started.md#log-event

Best regards

@mohsinnaqvi606
Copy link
Author

Thanks for reference, I will look into this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants