ryanheise / just_audio

Audio Player
1.03k stars 647 forks source link

AudioPlayer._setPlatformActive.setPlatform Null check operator used on a null value #1120

Open under3415 opened 10 months ago

under3415 commented 10 months ago

Which API doesn't behave as documented, and how does it misbehave? AudioPlayer._setPlatformActive.setPlatform throws "Null check operator used on a null value" error

Minimal reproduction project "The example"

I cannot reproduce this bug. This occurs "in the wild", I get this error in crashlytics, quite regularly. Last time on Galaxy A03 Core on Android 12, but no rules, different devices and versions

To Reproduce (i.e. user steps, not code) Steps to reproduce the behavior:

  1. Play a short sound. In vast majority of cases this works fine, but sometimes it errors. This is my code where the error is triggered:
    try {
            await _soundPlayer.setAsset('assets/sounds/change_sides.mp3');
            _soundPlayer.play();
    } catch (ex, st) {
            FirebaseCrashlytics.instance
                .recordError(ex, st, reason: 'soundPlayerSides');
    }

Error messages

Non-fatal Exception: io.flutter.plugins.firebase.crashlytics.FlutterError: Null check operator used on a null value. Error thrown soundPlayerSides.
       at AudioPlayer._setPlatformActive.setPlatform + 1436(just_audio.dart:1436)

Expected behavior Handle a null or prevent the null from occurring? I don't really understand what is going on here, does not seem to be related to my code.

Screenshots N/A

Desktop (please complete the following information): N/A

Smartphone (please complete the following information):

Flutter SDK version

just_audio: ^0.9.35
[√] Flutter (Channel stable, 3.13.9, on Microsoft Windows [Version 10.0.22631.2506], locale en-NZ)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[√] Chrome - develop for the web
[√] Android Studio (version 2022.3)
[√] VS Code (version 1.84.2)
[√] Connected device (3 available)
[√] Network resources

Additional context Sorry I cannot replicate this. Feel free to close if this is not useful.

rymesaint commented 4 months ago

this also happen to me

bthnkckalpamis commented 4 months ago

hi, any updates? @ryanheise @under3415

ryanheise commented 4 months ago

I need someone to submit a bug report with a minimal reproduction project and steps to reproduce.

wangxp423 commented 3 months ago

this also happen to me,so how to resolve it ?

under3415 commented 3 months ago

I don't know how to replicate this issue. It happens infrequently in the wild

louisdeveseleer commented 2 weeks ago

I have the same issue: _TypeError: Null check operator used on a null value in just_audio.dart in AudioPlayer._setPlatformActive.setPlatform at line 1465 within just_audio

It is not reproducible: it happens in production "in the wild" but not during development.

I haven't been able to identify a specific pattern: it happens on any Android version, and any device (does not happen on iOS).

In the last month, it has affected 5% of my active users (37k) at least one time.

It's been happening at least as far back as May 2023.

@ryanheise If I can provide any extra information or do some tests to help you debug this issue, please let me know!