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

Side by Side 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, 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 #include "core/html/shadow/MediaControls.h" 52 #include "core/html/shadow/MediaControls.h"
53 #include "core/html/track/AudioTrack.h" 53 #include "core/html/track/AudioTrack.h"
54 #include "core/html/track/AudioTrackList.h" 54 #include "core/html/track/AudioTrackList.h"
55 #include "core/html/track/AutomaticTrackSelection.h" 55 #include "core/html/track/AutomaticTrackSelection.h"
56 #include "core/html/track/CueTimeline.h" 56 #include "core/html/track/CueTimeline.h"
57 #include "core/html/track/InbandTextTrack.h" 57 #include "core/html/track/InbandTextTrack.h"
58 #include "core/html/track/TextTrackContainer.h" 58 #include "core/html/track/TextTrackContainer.h"
59 #include "core/html/track/TextTrackList.h" 59 #include "core/html/track/TextTrackList.h"
60 #include "core/html/track/VideoTrack.h" 60 #include "core/html/track/VideoTrack.h"
61 #include "core/html/track/VideoTrackList.h" 61 #include "core/html/track/VideoTrackList.h"
62 #include "core/inspector/ConsoleMessage.h"
62 #include "core/layout/LayoutVideo.h" 63 #include "core/layout/LayoutVideo.h"
63 #include "core/layout/LayoutView.h" 64 #include "core/layout/LayoutView.h"
64 #include "core/layout/compositing/DeprecatedPaintLayerCompositor.h" 65 #include "core/layout/compositing/DeprecatedPaintLayerCompositor.h"
65 #include "core/loader/FrameLoader.h" 66 #include "core/loader/FrameLoader.h"
66 #include "platform/ContentType.h" 67 #include "platform/ContentType.h"
67 #include "platform/Logging.h" 68 #include "platform/Logging.h"
68 #include "platform/MIMETypeFromURL.h" 69 #include "platform/MIMETypeFromURL.h"
69 #include "platform/MIMETypeRegistry.h" 70 #include "platform/MIMETypeRegistry.h"
70 #include "platform/RuntimeEnabledFeatures.h" 71 #include "platform/RuntimeEnabledFeatures.h"
71 #include "platform/UserGestureIndicator.h" 72 #include "platform/UserGestureIndicator.h"
(...skipping 1835 matching lines...) Expand 10 before | Expand all | Expand 10 after
1907 { 1908 {
1908 return autoplay() ? MediaPlayer::Auto : m_preload; 1909 return autoplay() ? MediaPlayer::Auto : m_preload;
1909 } 1910 }
1910 1911
1911 void HTMLMediaElement::play() 1912 void HTMLMediaElement::play()
1912 { 1913 {
1913 WTF_LOG(Media, "HTMLMediaElement::play(%p)", this); 1914 WTF_LOG(Media, "HTMLMediaElement::play(%p)", this);
1914 1915
1915 if (!UserGestureIndicator::processingUserGesture()) { 1916 if (!UserGestureIndicator::processingUserGesture()) {
1916 autoplayMediaEncountered(); 1917 autoplayMediaEncountered();
1917 if (m_userGestureRequiredForPlay) 1918 if (m_userGestureRequiredForPlay) {
1919 // 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.
1920 String messageString = ExceptionMessages::failedToExecute(
1921 "play",
jww 2015/06/03 22:58:51 Please put these arguments on one line.
keenanb 2015/06/04 00:07:13 Done.
1922 "MediaElement",
1923 "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.
1924 document().executionContext()->addConsoleMessage(
1925 ConsoleMessage::create(JSMessageSource, WarningMessageLevel, mes sageString));
jww 2015/06/03 22:58:51 Please put this argument on the previous line.
keenanb 2015/06/04 00:07:12 Done.
1918 return; 1926 return;
1927 }
1919 } else if (m_userGestureRequiredForPlay) { 1928 } else if (m_userGestureRequiredForPlay) {
1920 if (m_autoplayMediaCounted) 1929 if (m_autoplayMediaCounted)
1921 recordAutoplayMetric(AutoplayManualStart); 1930 recordAutoplayMetric(AutoplayManualStart);
1922 m_userGestureRequiredForPlay = false; 1931 m_userGestureRequiredForPlay = false;
1923 } 1932 }
1924 1933
1925 playInternal(); 1934 playInternal();
1926 } 1935 }
1927 1936
1928 void HTMLMediaElement::playInternal() 1937 void HTMLMediaElement::playInternal()
(...skipping 1731 matching lines...) Expand 10 before | Expand all | Expand 10 after
3660 3669
3661 #if ENABLE(WEB_AUDIO) 3670 #if ENABLE(WEB_AUDIO)
3662 void HTMLMediaElement::clearWeakMembers(Visitor* visitor) 3671 void HTMLMediaElement::clearWeakMembers(Visitor* visitor)
3663 { 3672 {
3664 if (!Heap::isHeapObjectAlive(m_audioSourceNode) && audioSourceProvider()) 3673 if (!Heap::isHeapObjectAlive(m_audioSourceNode) && audioSourceProvider())
3665 audioSourceProvider()->setClient(nullptr); 3674 audioSourceProvider()->setClient(nullptr);
3666 } 3675 }
3667 #endif 3676 #endif
3668 3677
3669 } 3678 }
OLDNEW
« 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