Skip to content

Audio not working in iOS 17 for UrlSource #1663

@sibias

Description

@sibias

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

After update to ios 17, play() function fails with following exception. However the same code was working fine in android as well as ios 16.

[VERBOSE-2:dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(DarwinAudioError, Failed to set source. For troubleshooting, see https://github.com/bluefireteam/audioplayers/blob/main/troubleshooting.md, AVPlayerItem.Status.failed on setSourceUrl, null)

Any .mp3 file with following code produces the above exception

AudioPlayer.global.setAudioContext(AudioContextConfig().build());
final player = AudioPlayer();
ByteData res = await rootBundle.load('assets/test.mp3');
await player.play(UrlSource(Uri.dataFromBytes(res.buffer.asUint8List(), mimeType: "audio/mpeg").toString()), volume: 1);

Expected behaviour

Play the .mp3 file

Steps to reproduce

  1. Execute flutter run on the code sample
  2. ...
  3. ...

Code sample

Code sample
void main() {
}

Affected platforms

iOS

Platform details

iOS 17

AudioPlayers Version

5.0.0

Build mode

debug

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

Problem is with UrlSource. When using asset source on iOS 17, it is working fine.

e.g. -
player.play(AssetSource('test.mp3'));

Working on PR

no way

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions