Skip to content

Fixed Video Player Crash and late initialization errors in flutter test #654

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

Closed
wants to merge 1 commit into from

Conversation

badnikhil
Copy link
Contributor

@badnikhil badnikhil commented Mar 10, 2025

…Flutter tests.

PR Description

This PR addresses an issue where the Video Previewer widget was crashing during UI updates, such as tab switching, window resizing, or other state changes.

the Video Previewer widget was getting disposed when switching tabs, resizing the window, or performing similar UI updates. However, when the widget received an update after being removed from the widget tree, it caused an application crash.

For example

Switching to "Headers" and then back to "Response Body" led to a crash.

When resizing the window, video reinitialization was expected, but it didn’t happen, leading to unexpected behavior.

I identified the issue and successfully fixed it by preventing unnecessary disposals, ensuring smooth transitions without crashes.

Related Issues

Fix Implemented:

  • Prevented video controller disposal crashes by pausing instead of disposing when the widget tree updates.
  • Fixed the LateInitializationError related to _videoController by handling initialization.

Checklist

  • I have gone through the contributing guide
  • I have updated my branch and synced it with the project main branch before making this PR
  • I am using the latest Flutter stable branch (flutter upgrade verified)
  • I have run the tests (flutter test) and all tests are passing

Added/updated tests?

  • Yes
  • No, and this is why: Not needed for this fix

OS on which you have developed and tested the feature?

  • Windows
  • Android / iOS
  • macOS
  • Linux

@animator
Copy link
Member

We tried this PR, but it doesn't solve the problem and the player still crashes.

@animator animator closed this Mar 31, 2025
@badnikhil
Copy link
Contributor Author

badnikhil commented Apr 1, 2025

@animator can you explain how it crashed or what actions led to the crash?
I use linux and when working on this ,video player crashed during window resizing and changing between response and headers.
worked fine after the changes i made. Let me attach a video
Screencast from 2025-04-01 16-53-13.webm

I'll give updates on this after testing it further on macOS.

@badnikhil
Copy link
Contributor Author

badnikhil commented Apr 3, 2025

@animator i wanted to try this on macOS but the app got stuck on the initial window for workspace .the select folder button wasn't working

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Errors Encountered During Flutter Tests Fix video player crash
2 participants