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 2030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2041 m_autoplayHelper->playMethodCalled(); | 2041 m_autoplayHelper->playMethodCalled(); |
2042 | 2042 |
2043 if (!UserGestureIndicator::processingUserGesture()) { | 2043 if (!UserGestureIndicator::processingUserGesture()) { |
2044 if (m_userGestureRequiredForPlay) { | 2044 if (m_userGestureRequiredForPlay) { |
2045 recordAutoplayMetric(PlayMethodFailed); | 2045 recordAutoplayMetric(PlayMethodFailed); |
2046 String message = ExceptionMessages::failedToExecute("play", "HTMLMed
iaElement", "API can only be initiated by a user gesture."); | 2046 String message = ExceptionMessages::failedToExecute("play", "HTMLMed
iaElement", "API can only be initiated by a user gesture."); |
2047 document().addConsoleMessage(ConsoleMessage::create(JSMessageSource,
WarningMessageLevel, message)); | 2047 document().addConsoleMessage(ConsoleMessage::create(JSMessageSource,
WarningMessageLevel, message)); |
2048 return NotAllowedError; | 2048 return NotAllowedError; |
2049 } | 2049 } |
2050 } else { | 2050 } else { |
| 2051 UserGestureIndicator::utilizeUserGesture(); |
2051 // We ask the helper to remove the gesture requirement for us, so that | 2052 // We ask the helper to remove the gesture requirement for us, so that |
2052 // it can record the reason. | 2053 // it can record the reason. |
2053 Platform::current()->recordAction(UserMetricsAction("Media_Play_WithGest
ure")); | 2054 Platform::current()->recordAction(UserMetricsAction("Media_Play_WithGest
ure")); |
2054 m_autoplayHelper->removeUserGestureRequirement(GesturelessPlaybackEnable
dByPlayMethod); | 2055 m_autoplayHelper->removeUserGestureRequirement(GesturelessPlaybackEnable
dByPlayMethod); |
2055 } | 2056 } |
2056 | 2057 |
2057 if (m_error && m_error->code() == MediaError::MEDIA_ERR_SRC_NOT_SUPPORTED) | 2058 if (m_error && m_error->code() == MediaError::MEDIA_ERR_SRC_NOT_SUPPORTED) |
2058 return NotSupportedError; | 2059 return NotSupportedError; |
2059 | 2060 |
2060 playInternal(); | 2061 playInternal(); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2100 setIgnorePreloadNone(); | 2101 setIgnorePreloadNone(); |
2101 updatePlayState(); | 2102 updatePlayState(); |
2102 } | 2103 } |
2103 | 2104 |
2104 void HTMLMediaElement::pause() | 2105 void HTMLMediaElement::pause() |
2105 { | 2106 { |
2106 WTF_LOG(Media, "HTMLMediaElement::pause(%p)", this); | 2107 WTF_LOG(Media, "HTMLMediaElement::pause(%p)", this); |
2107 | 2108 |
2108 // Only buffer aggressively on a user-initiated pause. Other types of pauses | 2109 // Only buffer aggressively on a user-initiated pause. Other types of pauses |
2109 // (which go directly to pauseInternal()) should not cause this behavior. | 2110 // (which go directly to pauseInternal()) should not cause this behavior. |
2110 if (webMediaPlayer() && UserGestureIndicator::processingUserGesture()) | 2111 if (webMediaPlayer() && UserGestureIndicator::utilizeUserGesture()) |
2111 webMediaPlayer()->setBufferingStrategy(WebMediaPlayer::BufferingStrategy
::Aggressive); | 2112 webMediaPlayer()->setBufferingStrategy(WebMediaPlayer::BufferingStrategy
::Aggressive); |
2112 | 2113 |
2113 pauseInternal(); | 2114 pauseInternal(); |
2114 } | 2115 } |
2115 | 2116 |
2116 void HTMLMediaElement::pauseInternal() | 2117 void HTMLMediaElement::pauseInternal() |
2117 { | 2118 { |
2118 WTF_LOG(Media, "HTMLMediaElement::pauseInternal(%p)", this); | 2119 WTF_LOG(Media, "HTMLMediaElement::pauseInternal(%p)", this); |
2119 | 2120 |
2120 if (m_networkState == NETWORK_EMPTY) | 2121 if (m_networkState == NETWORK_EMPTY) |
(...skipping 1761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3882 } | 3883 } |
3883 | 3884 |
3884 #if !ENABLE(OILPAN) | 3885 #if !ENABLE(OILPAN) |
3885 WeakPtr<HTMLMediaElement> HTMLMediaElement::createWeakPtr() | 3886 WeakPtr<HTMLMediaElement> HTMLMediaElement::createWeakPtr() |
3886 { | 3887 { |
3887 return m_weakPtrFactory.createWeakPtr(); | 3888 return m_weakPtrFactory.createWeakPtr(); |
3888 } | 3889 } |
3889 #endif | 3890 #endif |
3890 | 3891 |
3891 } // namespace blink | 3892 } // namespace blink |
OLD | NEW |