New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 121898 link

Starred by 55 users

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Dec 2012
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 2
Type: Bug

Restricted
  • Only users with EditIssue permission may comment.



Sign in to add a comment

Audio stops when switching out of Chrome (Mobile)

Reported by mich...@mahemoff.com, Apr 4 2012

Issue description

What steps will reproduce the problem?
1. Start playing audio
2. Click home or long-hold to switch to another app

What is the expected result?
Audio keeps playing

What happens instead?
Audio stops.

This behaviour is different to the Android Browser, which keeps playing, and on iOS, Mobile Safari goes even further as it integrates the currently-playing HTML5 audio track into the standard player controls, it works with remote controls etc. It breaks apps using HTML5 to deliver music and spoken-word content.
 

Comment 1 Deleted

Labels: OS-Android

Comment 3 by tom1...@gmail.com, Apr 18 2012

In addition to what's stated above, the audio will also stop when switching to another tab.
Labels: -Area-Undefined Area-UI Feature-Media-Audio

Comment 5 Deleted

Just to add that the audio also stops when the screen is turned off. As with the other scenarios, this behaviour is contrary to the behaviour of the standard Android and iOS browsers, and (unnecessarily IMO) rules out doing in the browser what native audio apps can do.
Is there any update on this?

Comment 8 by vinodkr@google.com, Jun 2 2012

Labels: Mstone-22
Labels: -Mstone-22 Mstone-23
Labels: -Area-UI Area-WebKit Feature-Media
Status: Available
 Issue 136113  has been merged into this issue.

Comment 13 by trusktr@gmail.com, Jul 26 2012

Will this be fixed? I believe this is a crucial feature considering that web apps are much more capable these days (many can even replace native apps).
I would also like to see this behavior changed.
Is there any update on this issue. It severely hampers any HTML5 audio website, such as Grooveshark. At least, it should ask if I want to allow the audio to continue or something once. 

Comment 16 by vinodkr@google.com, Sep 10 2012

Labels: -Mstone-23 Mstone-24
Super annoying. I have to change to Dolphin browser when I want to listen to web-based podcasts/music.
Labels: -Mstone-24 Mstone-25
Labels: -OS-Mac
I spoke to a webapp developer that uses audio as notifications during a long-running app. 
The Chrome on Android behavior here is a deal-breaker for their app, which relies on sound to keep parents connected to service providers via their mobile devices.
Owner: miguelg@chromium.org
I'll pick this. I've been looking at it and know why this is happening. I am going to try an easy fix where we don't free up resources (and thus pause) when hiding the tab but instead only do it when the inner render widget is closed. 
Cc: qin...@chromium.org
Min since you own this, do let me know if you are ok with me taking it over (and with the proposed approach) I'll send you reviews for this to you ok?
Labels: -Area-WebKit Area-Internals
Status: Started
This is a trade off we made between power/data usage on small devices. I think we can add this feature for our next release
Project Member

Comment 25 by bugdroid1@chromium.org, Nov 15 2012

The following revision refers to this bug:
    http://src.chromium.org/viewvc/chrome?view=rev&revision=167906

------------------------------------------------------------------------
r167906 | miguelg@chromium.org | 2012-11-15T13:01:56.040417Z

Changed paths:
   M http://src.chromium.org/viewvc/chrome/trunk/src/webkit/support/webkit_support.cc?r1=167906&r2=167905&pathrev=167906
   M http://src.chromium.org/viewvc/chrome/trunk/src/webkit/media/android/webmediaplayer_manager_android.cc?r1=167906&r2=167905&pathrev=167906
   M http://src.chromium.org/viewvc/chrome/trunk/src/content/renderer/render_view_impl.cc?r1=167906&r2=167905&pathrev=167906
   M http://src.chromium.org/viewvc/chrome/trunk/src/webkit/media/android/webmediaplayer_manager_android.h?r1=167906&r2=167905&pathrev=167906

Keep playing audio even when opening another tab, going to another app etc.

Test: run both content shell and chrome for android, gone to a few html5 serving pages.

http://romaindillet.github.com/That-Radio-Player/#
and
http://grooveshark.com/#!/playlist/ac-dc/28046570

Then verified that audio keeps playing if I switch tabs or leave the app.

Also added some logging to verify that no matter what the internal player is released when you leave either when you leave the page if nothing is playing or upon closing the tab or navigating away if it is.




BUG= 121898 

Review URL: https://chromiumcodereview.appspot.com/11361239
------------------------------------------------------------------------
Thanks for addressing this bug. Does it also work when screen is off? That's really the primary use case for web apps like grooveshark and playerfm which play full-length MP3s.
Yes, this also works when the screen is off. I also verified that case specifically.
Status: Fixed
Fantastic, thanks!

Comment 30 by trusktr@gmail.com, Nov 19 2012

Thank you!
Yay! Thanks!

Comment 32 by trusktr@gmail.com, Nov 20 2012

When's the next release containing this fix targetted?
I will post here, once we have a development version out that contains the fix. There is no concrete schedule for now AFAIK but I'll keep the bug posted.
Labels: ReleaseBlock-Dev
Status: Started
We of course don't want to play audio when receiving a phone call, it's a terrible experience.

https://codereview.chromium.org/11348199/ sent for review to fix it.
Good point and please note that Android browser's audio tag has a major bug where it resumes playback after phone call or SMS, even when the audio tag is paused. (Which can lead to a long track playing in the middle of the night.) Something you may wish to test if/when you implement playback suspension during phone calls.

Comment 36 by laforge@google.com, Nov 27 2012

Labels: Project-Refresh
Project Member

Comment 37 by bugdroid1@chromium.org, Nov 28 2012

The following revision refers to this bug:
    http://src.chromium.org/viewvc/chrome?view=rev&revision=169922

------------------------------------------------------------------------
r169922 | miguelg@chromium.org | 2012-11-28T14:14:57.607876Z

Changed paths:
   M http://src.chromium.org/viewvc/chrome/trunk/src/content/browser/android/media_player_manager_android.cc?r1=169922&r2=169921&pathrev=169922
   M http://src.chromium.org/viewvc/chrome/trunk/src/media/base/android/media_player_bridge.h?r1=169922&r2=169921&pathrev=169922
   M http://src.chromium.org/viewvc/chrome/trunk/src/webkit/media/android/webmediaplayer_in_process_android.cc?r1=169922&r2=169921&pathrev=169922
   M http://src.chromium.org/viewvc/chrome/trunk/src/content/browser/android/media_player_manager_android.h?r1=169922&r2=169921&pathrev=169922
   M http://src.chromium.org/viewvc/chrome/trunk/src/content/shell/android/java/AndroidManifest.xml?r1=169922&r2=169921&pathrev=169922
   M http://src.chromium.org/viewvc/chrome/trunk/src/webkit/media/android/webmediaplayer_in_process_android.h?r1=169922&r2=169921&pathrev=169922
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/android/testshell/java/AndroidManifest.xml?r1=169922&r2=169921&pathrev=169922
   M http://src.chromium.org/viewvc/chrome/trunk/src/media/base/android/java/src/org/chromium/media/MediaPlayerListener.java?r1=169922&r2=169921&pathrev=169922
   M http://src.chromium.org/viewvc/chrome/trunk/src/media/base/android/media_player_listener.cc?r1=169922&r2=169921&pathrev=169922
   M http://src.chromium.org/viewvc/chrome/trunk/src/media/base/android/media_player_listener.h?r1=169922&r2=169921&pathrev=169922
   M http://src.chromium.org/viewvc/chrome/trunk/src/media/base/android/media_player_bridge.cc?r1=169922&r2=169921&pathrev=169922

Free (and pause) audio resources when getting a phone call


BUG= 121898 


Review URL: https://chromiumcodereview.appspot.com/11348199
------------------------------------------------------------------------
Status: Fixed
Status: Assigned
https://chromiumcodereview.appspot.com/11418120/ broke this again unfortunately. The problem is that the implementation of hasVideo() will default to true if there is no mime type (which will happen for long streams).

http://code.google.com/searchframe#OAMlx_jo-ck/src/webkit/media/android/webmediaplayer_android.cc&type=cs&l=131

qimin@ has a good idea to solve this (keep track of onVideoSizeChanged with a size different than 0,0) and only return true then). He'll send a cl shortly for that.

Project Member

Comment 40 by bugdroid1@chromium.org, Nov 30 2012

The following revision refers to this bug:
    http://src.chromium.org/viewvc/chrome?view=rev&revision=170440

------------------------------------------------------------------------
r170440 | qinmin@chromium.org | 2012-11-30T12:37:31.471812Z

Changed paths:
   M http://src.chromium.org/viewvc/chrome/trunk/src/webkit/media/android/webmediaplayer_android.cc?r1=170440&r2=170439&pathrev=170440
   M http://src.chromium.org/viewvc/chrome/trunk/src/webkit/media/android/webmediaplayer_android.h?r1=170440&r2=170439&pathrev=170440

Fix a bug that hasVideo() always returns true even after we have the size info

We should use the size info for hasVideo if we already have that information

BUG= 121898 


Review URL: https://chromiumcodereview.appspot.com/11412251
------------------------------------------------------------------------
Labels: -ReleaseBlock-Dev
Status: Fixed

Comment 43 by mic...@gmail.com, Jan 9 2013

thanks guys, for fixing this
looking forward to release
Cheers!
Hi all, 

  In case you are interested, you can try the fixed version by installing chrome beta from our brand new beta channel.

https://play.google.com/store/apps/details?id=com.chrome.beta


Confirmed this is working now. Tested in different tab, launcher, different app, and with screen off. Thanks!

Comment 46 by Deleted ...@, Feb 16 2013

I just downloaded the beta from the link above and the music does not keep playing. When I change tabs, power off, go to the launcher, etc, the music stops. Do I need to change any settings?
#46, Can you write the steps to reproduce your problem? For example, go to soundcloud.com, play a sound and then hit the home button?

Comment 48 by Deleted ...@, Feb 17 2013

For simplicity, I followed your example steps above on my GS2 and reproduced the problem (the music stops). It also stops if I change tabs or power of my phone.
#48, would you please check your chrome version?
launching chrome beta, menu->settings->menu->about chrome
is the version number 25.0.1364.87 or higher?

Comment 50 by Deleted ...@, Feb 17 2013

Under Application version: Chrome Beta 25.0.1364.87

I tried our beta on a galaxy S2(GT-I9100), android 4.0.3 and cannot reproduce your problem. I guess there is some other app  on android on your device that is interfering with chrome.
Project Member

Comment 52 by bugdroid1@chromium.org, Mar 10 2013

Labels: -Area-Internals -Feature-Media -Mstone-25 Cr-Internals-Media Cr-Internals M-25
Project Member

Comment 53 by bugdroid1@chromium.org, Mar 20 2013

Labels: -Project-Refresh Proj-Refresh
This issue is back with ver. 32.0.1700

Comment 55 Deleted

Min will you be able to have a look? It would be good to see what broke and
try to fix ir in M33 since it is a bad regression.

Comment 57 by qinmin@google.com, Jan 21 2014

i tried m.soundcloud.com, if I click one of the audio link to play a song and then hit the home button, the audio will pause.
However, if I open https://m.soundcloud.com/lanayamusic/lanaya-danny-boy directly, and hit the play button, the audio will not pause when i hit the home button.

Seems the functionality is not totally broken, I suspect the bug is caused by that we mistakenly treat the audio as video.

Comment 58 by trusktr@gmail.com, Jan 21 2014

This must have been a recent change. It was working with grooveshark.com and 8tracks.com shortly after I received my Nexus 5 on Dec 26th, but not right now.

I also confirm the behavior of the previous comment.
https://codereview.chromium.org/56443002 caused the issue. 
As I suspected, this is caused by an issue that we treat audio streams as video.
There is an android mediaplayer issue that some streams might not report size initially. 
So we are not setting the stream as audio only even if the size is (0,0).
 crbug.com/336479  created to track this.
Yes this bug is back in 32. I was really impressed by how 31 worked, even when changing tabs, turning off the screen or going to the home screen. Now it just stops.
A fix to  crbug.com/336479  is submitted, waiting for the next chrome 32/33 release to pick up the fix.
 Issue 336022  has been merged into this issue.
 Issue 335983  has been merged into this issue.
Is there an ETA for when chrome 32/33 release will be, well released? Hopefully it will fix this error. I am getting tired of uninstalling the chrome update everytime it updates...
The next chrome Beta update will contain the fix. I recommend trying it out to get it as early as possible.
https://play.google.com/store/apps/details?id=com.chrome.beta&hl=en_GB
Ok i am going to install the update from the link you sent me. Thanks a
bunch!

Comment 68 by Deleted ...@, Feb 18 2014

Feb 14th version of Chrome Beta now has this working again (For me anyway) Nexus 4 running 4.4.2
So when is the new chrome update going to be released? Right now I am
running Chrome Beta; its annoying cause I have the factory version of
Chrome installed on my phone and now I have this Beta version running as
well - another instance of the same app. ...
I would rather just have my factory version updated. Any news about a
timeline?
Oh !" You are welcome '' This Years ...I m no more thing"!
 2014/2/23 

Comment 71 by Deleted ...@, Jun 16 2015

chrome beta pauses video on app switch (so far), this also happens in dolphin + video even doesn't show if additional javascript code added for time line status managing.

Comment 72 by trusktr@gmail.com, Jun 16 2015

That makes sense. Obviously if you leave Chrome you're not watching the video anymore. If you want to listen to music and leave it playing in the background, don't watch videos on youtube, instead use soundcloud, or other similar services that play audio only.

Comment 73 by trusktr@gmail.com, Jun 16 2015

(though it could possibly be argued that video playback can be improved and the video part of a video could be stopped when Chrome is put to the background while the audio continues to play in the background. This would be nice so that people don't have to worry "Hey, why does sound cloud play my music and youtube doesn't? So lame." It shouldn't matter to the non-tech person. It should just work for for people who don't know anything about tech and just want to use it)

I'd say the overriding principle should be to behave in terms of user expectations and give web apps the same capabilities as native apps, ie leave it to the app to decide what happens when it's backgrounded.

Fortunately, media is getting some more serious standards-based attention now, in the form of Media Sessions - https://github.com/whatwg/mediasession. That should hopefully help to resolve these ambiguities.

Comment 75 by jws.f...@gmail.com, Jun 24 2016

With the latest update of Chrome-Android Dev 53, this problem has started happening again for the html5 audio tag. (53.0.2774.4)
Hmm, will take a look, I recently made some changes here, but I thought I tested this case carefully and it was fine.
jws.fbmm@ can you clarify what problem started happening again? I thought you meant audio stopped on backgrounding, which appears to work fine.
Labels: Restrict-AddIssueComment-EditIssue
Ahh, just saw you filed  issue 623066  we'll continue discussion there.

Sign in to add a comment