Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 87 #include "public/platform/WebInbandTextTrack.h" | 87 #include "public/platform/WebInbandTextTrack.h" |
| 88 #include "public/platform/WebMediaPlayerSource.h" | 88 #include "public/platform/WebMediaPlayerSource.h" |
| 89 #include "public/platform/WebMediaStream.h" | 89 #include "public/platform/WebMediaStream.h" |
| 90 #include "public/platform/modules/remoteplayback/WebRemotePlaybackClient.h" | 90 #include "public/platform/modules/remoteplayback/WebRemotePlaybackClient.h" |
| 91 #include "public/platform/modules/remoteplayback/WebRemotePlaybackState.h" | 91 #include "public/platform/modules/remoteplayback/WebRemotePlaybackState.h" |
| 92 #include "wtf/CurrentTime.h" | 92 #include "wtf/CurrentTime.h" |
| 93 #include "wtf/MathExtras.h" | 93 #include "wtf/MathExtras.h" |
| 94 #include "wtf/text/CString.h" | 94 #include "wtf/text/CString.h" |
| 95 #include <limits> | 95 #include <limits> |
| 96 | 96 |
| 97 #define MEDIA_LOG_LEVEL 3 | 97 #define MEDIA_LOG_LEVEL 0 |
|
mlamouri (slow - plz ping)
2016/06/07 12:50:41
Did you mean to change this?
whywhat
2016/06/07 14:20:08
Reverted.
| |
| 98 | 98 |
| 99 #ifndef LOG_MEDIA_EVENTS | 99 #ifndef LOG_MEDIA_EVENTS |
| 100 // Default to not logging events because so many are generated they can overwhel m the rest of | 100 // Default to not logging events because so many are generated they can overwhel m the rest of |
| 101 // the logging. | 101 // the logging. |
| 102 #define LOG_MEDIA_EVENTS 0 | 102 #define LOG_MEDIA_EVENTS 0 |
| 103 #endif | 103 #endif |
| 104 | 104 |
| 105 #ifndef LOG_CACHED_TIME_WARNINGS | 105 #ifndef LOG_CACHED_TIME_WARNINGS |
| 106 // Default to not logging warnings about excessive drift in the cached media tim e because it adds a | 106 // Default to not logging warnings about excessive drift in the cached media tim e because it adds a |
| 107 // fair amount of overhead and logging. | 107 // fair amount of overhead and logging. |
| (...skipping 2149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2257 m_autoplayHelper->mutedChanged(); | 2257 m_autoplayHelper->mutedChanged(); |
| 2258 | 2258 |
| 2259 updateVolume(); | 2259 updateVolume(); |
| 2260 | 2260 |
| 2261 if (muted) | 2261 if (muted) |
| 2262 Platform::current()->recordAction(UserMetricsAction("Media_Playback_Mute _On")); | 2262 Platform::current()->recordAction(UserMetricsAction("Media_Playback_Mute _On")); |
| 2263 else | 2263 else |
| 2264 Platform::current()->recordAction(UserMetricsAction("Media_Playback_Mute _Off")); | 2264 Platform::current()->recordAction(UserMetricsAction("Media_Playback_Mute _Off")); |
| 2265 | 2265 |
| 2266 scheduleEvent(EventTypeNames::volumechange); | 2266 scheduleEvent(EventTypeNames::volumechange); |
| 2267 | |
| 2268 if (!UserGestureIndicator::processingUserGesture()) | |
| 2269 pause(); | |
|
mlamouri (slow - plz ping)
2016/06/07 12:50:41
We should only have this behaviour for videos that
whywhat
2016/06/07 14:20:08
Removed.
| |
| 2267 } | 2270 } |
| 2268 | 2271 |
| 2269 void HTMLMediaElement::updateVolume() | 2272 void HTMLMediaElement::updateVolume() |
| 2270 { | 2273 { |
| 2271 if (webMediaPlayer()) | 2274 if (webMediaPlayer()) |
| 2272 webMediaPlayer()->setVolume(effectiveMediaVolume()); | 2275 webMediaPlayer()->setVolume(effectiveMediaVolume()); |
| 2273 | 2276 |
| 2274 if (mediaControls()) | 2277 if (mediaControls()) |
| 2275 mediaControls()->updateVolume(); | 2278 mediaControls()->updateVolume(); |
| 2276 } | 2279 } |
| (...skipping 1377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3654 return m_lockedPendingUserGesture; | 3657 return m_lockedPendingUserGesture; |
| 3655 } | 3658 } |
| 3656 | 3659 |
| 3657 void HTMLMediaElement::unlockUserGesture() | 3660 void HTMLMediaElement::unlockUserGesture() |
| 3658 { | 3661 { |
| 3659 m_lockedPendingUserGesture = false; | 3662 m_lockedPendingUserGesture = false; |
| 3660 } | 3663 } |
| 3661 | 3664 |
| 3662 bool HTMLMediaElement::isGestureNeededForPlayback() const | 3665 bool HTMLMediaElement::isGestureNeededForPlayback() const |
| 3663 { | 3666 { |
| 3664 return m_lockedPendingUserGesture | 3667 if (!m_lockedPendingUserGesture) |
| 3665 && !m_autoplayHelper->isGestureRequirementOverridden(); | 3668 return false; |
| 3669 | |
| 3670 if (RuntimeEnabledFeatures::videosAsImagesEnabled() && muted()) | |
| 3671 return false; | |
|
mlamouri (slow - plz ping)
2016/06/07 12:50:41
I would leave this for another CL but you will nee
whywhat
2016/06/07 14:20:08
Ok.
| |
| 3672 | |
| 3673 if (m_autoplayHelper->isGestureRequirementOverridden()) | |
| 3674 return false; | |
| 3675 | |
| 3676 return true; | |
| 3666 } | 3677 } |
| 3667 | 3678 |
| 3668 void HTMLMediaElement::setNetworkState(NetworkState state) | 3679 void HTMLMediaElement::setNetworkState(NetworkState state) |
| 3669 { | 3680 { |
| 3670 if (m_networkState != state) { | 3681 if (m_networkState != state) { |
| 3671 m_networkState = state; | 3682 m_networkState = state; |
| 3672 if (MediaControls* controls = mediaControls()) | 3683 if (MediaControls* controls = mediaControls()) |
| 3673 controls->networkStateChanged(); | 3684 controls->networkStateChanged(); |
| 3674 } | 3685 } |
| 3675 } | 3686 } |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3881 | 3892 |
| 3882 IntRect HTMLMediaElement::AutoplayHelperClientImpl::absoluteBoundingBoxRect() co nst | 3893 IntRect HTMLMediaElement::AutoplayHelperClientImpl::absoluteBoundingBoxRect() co nst |
| 3883 { | 3894 { |
| 3884 IntRect result; | 3895 IntRect result; |
| 3885 if (LayoutObject* object = m_element->layoutObject()) | 3896 if (LayoutObject* object = m_element->layoutObject()) |
| 3886 result = object->absoluteBoundingBoxRect(); | 3897 result = object->absoluteBoundingBoxRect(); |
| 3887 return result; | 3898 return result; |
| 3888 } | 3899 } |
| 3889 | 3900 |
| 3890 } // namespace blink | 3901 } // namespace blink |
| OLD | NEW |