Skip to content

Commit

Permalink
[media] Support media suspend and resume (#4580)
Browse files Browse the repository at this point in the history
CobaltActivity adopts ContentShellActivity, but ContentShell.apk didn't
set WebContents correctly when the activity onStop(), resulting in it
continued to play the video after pushing to the background.

Set WebContents to onHide() when the activity onStop(). This allows
Cobalt.apk to have the same behavior as Chrome when suspend/resume the
app on android.

Chrome upstream code is:
https://chromium-review.googlesource.com/c/chromium/src/+/6092099

b/384086780
b/383153069
b/326497953
  • Loading branch information
borongc authored Dec 27, 2024
1 parent b7b2d76 commit f79e30f
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,9 @@ protected void onStop() {
getStarboardBridge().onActivityStop(this);
super.onStop();

WebContents webContents = getActiveWebContents();
if (webContents != null) webContents.onHide();

if (VideoSurfaceView.getCurrentSurface() != null) {
forceCreateNewVideoSurfaceView = true;
}
Expand Down

0 comments on commit f79e30f

Please sign in to comment.