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

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

Issue 1162063004: Notify on console when play fails (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 7 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 | « LayoutTests/media/video-play-require-user-gesture-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLMediaElement.cpp
diff --git a/Source/core/html/HTMLMediaElement.cpp b/Source/core/html/HTMLMediaElement.cpp
index f66f59c4422ba466b0ee4f8c44bcdb3692db78c2..ca5f073d20253e8a8c2617fe00db7cfcb3f5f66c 100644
--- a/Source/core/html/HTMLMediaElement.cpp
+++ b/Source/core/html/HTMLMediaElement.cpp
@@ -59,6 +59,7 @@
#include "core/html/track/TextTrackList.h"
#include "core/html/track/VideoTrack.h"
#include "core/html/track/VideoTrackList.h"
+#include "core/inspector/ConsoleMessage.h"
#include "core/layout/LayoutVideo.h"
#include "core/layout/LayoutView.h"
#include "core/layout/compositing/DeprecatedPaintLayerCompositor.h"
@@ -1914,8 +1915,16 @@ void HTMLMediaElement::play()
if (!UserGestureIndicator::processingUserGesture()) {
autoplayMediaEncountered();
- if (m_userGestureRequiredForPlay)
+ if (m_userGestureRequiredForPlay) {
+ // prevent autoplay, and make it known
jww 2015/06/03 22:58:51 Please remove this comment, as it is unnecessary.
keenanb 2015/06/04 00:07:13 Done.
+ String messageString = ExceptionMessages::failedToExecute(
+ "play",
jww 2015/06/03 22:58:51 Please put these arguments on one line.
keenanb 2015/06/04 00:07:13 Done.
+ "MediaElement",
+ "the API can be initiated only by the user.");
jww 2015/06/03 22:58:51 Please make this message match the message in the
keenanb 2015/06/04 00:07:13 Done.
+ document().executionContext()->addConsoleMessage(
+ ConsoleMessage::create(JSMessageSource, WarningMessageLevel, messageString));
jww 2015/06/03 22:58:51 Please put this argument on the previous line.
keenanb 2015/06/04 00:07:12 Done.
return;
+ }
} else if (m_userGestureRequiredForPlay) {
if (m_autoplayMediaCounted)
recordAutoplayMetric(AutoplayManualStart);
« no previous file with comments | « LayoutTests/media/video-play-require-user-gesture-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698