Skip to content

fix(RCTVideo.swift): add audiovisualBackgroundPlaybackPolicy when pla… #4570

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

Merged

Conversation

Dawqss
Copy link
Contributor

@Dawqss Dawqss commented Jun 12, 2025

Summary of Changes

  • Fixed iOS background playback behavior:
    Added logic to set audiovisualBackgroundPlaybackPolicy on the player instance to ensure video continues playing when the app goes into the background.
if (_playInBackground) {
    _player!.audiovisualBackgroundPlaybackPolicy = .continuesIfPossible
} else {
    _player!.audiovisualBackgroundPlaybackPolicy = .automatic
}
  • Without this, iOS would consistently pause video playback when the app was backgrounded, even if background playback was expected.

How to test:

Just play any video with react-native-video player and go to background, video should pause

Motivation

Video stopped playing in background mode even though playInBackground was set to true.

Copy link
Collaborator

@KrzysztofMoch KrzysztofMoch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for PR!
Our current min version of iOS is 13.0, but this property is 15.0+ (from what I can see in docs). Can you add version availability check? Thanks!

@Dawqss Dawqss force-pushed the fix/ios_play_in_background_mode branch from d41ef2e to d2be7b7 Compare July 10, 2025 12:04
@Dawqss Dawqss force-pushed the fix/ios_play_in_background_mode branch from d2be7b7 to 51b4d65 Compare July 10, 2025 12:06
Copy link
Collaborator

@KrzysztofMoch KrzysztofMoch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@KrzysztofMoch KrzysztofMoch merged commit bf81038 into TheWidlarzGroup:master Jul 13, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

3 participants