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

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

Issue 2075563003: [Android, Media] Don't unlock MediaStream elements; instead allow MS to autoplay without a gesture. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changed the test to not use getUserMedia Created 4 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 bff62e7bfdb250473405fbd5bc2215a8d99b8bf2..0af541c17e923d2be94add6c7200fd8b2d37c148 100644
--- a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
@@ -1034,9 +1034,7 @@ void HTMLMediaElement::loadResource(const WebMediaPlayerSource& source, const Co
bool isStreamOrBlobUrl = source.isMediaStream() || url.protocolIs(mediaSourceBlobProtocol);
if (isStreamOrBlobUrl) {
bool isMediaStream = source.isMediaStream() || (source.isURL() && isMediaStreamURL(url.getString()));
- if (isMediaStream) {
- m_autoplayHelper->unlockUserGesture(GesturelessPlaybackEnabledByStream);
- } else {
+ if (!isMediaStream) {
m_mediaSource = HTMLMediaSource::lookup(url.getString());
if (m_mediaSource) {
@@ -1223,7 +1221,7 @@ WebMediaPlayer::LoadType HTMLMediaElement::loadType() const
if (m_mediaSource)
return WebMediaPlayer::LoadTypeMediaSource;
- if (m_srcObject || isMediaStreamURL(m_currentSrc.getString()))
+ if (m_srcObject || (!m_currentSrc.isNull() && isMediaStreamURL(m_currentSrc.getString())))
return WebMediaPlayer::LoadTypeMediaStream;
return WebMediaPlayer::LoadTypeURL;
@@ -3725,6 +3723,9 @@ bool HTMLMediaElement::isGestureNeededForPlayback() const
if (!m_lockedPendingUserGesture)
return false;
+ if (loadType() == WebMediaPlayer::LoadTypeMediaStream)
+ return false;
+
// We want to allow muted video to autoplay if:
// - the flag is enabled;
// - Data Saver is not enabled;

Powered by Google App Engine
This is Rietveld 408576698