Skip to content

PlatformException(DarwinAudioError, AVPlayerItem.Status.failed on setSourceUrl, #1546

@lurongshuang

Description

@lurongshuang

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

^[[31mAudioPlayers Exception: AudioPlayerException(
DeviceFileSource(path: /var/mobile/Containers/Data/Application/05BFE1FD-0371-4C27-A279-38645C04E5C3/Library/Caches/recording.aac),
PlatformException(DarwinAudioError, AVPlayerItem.Status.failed on setSourceUrl, null, null)<…>
[VERBOSE-2:dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(DarwinAudioError, AVPlayerItem.Status.failed on setSourceUrl, null, null)

Expected behaviour

await _player.setSourceDeviceFile(fileUrl);
_player.play(source);

Steps to reproduce

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

Code sample

  void playAudioWithFile(String fileUrl,
      {Function? onPlaying, Function? onPlayCompleted}) async{
    this.onPlaying = onPlaying;
    this.onPlayCompleted = onPlayCompleted;
    DeviceFileSource source = DeviceFileSource(fileUrl);

    await _player.setSourceDeviceFile(fileUrl);
    _player.play(source);
  }

Affected platforms

iOS

Platform details

Android 正常
ios 报错

AudioPlayers Version

audioplayers: ^4.1.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

No response

Working on PR

no way

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugplatform-iosAffects the ios platformwaiting for reportWait for the author to respond to the conversation

    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