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

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: Interface name Created 5 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
« 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..1a441636991bbbef1260cff34d04cd4daa4f10de 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,11 @@ void HTMLMediaElement::play()
if (!UserGestureIndicator::processingUserGesture()) {
autoplayMediaEncountered();
- if (m_userGestureRequiredForPlay)
+ if (m_userGestureRequiredForPlay) {
+ String message = ExceptionMessages::failedToExecute("play", "HTMLMediaElement", "API can only be initiated by a user gesture.");
+ document().executionContext()->addConsoleMessage(ConsoleMessage::create(JSMessageSource, WarningMessageLevel, message));
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