SRGSSR / srgmediaplayer-apple

An advanced media player library, simple and reliable
MIT License
158 stars 33 forks source link

Device lock has to be prevented while playing a video over AirPlay audio device only #87

Closed pyby closed 3 years ago

pyby commented 4 years ago

Issue type

Incorrect behavior

Description of the problem

When playing a video over AirPlay audio only (Apple AirPort Express, Sono…), the device turns off after the iOS settings delay.

Play SRF, AppStore review:

Grundsätzlich eine gute App! Leider dunkelt der Bildschirm seit einem der letzten Updates beim Schauen von Videos nach einer gewissen Zeit automatisch ab und schaltet schliesslich ganz aus. Damit ist das Videoschauen relativ mühsam.. Wäre schön, wenn das demnächst behoben werden könnte.. Nachtrag: Das Abdunkeln geschieht nur, wenn der Ton via AirPlay (Sonos) wiedergegeben wird. Das Problem besteht auch im Vollbildmodus. Zeitlich passiert es abhängig von der Einstellung der Anzeige bzgl. Automatischer Sperre (aktuell 2min). Hintergrundwiedergabe ist aktiv. App-Version: 3.1.0; iOS: 13.5.1

This issue comes from #84 . Probably from this part of code.

Environment information

Reproducibility

Always reproducible

Code sample

Play iOS code in production

Steps to reproduce

I was abled to reproduce in Letterbox Demo and Play SRG apps easily.

  1. Connect an iOS. device to an AirPlay audio only device.
  2. Set "Auto-Lock" to 30 sec (in iOS. Settings / Display & Brightness)
  3. Open a Play apps, and Play a video: video is on the device screen, sound is on the external audio device.
  4. Wait 30 seconds without touching he screen.

Current result: The device screen turns OFF.

Expected result: The device screen prevents to turn OFF.

defagos commented 4 years ago

Thanks, was just gonna create this issue to write this comment. And I now just saw that you have a fix proposal as well, and that we named our branches quite similarly. We are probably two parts of the same brain :)

I have a sligthly different fix proposal than yours, but at the same location. I think it should suffice to test whether external playback is active or not instead of the current condition. I cannot test this intuition entirely with my setup (I can only simulate it by setting usesExternalPlaybackWhileExternalScreenIsActive to NO).

The idea is:

I'll let you have a look next week, as you have such a device at home. My fix is on feature/airplay-audio-only-fix, yours on feature/airplay-audio-only.

pyby commented 4 years ago

I didn't mention my fix yet because:

Your fix branch works as expected, tested on my side. (Letterbox Demo and Play SRG debug). Thank you.