Assets_audio_player PlatformException(PLAY_ERROR

Viewed 309

error in IOS:

flutter: PlatformException(PLAY_ERROR, Cannot play assets/audio/001.mp3, The operation could not be completed, null) [VERBOSE-2:ui_dart_state.cc(209)] Unhandled Exception: PlatformException(PLAY_ERROR, Cannot play assets/audio/001.mp3, The operation could not be completed, null)

code is as below.

await CommonPlayer.assetsAudioPlayer.open(
       Playlist(
          audios: [
            Audio(
              "assets/audio/001.mp3",
              metas: Metas(
                title: trackone_text,
                artist: aboutTitleText,
                album: trackone_text,
                image: MetasImage.asset(
                    "assets/images/bgForPlayer.png"), //can be MetasImage.network
              ),
            ),
            Audio(
              "assets/audio/002.mp3",
              metas: Metas(
                title: introduction_text,
                artist: aboutTitleText,
                album: introduction_text,
                image: MetasImage.asset(
                    "assets/images/bgForPlayer.png"), //can be MetasImage.network
              ),
            )
          ],
        ),
        autoStart: false,
        loopMode: LoopMode.none,
        showNotification: true);

I added /assets/audio in pubspec.yaml

1 Answers

have you added your assets in pub spec yaml? you have to mention each directory, as for your case

- assets/images/
- assets/audio/
Related