Commit 29029880 authored by chenjiadong's avatar chenjiadong Committed by Commit Bot

Audio should continue playing when the browser switching to background

Previously,we judge whether the current media contains a video track to
decide to pause the current playback after switching to the background.
Because the media played through MediaPlayer are assumed to contain
both audio and video tracks, they will all pause. In this scenario,
we should judge whether the original size of the current media meta
video is empty to determine whether it contains a video track.

Bug: 1093697
Change-Id: I702465f677d9dd01b827051b21f77c20633a80c3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2241053Reviewed-by: default avatarDale Curtis <dalecurtis@chromium.org>
Reviewed-by: default avatarThomas Guilbert <tguilbert@chromium.org>
Commit-Queue: Thomas Guilbert <tguilbert@chromium.org>
Cr-Commit-Position: refs/heads/master@{#780359}
parent bd3b7cd8
...@@ -1114,6 +1114,7 @@ Zoltan Kuscsik <zoltan.kuscsik@linaro.org> ...@@ -1114,6 +1114,7 @@ Zoltan Kuscsik <zoltan.kuscsik@linaro.org>
Zsolt Borbely <zsborbely.u-szeged@partner.samsung.com> Zsolt Borbely <zsborbely.u-szeged@partner.samsung.com>
方觉 (Fang Jue) <fangjue23303@gmail.com> 方觉 (Fang Jue) <fangjue23303@gmail.com>
Julian Geppert <spctstr@gmail.com> Julian Geppert <spctstr@gmail.com>
Jiadong Chen <chenjiadong@huawei.com>
# END individuals section. # END individuals section.
# BEGIN organizations section. # BEGIN organizations section.
......
...@@ -3465,6 +3465,11 @@ bool WebMediaPlayerImpl::ShouldPausePlaybackWhenHidden() const { ...@@ -3465,6 +3465,11 @@ bool WebMediaPlayerImpl::ShouldPausePlaybackWhenHidden() const {
if (!HasVideo()) if (!HasVideo())
return false; return false;
if (using_media_player_renderer_ &&
pipeline_metadata_.natural_size.IsEmpty()) {
return false;
}
if (!is_background_video_playback_enabled_) if (!is_background_video_playback_enabled_)
return true; return true;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment