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

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 when src is set asynchronously ,while preload is disabled. Created 3 years, 5 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
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLMediaElement.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 989a95832f849c1e1e2651401e4fadf91f907abd..7f9d2b3c5b0d728a6bc7581ff84b7f16d81ff992 100644
--- a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
@@ -635,6 +635,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(),
@@ -2300,6 +2307,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.
@@ -3350,6 +3360,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();
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLMediaElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698