Skip to content

Conversation

@Bhavesh-More
Copy link

PR Description

Fixes an issue where video responses could continue playing audio in the background, especially after window resize or when multiple response views were rendered. Videos are now paused by default and only play after explicit user interaction, with a guarantee that only one video can play at a time.

Problem

When a video response was displayed and the application window was resized to fullscreen, the responsive layout caused the same response body to be rendered in multiple places (for example, in both Requests and History views).

both views remained mounted. which resulted in:

  • Multiple VideoPreviewer instances being created
  • Videos autoplaying without user interaction
  • Audio continuing to play even after pausing the visible video
  • Background audio persisting during tab switches or layout changes

Pausing the video in one view only affected that specific instance, while another hidden instance continued playing audio.


Root Cause

Each VideoPreviewer instance managed playback independently and autoplayed on initialization. There was no coordination between instances, allowing multiple videos to play simultaneously when multiple response bodies were rendered due to responsive layout changes.


Related Issues

Before & After Result

Before

video.player.bug.mp4
  • Video autoplayed in History tab
  • Audio persisted on window resize

After

video.player.working.mp4
  • Videos do not autoplay unless the user presses Play
  • Only one video can play at a time across the app
  • No background audio after resizing the window
  • Pausing a video reliably stops all audio
  • Behavior is consistent across layouts and tab navigation

Checklist

  • I have gone through the contributing guide
  • I have updated my branch and synced it with project main branch before making this PR
  • I am using the latest Flutter stable branch
  • I have verified the feature manually

Added/updated tests?

  • Yes
  • No, and this is why: This change affects video playback behavior that depends on platform-specific media plugins, window resizing, and user interaction. The issue is not reliably reproducible in automated tests. The fix was verified through manual testing on macOS, including tab switching, window resizing, and playback control.

OS on which you have developed and tested the feature?

  • Windows
  • macOS
  • Linux

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.

Fix video player crash

1 participant