Skip to content
This repository has been archived by the owner on Oct 6, 2022. It is now read-only.

[iOS Device] Music controls disabled if video is played in full screen using native iOS controls #372

Open
2 of 4 tasks
gkuettel opened this issue Jan 25, 2021 · 0 comments

Comments

@gkuettel
Copy link

gkuettel commented Jan 25, 2021

We're using react-native-video in conjunction with this library to show lock screen controls for videos. Everything works as expected, but we're running into a problem when locking the phone after the video is in full screen mode, and the native iOS controls take over.

Steps to reproduce:

  • Play a video in fullscreen with native iOS controls
  • Lock the phone
  • Playback controls are disabled

We've tried to call setNowPlaying when full screen is enabled, but that did not resolve the issue.

Screenshot: Lock screen controls working as expected

File (2)

Screenshot: Lock screen controls are greyed out when locking the phone from full screen (native iOS controls)

File (3)


Here's the code that we call when the component mounts:

useEffect(() => {
     Controls.handleAudioInterruptions(true);
    Controls.enableControl("closeNotification", true, { when: "always" });
    Controls.enableBackgroundMode(true);
    Controls.enableControl("play", true);
    Controls.enableControl("pause", true);
    Controls.enableControl("nextTrack", true);
    Controls.enableControl("previousTrack", true);
  }, []);

Here's the code we call when the video instance loads

useEffect(() => {
    Controls.setNowPlaying({
      title,
    });
    Controls.on(Command.play, () => {
      onPressPlay();
    });
    Controls.on(Command.pause, () => {
      onPressPause();
    });
    Controls.on(Command.nextTrack, () => {
      onAdvanceSlide(true);
    });
    Controls.on(Command.previousTrack, () => {
      onAdvanceSlide(false);
    });
  }, [title]);

Platform

  • iOS
  • Android

Device

  • Simulator
  • Real device
@gkuettel gkuettel changed the title [iOS] Music controls disabled if video is played in fullscreen [iOS Device] Music controls disabled if video is played in fullscreen using native iOS controls Jan 25, 2021
@gkuettel gkuettel changed the title [iOS Device] Music controls disabled if video is played in fullscreen using native iOS controls [iOS Device] Music controls disabled if video is played in full screen using native iOS controls Jan 25, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant