fenix icon indicating copy to clipboard operation
fenix copied to clipboard

[Bug] Video doesn't stop playing when closing Fenix (from "recent apps" list)

Open emilio opened this issue 7 years ago • 17 comments

Steps to reproduce

  • Go to https://player.vimeo.com/video/319506545 (SFW)
  • Press play, then go fullscreen.
  • Close Fenix.

Updated STR (for QA):

  1. Open soundcloud.com and play any video
  2. Background Fenix, open a custom tab Fenix page (e.g. from Reddit Is Fun app)
  3. Swipe away Fenix, notice music still plays
  4. Swipe away custom tab, music still plays

Expected behavior

  • Video stops playing.

Actual behavior

  • Sound keeps playing even when Fenix is closed.

I find it a bit debatable that it keeps playing when switching tabs or apps, though I can see a use case for that. But if I close the app from the menu I definitely expect it to stop.

Device information

  • Android device: OnePlus 6
  • Fenix version: 1.0.1916 (I think this is the right thing to copy here? Let me know otherwise)

┆Issue is synchronized with this Jira Task

emilio avatar Apr 17 '19 00:04 emilio

To clarify what I meant with "closing the app from the menu" is "press bottom right button, discard Fenix by sliding it out of view".

emilio avatar Apr 17 '19 00:04 emilio

Note that this issue is slightly different to that one (this is not only when minimizing the app, but when closing it completely).

But if they get addressed at the same time that's great, thanks!

emilio avatar Apr 17 '19 15:04 emilio

I think this bug should get reopened since #1117 got closed and doesn't capture the same issue.

yoasif avatar Apr 18 '19 00:04 yoasif

~~To stop media playback, I am told that Fenix needs to call session.setActive(false) to when a tab (or the app) is backgrounded. I don't see any calls to setActive() in Fenix or AC code, but I did find the AC PR to remove calls the session.setActive(): mozilla-mobile/android-components#703~~

@agi90 says to call setSuspendedMediaWhenInactive, not setActive.

cpeterso avatar Apr 19 '19 02:04 cpeterso

I cannot reopen the issue, can somebody do it for me?

emilio avatar Apr 21 '19 19:04 emilio

@agi90 says to call setSuspendedMediaWhenInactive, not setActive.

cpeterso avatar Apr 22 '19 18:04 cpeterso

We will need this to be exposed to us through the Engine abstraction so I filed https://github.com/mozilla-mobile/android-components/issues/2827

Do we want this behavior to always be true?

ekager avatar Apr 22 '19 22:04 ekager

Do we want this behavior to always be true?

FWIW, Fennec continues to play audio when the app is backgrounded. Fennec users consider this a feature and have pushed back when we tried to change it. Whether Fenix wants to support that is a separate question (#1117). :)

The bug Emilio reported here is about audio continuing to play after Fenix has been "closed" (swiped away from Android's "Recent Apps" list). That is definitely a bug, but I don't know if setSuspendedMediaWhenInactive is the fix for that situation.

cpeterso avatar Apr 22 '19 23:04 cpeterso

The bug Emilio reported here is about audio continuing to play after Fenix has been "closed" (swiped away from Android's "Recent Apps" list). That is definitely a bug, but I don't know if setSuspendedMediaWhenInactive is the fix for that situation.

The "right" fix for this is having a persistent notification that shows up when music is playing and allows the user to stop playback at any time (also provides the user with a visual indication of what is actually playing sound, not always obvious). There's no way for apps to know when they're swiped away or killed (these two things are not related, either).

Without a notification android will start de-prioritizing the browser causing sounds artifacts, see #1461

agi90 avatar Apr 23 '19 16:04 agi90

On Q if I swipe away the app, I'm no longer seeing the first bug. I do still hear audio when the app is paused. Is this still happening on other devices?

ekager avatar May 13 '19 20:05 ekager

@vesta0 do we want to open a new ticket for and/or prioritize adding a notification for media?

The "right" fix for this is having a persistent notification that shows up when music is playing and allows the user to stop playback at any time (also provides the user with a visual indication of what is actually playing sound, not always obvious). There's no way for apps to know when they're swiped away or killed (these two things are not related, either).

Without a notification android will start de-prioritizing the browser causing sounds artifacts, see #1461

ekager avatar May 13 '19 20:05 ekager

@ekager @agi90 @emilio I can't reproduce the reported bug anymore so I am closing it. I have created a new issue (#2551) for a post-mvp feature to add a notification.

vesta0 avatar May 16 '19 05:05 vesta0

This is definitely still a bug.

Easiest way to reproduce for me is:

  • Open soundcloud.com and play any video
  • Background Fenix, open a custom tab Fenix page (e.g. from Reddit Is Fun app)
  • Swipe away Fenix, notice music still plays
  • Swipe away custom tab, music still plays

At this point there is no Fenix visible but still music playing. Also note this is highly dependent on OS, so it might not work e.g. on Pixel (reproduced on Samsung S10e)

agi90 avatar May 16 '19 15:05 agi90

As per @agi90 Fenix can figure out when music is playing using the `MediaDelegate and stop music playing in background (it's a pref)

vesta0 avatar May 16 '19 15:05 vesta0

To confirm: I am going to just stop media playback in the background always even if the app is just paused and not force quit.

sblatz avatar May 30 '19 16:05 sblatz

Thank you @sblatz . The current behaviour is a huge blocker. If the user closes the app, media continued playing and the only way to stop it is to go to settings and app settings and force stop Fenix. We will re-add this feature once we build media notifications post-mvp.

vesta0 avatar May 30 '19 21:05 vesta0

Verified that the sound is stopped when backgrounding or killing the app. devices: Pixel, Note 8 (Android 9), P9 lite (Android 6)

sv-ohorvath avatar May 31 '19 12:05 sv-ohorvath