ryanheise / just_audio

Audio Player
1.04k stars 671 forks source link

getting crash in iOS while adding MediaItem to playlist #1059

Open priyesh-bit opened 1 year ago

priyesh-bit commented 1 year ago

Minimal reproduction project

  1. Download audi_handler.dart and page_manager.dart which I'm using for managing just audio and audio services related functions.

In my case ios simulator and real device iPhone 14 getting crash when I'm adding songs to playlist. In Android devices, it's working fine. I noticed this issue after updating to flutter 3.13.2 . Any idea about this crash in ios 16.6.1

**To Reproduce

 @override
  Future<void> addQueueItems(List<MediaItem> mediaItems) async {
    _playlist = ConcatenatingAudioSource(children: []);
    await _player.setAudioSource(_playlist);

    // manage Just Audio
    final audioSource = mediaItems.map((e) => _createAudioSource(e),).toList();
    _playlist.addAll(audioSource.toList()); /// crash is happening on this line only 

    // // notify system
    final newQueue = queue.value..addAll(mediaItems);
    queue.add(newQueue);
  }

  UriAudioSource _createAudioSource(MediaItem mediaItem) {
    return AudioSource.uri(
      Uri.parse(mediaItem.id),
      tag: mediaItem,
    );
  }

Media Item

{id: https://bazawala.com/uploads/music/audio/ff457FYHoao6VwpVnFkfHRAoLpTr1wONCahjpA1a.mp3, title: Wai Wai Charo, album: , artist: null, genre: null, duration: null, artUri: https://bazawala.com/uploads/music/image/hdyGA9DBLuGUj7eeQ3zb3yCOCfPPgoD0YvXDx05I.jpg, playable: true, displayTitle: null, displaySubtitle: null, displayDescription: null, rating: null, extras: {song_meta: {id: 2075, title: Wai Wai Charo, music: uploads/music/audio/ff457FYHoao6VwpVnFkfHRAoLpTr1wONCahjpA1a.mp3, image: uploads/music/image/hdyGA9DBLuGUj7eeQ3zb3yCOCfPPgoD0YvXDx05I.jpg, albums_id: , duration: 267, total_plays: 4, name: , song_file_name: null, type: music, artists: [{"id":586,"name":"Tshewang Toress","image":"uploads/artist/z4H0gN8n6D064gUjjFBbZXxjwaTE99G5qgTaL0hv.jpg"}], album: null}}}

Error messages

* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
    frame #0: 0x000000010776c8c0 Flutter`impeller::ContentsFilterInput::GetCoverage(impeller::Entity const&) const + 4
Flutter`impeller::ContentsFilterInput::GetCoverage:
->  0x10776c8c0 <+4>:  ldr    x9, [x0]
    0x10776c8c4 <+8>:  ldr    x2, [x9, #0x18]
    0x10776c8c8 <+12>: br     x2
Flutter`impeller::FilterContentsFilterInput::~FilterContentsFilterInput:
    0x10776c8cc <+0>:  stp    x20, x19, [sp, #-0x20]!
Target 0: (Runner) stopped.

Expected behavior Audio player should start playing songs same as android devices

Desktop (please complete the following information):

Smartphone (please complete the following information):

Flutter SDK version

[✓] Flutter (Channel stable, 3.13.2, on macOS 13.4 22F66 darwin-arm64, locale en-IN)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 14.3.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.3)
[✓] VS Code (version 1.81.1)
[✓] Connected device (4 available)
[✓] Network resources

• No issues found!
github-actions[bot] commented 1 year ago

Oops, it appears that your issue did not follow the template and is missing one or more required sections. Please open a new issue, and provide all required sections and information.

FAQ:

  1. Do I really need to submit a minimal reproduction project for a bug? A: Yes. I prioritise bugs secondarily on how many people are affected, and primarily on whether the bug report is complete, in the sense that it enables me to immediately reproduce it and start working on a fix. If a bug is important to you, the best thing you can do is to provide all requested information ASAP so that I can start looking into it ASAP.

  2. I think I supplied all required information, so did the bot make a mistake? A: The bot only checks the section headings, so when you post a new issue, make sure you leave the section headings intact. (Note that because of this, it is even possible to trick the bot by including only the section headings, and then not providing the requested information under each heading. This is frowned upon, and the issue will be closed manually.)

github-actions[bot] commented 1 year ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs, or use StackOverflow if you need help with just_audio.