How to use content uri as arturi in media item in just_audio

36 Views Asked by At

I am using on_audio_querry and just_audio and just_audio_background to fetch song from local storage and play the uri I'm getting from fetched songModel is content type and image is not showing when I assign that following way:

 List<SongModel> audios = await _audioQuery.querySongs(
      sortType: null,
      orderType: OrderType.ASC_OR_SMALLER,
      uriType: UriType.EXTERNAL,
      ignoreCase: true,
    );
    allSongs = audios;
    List<AudioSource> songs = [];
    for (var audio in audios) {
      songs.add(AudioSource.file(audio.data,
          tag: MediaItem(
              id: audio.id.toString(),
              title: audio.title,
              artist: audio.artist,
              // artUri: Uri.parse(
              //     "https://i.postimg.cc/yYJnN2Dk/beautiful-pictures-beautiful-landscapes-great-design-any-purposes-beautiful-wallpaper-white-color-ba.avif"),
              artUri: Uri.parse(audio.uri!))));
    }
    playlist = ConcatenatingAudioSource(
      // Start loading next item just before reaching it
      useLazyPreparation: true,
      // Customise the shuffle algorithm
      shuffleOrder: DefaultShuffleOrder(),
      // Specify the playlist items
      children: songs,
    );
    await _audioPlayer.setAudioSource(playlist,
        initialIndex: 0, initialPosition: Duration.zero);

I want to show image using arturi in notification when I play song using just audio background.

0

There are 0 best solutions below