Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(346)

Unified Diff: third_party/WebKit/Source/core/html/HTMLMediaElement.cpp

Issue 2910683003: A video tag should play content src is set asynchronously with preload is disabled.
Patch Set: A video tag should play content src is set asynchronously with preload is disabled. Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
index 778ed1e6f7ca572ca3706a22a447b9c41395a8c1..32bc4e532233061137899efd5861e0d0ddb586c1 100644
--- a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
@@ -621,6 +621,13 @@ void HTMLMediaElement::ParseAttribute(
if (!params.new_value.IsNull()) {
ignore_preload_none_ = false;
InvokeLoadAlgorithm();
+ if (pending_play_) {
+ if (!paused_ && !playing_) {
+ PlayInternal();
+ } else {
+ pending_play_ = false;
+ }
+ }
}
} else if (name == controlsAttr) {
UseCounter::Count(GetDocument(),
@@ -2278,6 +2285,9 @@ Nullable<ExceptionCode> HTMLMediaElement::Play() {
Nullable<ExceptionCode> exception_code = autoplay_policy_->RequestPlay();
+ if (EffectivePreloadType() == WebMediaPlayer::kPreloadNone && !src_object_)
+ pending_play_ = true;
+
if (exception_code == kNotAllowedError) {
// If we're already playing, then this play would do nothing anyway.
// Call playInternal to handle scheduling the promise resolution.
@@ -3328,6 +3338,9 @@ void HTMLMediaElement::UpdatePlayState() {
StartPlaybackProgressTimer();
playing_ = true;
+ if (pending_play_)
+ pending_play_ = false;
+
} else { // Should not be playing right now
if (is_playing) {
GetWebMediaPlayer()->Pause();

Powered by Google App Engine
This is Rietveld 408576698