Skip to content
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

Fix video player crash #627

Open
ashitaprasad opened this issue Mar 2, 2025 · 22 comments · May be fixed by #647
Open

Fix video player crash #627

ashitaprasad opened this issue Mar 2, 2025 · 22 comments · May be fixed by #647
Labels

Comments

@ashitaprasad
Copy link
Member

ashitaprasad commented Mar 2, 2025

Describe the bug/problem

Launch API Dash

Paste the following URL in GET Request:
https://flutter.github.io/assets-for-api-docs/assets/videos/bee.mp4

Hit Send

Once the response is received, the App crashes due to some error in VideoPreviewer - https://github.com/foss42/apidash/blob/main/lib/widgets/video_previewer.dart

This issue requires analysis of the root cause of the crash & potential fix.

Setup - Apple M1 (Sonoma 14.6.1)

% flutter doctor -v
[✓] Flutter (Channel stable, 3.29.0, on macOS 14.6.1 23G93 darwin-arm64, locale en-IN) [271ms]
    • Flutter version 3.29.0 on channel stable at /Users/ap/Documents/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 35c388afb5 (3 weeks ago), 2025-02-10 12:48:41 -0800
    • Engine revision f73bfc4522
    • Dart version 3.7.0
    • DevTools version 2.42.2

[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0) [1,143ms]
    • Android SDK at /Users/ap/Library/Android/sdk
    • Platform android-35, build-tools 35.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
      This is the JDK bundled with the latest Android Studio installation on this machine.
      To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
    • 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 15.4) [603ms]
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15F31d
    • CocoaPods version 1.16.2

[✓] Chrome - develop for the web [28ms]
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2024.1) [28ms]
    • 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)

[✓] IntelliJ IDEA Community Edition (version 2023.1.2) [27ms]
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • 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

[✓] VS Code (version 1.97.2) [9ms]
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.104.0

[✓] Connected device (3 available) [6.9s]
    • macOS (desktop)                 • macos                 • darwin-arm64   • macOS 14.6.1 23G93 darwin-arm64
    • Mac Designed for iPad (desktop) • mac-designed-for-ipad • darwin         • macOS 14.6.1 23G93 darwin-arm64
    • Chrome (web)                    • chrome                • web-javascript • Google Chrome 133.0.6943.142
or associated
      with the same local area network as this Mac.
      The device must be opted into Developer Mode to connect wirelessly. (code -27)

[✓] Network resources [410ms]
    • All expected network resources are available.

• No issues found!
@ashitaprasad ashitaprasad added bug Something isn't working good first issue Good for newcomers priority: high and removed bug Something isn't working labels Mar 2, 2025
@AffanShaikhsurab
Copy link
Contributor

@ashitaprasad i am working on this issue

@ashitaprasad
Copy link
Member Author

Thanks @AffanShaikhsurab

@akshayw1
Copy link
Contributor

akshayw1 commented Mar 2, 2025

Interested to work on this, Can I work too on this issue @ashitaprasad ?

@AffanShaikhsurab
Copy link
Contributor

as i am not able to reproduce the issue in windows can you please let me knowif you were using web / windows / android it would be a great help @ashitaprasad

@ashitaprasad
Copy link
Member Author

Thanks for investigating @AffanShaikhsurab
The issue was observed in macOS platform and is yet to be checked on other platforms.

@ashitaprasad
Copy link
Member Author

Interested to work on this, Can I work too on this issue @ashitaprasad ?

@akshayw1 Do you use macOS?

@AffanShaikhsurab
Copy link
Contributor

i have check on android and windows and there is no issue there !! looks like its an mac specific issue but need to be tested on linux !!

@AffanShaikhsurab
Copy link
Contributor

Since I don't have access to macOS, I might be limited in resolving this issue effectively. it would be better for member with the appropriate setup to take this up!

@akshayw1
Copy link
Contributor

akshayw1 commented Mar 2, 2025

Interested to work on this, Can I work too on this issue @ashitaprasad ?

@akshayw1 Do you use macOS?

Yes, I use macOs air m2

@AffanShaikhsurab
Copy link
Contributor

@akshayw1 can you please check the logs and inspect what might have causing the issue ?

@divyanshkul
Copy link

Hi @ashitaprasad
I tried reproducing this issue on a arm silicon (M3) based mac. The video previewer seemed to be working fine in this case.
I have also tested another endpoint that serves .mp4 file, it worked for that as well.

System: Sequoia macOS 15.3.1
Flutter Version: 3.29.0
Dart SDK version: 3.7.0

PFA video demonstration:

test.mp4

Let me know if you need me to try any other scenario.

Thanks!

@AffanShaikhsurab
Copy link
Contributor

@ashitaprasad can you please specify what was the env that caused the issue ?

@ashitaprasad
Copy link
Member Author

@divyanshkul are you running it on the latest HEAD of the main branch?

@ashitaprasad
Copy link
Member Author

@ashitaprasad can you please specify what was the env that caused the issue ?

Updated the Issue description with all the details.

@divyanshkul
Copy link

divyanshkul commented Mar 3, 2025

@ashitaprasad Yes, I was running the latest HEAD till this 79788dc

[✓] Flutter (Channel stable, 3.29.0, on macOS 15.3.1 24D70 darwin-arm64, locale
    en-IN) [1,031ms]
    • Flutter version 3.29.0 on channel stable at
      /Users/divyansh/development/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 35c388afb5 (3 weeks ago), 2025-02-10 12:48:41 -0800
    • Engine revision f73bfc4522
    • Dart version 3.7.0
    • DevTools version 2.42.2

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) [2.4s]
    • Android SDK at /Users/divyansh/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
      This is the JDK bundled with the latest Android Studio installation on this machine.
      To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
    • 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.0) [2.2s]
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 16A242d
    • CocoaPods version 1.16.2

[✓] Chrome - develop for the web [9ms]
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2024.1) [9ms]
    • 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.97.2) [8ms]
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.104.0```

@ashitaprasad
Copy link
Member Author

@ashitaprasad Yes, I was running the latest HEAD till this 79788dc

Thanks for confirming @divyanshkul

@this-is-mjk
Copy link

this-is-mjk commented Mar 5, 2025

Hi @ashitaprasad ,
I tried to reproduce the issue locally (head till 1618b6c) with:
System: macOS 15.3.1 (24D70) Darwin-arm64 (Rosetta) (M2)
Flutter Version: 3.29.0
Dart SDK Version: 3.7.0
The preview was working fine, and no issues were found.
Let me know if there’s anything else I can check or any other scenario I can test to help.

@adityakumar-dev
Copy link

Hi @ashitaprasad,

I have tested this issue on Windows, and I was able to reproduce it.

Findings:
When the API Dash window is in normal size, the video previewer works correctly, allowing playback and controls.
When maximizing the window, the video freezes in the UI, but in the Flutter terminal logs, playback continues in the background.
The issue is not a crash, but rather a UI rendering issue triggered by window resizing.
System Details:
OS: Windows
Flutter Version: 3.29.0
Dart SDK Version: 3.7.0 (stable)
Solution:
I analyzed the root cause and found that the issue is due to video player rendering not updating correctly on resize events. After applying one update in the code, I was able to fix the issue.

Would love to discuss further and contribute the fix! Let me know if I should open a PR. 🚀

WhatsApp.Video.2025-03-05.at.11.26.08.PM.mp4

@Vishwaspatel2401
Copy link

HI @ashitaprasad I am willing to work on this

@badnikhil
Copy link

badnikhil commented Mar 7, 2025

Hi @ashitaprasad I tried reproducing this issue on a arm silicon (M3) based mac. The video previewer seemed to be working fine in this case. I have also tested another endpoint that serves .mp4 file, it worked for that as well.

System: Sequoia macOS 15.3.1 Flutter Version: 3.29.0 Dart SDK version: 3.7.0

PFA video demonstration:
test.mp4

Let me know if you need me to try any other scenario.

Thanks!

I was also looking at this issue .. I tried some fixes and then i noticed another bug.. switch to headers tab(Next to Response Body) then switch back to Response body.. this causes another crash.. I was testing it on linux Ubuntu 24.04.1 LTS. I think the widget is getting disposed then a update is being made to the widget But the widget is not in widget tree

@badnikhil
Copy link

badnikhil commented Mar 7, 2025

@ashitaprasad I identified the cause and fixed it . Will hit PR soon.. got some things to do Currently

@ashitaprasad
Copy link
Member Author

ok @badnikhil

@badnikhil badnikhil linked a pull request Mar 9, 2025 that will close this issue
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants