-
-
Notifications
You must be signed in to change notification settings - Fork 689
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NPE when loading the duration results back to Flutter #1372
Comments
Thanks. Based on the information provided I should be able to investigate it. (...after I get my new dev box up and running, which should hopefully be soon.) |
Hi @snipd-min , I've created a PR #1373 . Would you be able to confirm that this doesn't break anything on your end? |
Hi @ryanheise, thanks for the quick feedback! I've made a similar fix that we will soon roll out soon so we should see if the crash would stop happening. I didn't notice anything wrong from testing with the audio player. Will still probably test it in a few days to make sure nothing is wrong. Regarding the crash, although it's highly likely that it fixes that, it might take a while to see the affect in production as we would need to roll out the app and observe on Firebase. I can report it back asap though if it's still needed. One thing I'm not certain is if the line after the I have kept that line as I was a bit afraid if this could be somehow missed in |
I'd be inclined to leave it in as a sane initialiser. I'm not able to test things right now, but my thinking is that if there truly is buffering to happen,
Are there any material differences between your fix and this PR? |
Make sense, that was the only difference I have. |
I had a crash today pointing to the same exact line. I'm guessing it's coming from the same mentioned issue. Here's the crash log
|
I guess I can merge this fix, but @jvelezos would you be able to test it on your end to confirm that at the very least it does not break your app? |
@ryanheise Your PR is not breaking anything on my side 👍 |
Thanks for confirming, this has now been merged and released. |
Sorry, I mean merged, but not yet released. |
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. |
Which API doesn't behave as documented, and how does it misbehave?
In the
- (void)load:(NSDictionary *)source initialPosition:(CMTime)initialPosition initialIndex:(NSNumber *)initialIndex result:(FlutterResult)result
method, the_loadResult(@{@"duration": @([self getDurationMicroseconds])});
at line 693 could throw a NPE when the_loadResult
is already reported viaobserveValueForKeyPath
at line 814.I'm not sure if
observeValueForKeyPath
should ever report the duration before theload
method, but here in theory the_loadResult
could be set tonil
and should probably check for it before calling.Here I attached the crash log trace from xcode via the Organizer > Crashes:
Minimal reproduction project
Unfortunately I couldn't find a way to reproduce this after a lot of tries. I still feel like I should report it as it's quite clear what actually happened here (or should have happened). This only happens to a very small fraction of users that we have.
To Reproduce (i.e. user steps, not code)
Based on the breadcrumbs, it happens just by playing the audio.
Error messages
Expected behavior
In case the duration is already reported via
observeValueForKeyPath
, the_loadResult
doesn't need to be called and should just move on.Screenshots
N/A
Desktop (please complete the following information):
N/A
Smartphone (please complete the following information):
Flutter SDK version
[✓] Flutter (Channel stable, 3.24.3, on macOS 15.1.1 24B91 darwin-arm64, locale
en-US)
• Flutter version 3.24.3 on channel stable at
/Users/minzhao/fvm/versions/3.24.3
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 2663184aa7 (3 months ago), 2024-09-11 16:27:48 -0500
• Engine revision 36335019a8
• Dart version 3.5.3
• DevTools version 2.37.3
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
• Android SDK at /Users/minzhao/Library/Android/sdk
• Platform android-34, build-tools 33.0.1
• ANDROID_HOME = /Users/minzhao/Library/Android/sdk
• ANDROID_SDK_ROOT = /Users/minzhao/Library/Android/sdk
• Java binary at: /Applications/Android
Studio.app/Contents/jbr/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build
17.0.11+0-17.0.11b1207.24-11852314)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 16.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 16B40
• CocoaPods version 1.15.2
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2024.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build
17.0.11+0-17.0.11b1207.24-11852314)
[✓] VS Code (version 1.95.3)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.98.0
[✓] Network resources
• All expected network resources are available.
Additional context
N/A
The text was updated successfully, but these errors were encountered: