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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
244 // when used with parameters, e.g. "application/octet-stream;codecs=theora", is a type that the user agent knows | 244 // when used with parameters, e.g. "application/octet-stream;codecs=theora", is a type that the user agent knows |
245 // it cannot render. | 245 // it cannot render. |
246 if (contentMIMEType != "application/octet-stream" || contentTypeCodecs.isEmp ty()) { | 246 if (contentMIMEType != "application/octet-stream" || contentTypeCodecs.isEmp ty()) { |
247 WebMimeRegistry::SupportsType supported = Platform::current()->mimeRegis try()->supportsMediaMIMEType(contentMIMEType, contentTypeCodecs, keySystem.lower ()); | 247 WebMimeRegistry::SupportsType supported = Platform::current()->mimeRegis try()->supportsMediaMIMEType(contentMIMEType, contentTypeCodecs, keySystem.lower ()); |
248 return supported > WebMimeRegistry::IsNotSupported; | 248 return supported > WebMimeRegistry::IsNotSupported; |
249 } | 249 } |
250 | 250 |
251 return false; | 251 return false; |
252 } | 252 } |
253 | 253 |
254 // These values are used for a histogram. Do not reorder. | 254 void HTMLMediaElement::recordAutoplayMetric(AutoplayMetrics metric) |
255 enum AutoplayMetrics { | |
256 // Media element with autoplay seen. | |
257 AutoplayMediaFound = 0, | |
258 // Autoplay enabled and user stopped media play at any point. | |
259 AutoplayStopped = 1, | |
260 // Autoplay enabled but user bailed out on media play early. | |
261 AutoplayBailout = 2, | |
262 // Autoplay disabled but user manually started media. | |
263 AutoplayManualStart = 3, | |
264 // Autoplay was (re)enabled through a user-gesture triggered load() | |
265 AutoplayEnabledThroughLoad = 4, | |
266 // Autoplay disabled by sandbox flags. | |
267 AutoplayDisabledBySandbox = 5, | |
268 // This enum value must be last. | |
269 NumberOfAutoplayMetrics, | |
270 }; | |
271 | |
272 static void recordAutoplayMetric(AutoplayMetrics metric) | |
273 { | 255 { |
274 Platform::current()->histogramEnumeration("Blink.MediaElement.Autoplay", met ric, NumberOfAutoplayMetrics); | 256 Platform::current()->histogramEnumeration("Blink.MediaElement.Autoplay", met ric, NumberOfAutoplayMetrics); |
275 } | 257 } |
276 | 258 |
277 WebMimeRegistry::SupportsType HTMLMediaElement::supportsType(const ContentType& contentType, const String& keySystem) | 259 WebMimeRegistry::SupportsType HTMLMediaElement::supportsType(const ContentType& contentType, const String& keySystem) |
278 { | 260 { |
279 DEFINE_STATIC_LOCAL(const String, codecs, ("codecs")); | 261 DEFINE_STATIC_LOCAL(const String, codecs, ("codecs")); |
280 | 262 |
281 if (!RuntimeEnabledFeatures::mediaEnabled()) | 263 if (!RuntimeEnabledFeatures::mediaEnabled()) |
282 return WebMimeRegistry::IsNotSupported; | 264 return WebMimeRegistry::IsNotSupported; |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
360 , m_playingRemotely(false) | 342 , m_playingRemotely(false) |
361 , m_isFinalizing(false) | 343 , m_isFinalizing(false) |
362 , m_initialPlayWithoutUserGestures(false) | 344 , m_initialPlayWithoutUserGestures(false) |
363 , m_autoplayMediaCounted(false) | 345 , m_autoplayMediaCounted(false) |
364 , m_audioTracks(AudioTrackList::create(*this)) | 346 , m_audioTracks(AudioTrackList::create(*this)) |
365 , m_videoTracks(VideoTrackList::create(*this)) | 347 , m_videoTracks(VideoTrackList::create(*this)) |
366 , m_textTracks(nullptr) | 348 , m_textTracks(nullptr) |
367 #if ENABLE(WEB_AUDIO) | 349 #if ENABLE(WEB_AUDIO) |
368 , m_audioSourceNode(nullptr) | 350 , m_audioSourceNode(nullptr) |
369 #endif | 351 #endif |
352 , m_autoplayHelper(*this) | |
370 { | 353 { |
371 #if ENABLE(OILPAN) | 354 #if ENABLE(OILPAN) |
372 ThreadState::current()->registerPreFinalizer(this); | 355 ThreadState::current()->registerPreFinalizer(this); |
373 #endif | 356 #endif |
374 ASSERT(RuntimeEnabledFeatures::mediaEnabled()); | 357 ASSERT(RuntimeEnabledFeatures::mediaEnabled()); |
375 | 358 |
376 WTF_LOG(Media, "HTMLMediaElement::HTMLMediaElement(%p)", this); | 359 WTF_LOG(Media, "HTMLMediaElement::HTMLMediaElement(%p)", this); |
377 | 360 |
378 if (document.settings() && document.settings()->mediaPlaybackRequiresUserGes ture()) | 361 if (document.settings() && document.settings()->mediaPlaybackRequiresUserGes ture()) |
379 m_userGestureRequiredForPlay = true; | 362 m_userGestureRequiredForPlay = true; |
380 | 363 |
381 setHasCustomStyleCallbacks(); | 364 setHasCustomStyleCallbacks(); |
382 addElementToDocumentMap(this, &document); | 365 addElementToDocumentMap(this, &document); |
383 } | 366 } |
384 | 367 |
385 HTMLMediaElement::~HTMLMediaElement() | 368 HTMLMediaElement::~HTMLMediaElement() |
386 { | 369 { |
387 WTF_LOG(Media, "HTMLMediaElement::~HTMLMediaElement(%p)", this); | 370 WTF_LOG(Media, "HTMLMediaElement::~HTMLMediaElement(%p)", this); |
371 | |
388 #if !ENABLE(OILPAN) | 372 #if !ENABLE(OILPAN) |
389 // HTMLMediaElement and m_asyncEventQueue always become unreachable | 373 // HTMLMediaElement and m_asyncEventQueue always become unreachable |
390 // together. So HTMLMediaElement and m_asyncEventQueue are destructed in | 374 // together. So HTMLMediaElement and m_asyncEventQueue are destructed in |
391 // the same GC. We don't need to close it explicitly in Oilpan. | 375 // the same GC. We don't need to close it explicitly in Oilpan. |
392 m_asyncEventQueue->close(); | 376 m_asyncEventQueue->close(); |
393 | 377 |
394 setShouldDelayLoadEvent(false); | 378 setShouldDelayLoadEvent(false); |
395 | 379 |
396 if (m_textTracks) | 380 if (m_textTracks) |
397 m_textTracks->clearOwner(); | 381 m_textTracks->clearOwner(); |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
687 case WebMimeRegistry::IsSupported: | 671 case WebMimeRegistry::IsSupported: |
688 canPlay = "probably"; | 672 canPlay = "probably"; |
689 break; | 673 break; |
690 } | 674 } |
691 | 675 |
692 WTF_LOG(Media, "HTMLMediaElement::canPlayType(%p, %s, %s) -> %s", this, mime Type.utf8().data(), keySystem.utf8().data(), canPlay.utf8().data()); | 676 WTF_LOG(Media, "HTMLMediaElement::canPlayType(%p, %s, %s) -> %s", this, mime Type.utf8().data(), keySystem.utf8().data(), canPlay.utf8().data()); |
693 | 677 |
694 return canPlay; | 678 return canPlay; |
695 } | 679 } |
696 | 680 |
681 void HTMLMediaElement::recordMetricsIfStopping() | |
philipj_slow
2015/08/13 11:12:48
Since this AutoplayExperimentHelper is a friend cl
liberato (no reviews please)
2015/09/01 06:54:20
they could, but they were part of the old autoplay
| |
682 { | |
683 // If not playing, then nothing to record. | |
684 if (!m_playing) | |
685 return; | |
686 | |
687 const bool bailout = isBailout(); | |
688 | |
689 // Record that play was stopped. We don't care if it was autoplay, | |
690 // play(), or the user manually started it. | |
691 recordAutoplayMetric(AnyPlaybackStopped); | |
692 if (bailout) | |
693 recordAutoplayMetric(AnyPlaybackBailout); | |
694 | |
695 // If this was a gestureless play, then record that separately. | |
696 // These cover attr and play() gestureless starts. | |
697 if (m_initialPlayWithoutUserGestures) { | |
698 m_initialPlayWithoutUserGestures = false; | |
699 | |
700 recordAutoplayMetric(AutoplayStopped); | |
701 | |
702 if (bailout) | |
703 recordAutoplayMetric(AutoplayBailout); | |
704 } | |
705 } | |
706 | |
697 void HTMLMediaElement::load() | 707 void HTMLMediaElement::load() |
698 { | 708 { |
699 WTF_LOG(Media, "HTMLMediaElement::load(%p)", this); | 709 WTF_LOG(Media, "HTMLMediaElement::load(%p)", this); |
700 | 710 |
701 if (m_initialPlayWithoutUserGestures && m_playing) | 711 recordMetricsIfStopping(); |
702 gesturelessInitialPlayHalted(); | |
703 | 712 |
704 if (UserGestureIndicator::processingUserGesture() && m_userGestureRequiredFo rPlay) { | 713 if (UserGestureIndicator::processingUserGesture() && m_userGestureRequiredFo rPlay) { |
705 recordAutoplayMetric(AutoplayEnabledThroughLoad); | 714 recordAutoplayMetric(AutoplayEnabledThroughLoad); |
706 m_userGestureRequiredForPlay = false; | 715 m_userGestureRequiredForPlay = false; |
707 // While usergesture-initiated load()s technically count as autoplayed, | 716 // While usergesture-initiated load()s technically count as autoplayed, |
708 // they don't feel like such to the users and hence we don't want to | 717 // they don't feel like such to the users and hence we don't want to |
709 // count them for the purposes of metrics. | 718 // count them for the purposes of metrics. |
710 m_autoplayMediaCounted = true; | 719 m_autoplayMediaCounted = true; |
711 } | 720 } |
712 | 721 |
(...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1548 scheduleEvent(EventTypeNames::canplay); | 1557 scheduleEvent(EventTypeNames::canplay); |
1549 if (isPotentiallyPlaying) | 1558 if (isPotentiallyPlaying) |
1550 scheduleEvent(EventTypeNames::playing); | 1559 scheduleEvent(EventTypeNames::playing); |
1551 } | 1560 } |
1552 | 1561 |
1553 if (m_autoplaying && m_paused && autoplay()) { | 1562 if (m_autoplaying && m_paused && autoplay()) { |
1554 autoplayMediaEncountered(); | 1563 autoplayMediaEncountered(); |
1555 | 1564 |
1556 if (document().isSandboxed(SandboxAutomaticFeatures)) { | 1565 if (document().isSandboxed(SandboxAutomaticFeatures)) { |
1557 recordAutoplayMetric(AutoplayDisabledBySandbox); | 1566 recordAutoplayMetric(AutoplayDisabledBySandbox); |
1558 } else if (!m_userGestureRequiredForPlay) { | 1567 } else { |
1559 m_paused = false; | 1568 // If the autoplay experiment says that it's okay to play now, |
1560 invalidateCachedTime(); | 1569 // then don't require a user gesture. |
1561 scheduleEvent(EventTypeNames::play); | 1570 m_autoplayHelper.onReadyToPlay(); |
1562 scheduleEvent(EventTypeNames::playing); | 1571 |
1572 if (!m_userGestureRequiredForPlay) { | |
1573 m_paused = false; | |
1574 invalidateCachedTime(); | |
1575 scheduleEvent(EventTypeNames::play); | |
1576 scheduleEvent(EventTypeNames::playing); | |
1577 } | |
1563 } | 1578 } |
1564 } | 1579 } |
1565 | 1580 |
1566 scheduleEvent(EventTypeNames::canplaythrough); | 1581 scheduleEvent(EventTypeNames::canplaythrough); |
1567 | 1582 |
1568 shouldUpdateDisplayState = true; | 1583 shouldUpdateDisplayState = true; |
1569 } | 1584 } |
1570 | 1585 |
1571 if (shouldUpdateDisplayState) { | 1586 if (shouldUpdateDisplayState) { |
1572 updateDisplayState(); | 1587 updateDisplayState(); |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1953 | 1968 |
1954 WebMediaPlayer::Preload HTMLMediaElement::effectivePreloadType() const | 1969 WebMediaPlayer::Preload HTMLMediaElement::effectivePreloadType() const |
1955 { | 1970 { |
1956 return autoplay() ? WebMediaPlayer::PreloadAuto : preloadType(); | 1971 return autoplay() ? WebMediaPlayer::PreloadAuto : preloadType(); |
1957 } | 1972 } |
1958 | 1973 |
1959 void HTMLMediaElement::play() | 1974 void HTMLMediaElement::play() |
1960 { | 1975 { |
1961 WTF_LOG(Media, "HTMLMediaElement::play(%p)", this); | 1976 WTF_LOG(Media, "HTMLMediaElement::play(%p)", this); |
1962 | 1977 |
1978 m_autoplayHelper.onPlayMethodCalled(); | |
1979 | |
1963 if (!UserGestureIndicator::processingUserGesture()) { | 1980 if (!UserGestureIndicator::processingUserGesture()) { |
1964 autoplayMediaEncountered(); | 1981 autoplayMediaEncountered(); |
1982 | |
1965 if (m_userGestureRequiredForPlay) { | 1983 if (m_userGestureRequiredForPlay) { |
1984 recordAutoplayMetric(PlayMethodFailed); | |
philipj_slow
2015/08/13 11:12:48
If recordAutoplayMetric is also moved to the helpe
liberato (no reviews please)
2015/09/01 06:54:20
Acknowledged.
| |
1966 String message = ExceptionMessages::failedToExecute("play", "HTMLMed iaElement", "API can only be initiated by a user gesture."); | 1985 String message = ExceptionMessages::failedToExecute("play", "HTMLMed iaElement", "API can only be initiated by a user gesture."); |
1967 document().executionContext()->addConsoleMessage(ConsoleMessage::cre ate(JSMessageSource, WarningMessageLevel, message)); | 1986 document().executionContext()->addConsoleMessage(ConsoleMessage::cre ate(JSMessageSource, WarningMessageLevel, message)); |
1968 return; | 1987 return; |
1969 } | 1988 } |
1970 } else if (m_userGestureRequiredForPlay) { | 1989 } else if (m_userGestureRequiredForPlay) { |
1971 if (m_autoplayMediaCounted) | 1990 if (m_autoplayMediaCounted) |
1972 recordAutoplayMetric(AutoplayManualStart); | 1991 recordAutoplayMetric(AutoplayManualStart); |
1973 m_userGestureRequiredForPlay = false; | 1992 m_userGestureRequiredForPlay = false; |
1974 } | 1993 } |
1975 | 1994 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2013 { | 2032 { |
2014 if (!m_autoplayMediaCounted) { | 2033 if (!m_autoplayMediaCounted) { |
2015 m_autoplayMediaCounted = true; | 2034 m_autoplayMediaCounted = true; |
2016 recordAutoplayMetric(AutoplayMediaFound); | 2035 recordAutoplayMetric(AutoplayMediaFound); |
2017 | 2036 |
2018 if (!m_userGestureRequiredForPlay) | 2037 if (!m_userGestureRequiredForPlay) |
2019 m_initialPlayWithoutUserGestures = true; | 2038 m_initialPlayWithoutUserGestures = true; |
2020 } | 2039 } |
2021 } | 2040 } |
2022 | 2041 |
2023 void HTMLMediaElement::gesturelessInitialPlayHalted() | 2042 bool HTMLMediaElement::isBailout() const |
2024 { | 2043 { |
2025 ASSERT(m_initialPlayWithoutUserGestures); | |
2026 m_initialPlayWithoutUserGestures = false; | |
2027 | |
2028 recordAutoplayMetric(AutoplayStopped); | |
2029 | |
2030 // We count the user as having bailed-out on the video if they watched | 2044 // We count the user as having bailed-out on the video if they watched |
2031 // less than one minute and less than 50% of it. | 2045 // less than one minute and less than 50% of it. |
2032 double playedTime = currentTime(); | 2046 const double playedTime = currentTime(); |
2033 if (playedTime < 60) { | 2047 const double progress = playedTime / duration(); |
2034 double progress = playedTime / duration(); | 2048 return (playedTime < 60) && (progress < 0.5); |
2035 if (progress < 0.5) | |
2036 recordAutoplayMetric(AutoplayBailout); | |
2037 } | |
2038 } | 2049 } |
2039 | 2050 |
2040 void HTMLMediaElement::pause() | 2051 void HTMLMediaElement::pause() |
2041 { | 2052 { |
2042 WTF_LOG(Media, "HTMLMediaElement::pause(%p)", this); | 2053 WTF_LOG(Media, "HTMLMediaElement::pause(%p)", this); |
2043 | 2054 |
2044 if (m_networkState == NETWORK_EMPTY) | 2055 if (m_networkState == NETWORK_EMPTY) |
2045 scheduleDelayedAction(LoadMediaResource); | 2056 scheduleDelayedAction(LoadMediaResource); |
2046 | 2057 |
2058 m_autoplayHelper.onPauseMethodCalled(); | |
2059 | |
2047 m_autoplaying = false; | 2060 m_autoplaying = false; |
2048 | 2061 |
2049 if (!m_paused) { | 2062 if (!m_paused) { |
2050 if (m_initialPlayWithoutUserGestures) | 2063 recordMetricsIfStopping(); |
2051 gesturelessInitialPlayHalted(); | |
2052 | 2064 |
2053 m_paused = true; | 2065 m_paused = true; |
2054 scheduleTimeupdateEvent(false); | 2066 scheduleTimeupdateEvent(false); |
2055 scheduleEvent(EventTypeNames::pause); | 2067 scheduleEvent(EventTypeNames::pause); |
2056 } | 2068 } |
2057 | 2069 |
2058 updatePlayState(); | 2070 updatePlayState(); |
2059 } | 2071 } |
2060 | 2072 |
2061 void HTMLMediaElement::requestRemotePlayback() | 2073 void HTMLMediaElement::requestRemotePlayback() |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2134 | 2146 |
2135 void HTMLMediaElement::setMuted(bool muted) | 2147 void HTMLMediaElement::setMuted(bool muted) |
2136 { | 2148 { |
2137 WTF_LOG(Media, "HTMLMediaElement::setMuted(%p, %s)", this, boolString(muted) ); | 2149 WTF_LOG(Media, "HTMLMediaElement::setMuted(%p, %s)", this, boolString(muted) ); |
2138 | 2150 |
2139 if (m_muted == muted) | 2151 if (m_muted == muted) |
2140 return; | 2152 return; |
2141 | 2153 |
2142 m_muted = muted; | 2154 m_muted = muted; |
2143 | 2155 |
2156 m_autoplayHelper.onMuteChanged(); | |
philipj_slow
2015/08/13 11:12:48
s/Mute/Muted/
liberato (no reviews please)
2015/09/01 06:54:20
Done.
| |
2157 | |
2144 updateVolume(); | 2158 updateVolume(); |
2145 | 2159 |
2146 scheduleEvent(EventTypeNames::volumechange); | 2160 scheduleEvent(EventTypeNames::volumechange); |
2147 } | 2161 } |
2148 | 2162 |
2149 void HTMLMediaElement::updateVolume() | 2163 void HTMLMediaElement::updateVolume() |
2150 { | 2164 { |
2151 if (webMediaPlayer()) | 2165 if (webMediaPlayer()) |
2152 webMediaPlayer()->setVolume(effectiveMediaVolume()); | 2166 webMediaPlayer()->setVolume(effectiveMediaVolume()); |
2153 | 2167 |
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2765 if (!m_mediaController && !m_paused) { | 2779 if (!m_mediaController && !m_paused) { |
2766 // changes paused to true and fires a simple event named pause a t the media element. | 2780 // changes paused to true and fires a simple event named pause a t the media element. |
2767 m_paused = true; | 2781 m_paused = true; |
2768 scheduleEvent(EventTypeNames::pause); | 2782 scheduleEvent(EventTypeNames::pause); |
2769 } | 2783 } |
2770 // Queue a task to fire a simple event named ended at the media elem ent. | 2784 // Queue a task to fire a simple event named ended at the media elem ent. |
2771 if (!m_sentEndEvent) { | 2785 if (!m_sentEndEvent) { |
2772 m_sentEndEvent = true; | 2786 m_sentEndEvent = true; |
2773 scheduleEvent(EventTypeNames::ended); | 2787 scheduleEvent(EventTypeNames::ended); |
2774 } | 2788 } |
2789 recordMetricsIfStopping(); | |
2775 // If the media element has a current media controller, then report the controller state | 2790 // If the media element has a current media controller, then report the controller state |
2776 // for the media element's current media controller. | 2791 // for the media element's current media controller. |
2777 updateMediaController(); | 2792 updateMediaController(); |
2778 } | 2793 } |
2779 } else { | 2794 } else { |
2780 m_sentEndEvent = false; | 2795 m_sentEndEvent = false; |
2781 } | 2796 } |
2782 | 2797 |
2783 updatePlayState(); | 2798 updatePlayState(); |
2784 } | 2799 } |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2985 // The media engine should just stash the rate and muted values sinc e it isn't already playing. | 3000 // The media engine should just stash the rate and muted values sinc e it isn't already playing. |
2986 webMediaPlayer()->setRate(effectivePlaybackRate()); | 3001 webMediaPlayer()->setRate(effectivePlaybackRate()); |
2987 updateVolume(); | 3002 updateVolume(); |
2988 webMediaPlayer()->play(); | 3003 webMediaPlayer()->play(); |
2989 } | 3004 } |
2990 | 3005 |
2991 if (mediaControls()) | 3006 if (mediaControls()) |
2992 mediaControls()->playbackStarted(); | 3007 mediaControls()->playbackStarted(); |
2993 startPlaybackProgressTimer(); | 3008 startPlaybackProgressTimer(); |
2994 m_playing = true; | 3009 m_playing = true; |
3010 recordAutoplayMetric(AnyPlaybackStarted); | |
2995 | 3011 |
2996 } else { // Should not be playing right now | 3012 } else { // Should not be playing right now |
2997 if (isPlaying) | 3013 if (isPlaying) |
2998 webMediaPlayer()->pause(); | 3014 webMediaPlayer()->pause(); |
2999 refreshCachedTime(); | 3015 refreshCachedTime(); |
3000 | 3016 |
3001 m_playbackProgressTimer.stop(); | 3017 m_playbackProgressTimer.stop(); |
3002 m_playing = false; | 3018 m_playing = false; |
3003 double time = currentTime(); | 3019 double time = currentTime(); |
3004 if (time > m_lastSeekTime) | 3020 if (time > m_lastSeekTime) |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3104 mediaControls()->refreshCastButtonVisibility(); | 3120 mediaControls()->refreshCastButtonVisibility(); |
3105 | 3121 |
3106 if (layoutObject()) | 3122 if (layoutObject()) |
3107 layoutObject()->setShouldDoFullPaintInvalidation(); | 3123 layoutObject()->setShouldDoFullPaintInvalidation(); |
3108 } | 3124 } |
3109 | 3125 |
3110 void HTMLMediaElement::stop() | 3126 void HTMLMediaElement::stop() |
3111 { | 3127 { |
3112 WTF_LOG(Media, "HTMLMediaElement::stop(%p)", this); | 3128 WTF_LOG(Media, "HTMLMediaElement::stop(%p)", this); |
3113 | 3129 |
3114 if (m_playing && m_initialPlayWithoutUserGestures) | 3130 recordMetricsIfStopping(); |
philipj_slow
2015/08/13 11:12:48
HTMLMediaElement::stop() is an ActiveDOMObject ove
philipj_slow
2015/09/02 09:31:47
Ping.
| |
3115 gesturelessInitialPlayHalted(); | |
3116 | 3131 |
3117 // Close the async event queue so that no events are enqueued by userCancell edLoad. | 3132 // Close the async event queue so that no events are enqueued by userCancell edLoad. |
3118 cancelPendingEventsAndCallbacks(); | 3133 cancelPendingEventsAndCallbacks(); |
3119 m_asyncEventQueue->close(); | 3134 m_asyncEventQueue->close(); |
3120 | 3135 |
3121 userCancelledLoad(); | 3136 userCancelledLoad(); |
3122 | 3137 |
3123 // Stop the playback without generating events | 3138 // Stop the playback without generating events |
3124 m_playing = false; | 3139 m_playing = false; |
3125 m_paused = true; | 3140 m_paused = true; |
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3714 | 3729 |
3715 // Enable the first audio track if an audio track hasn't been enabled yet. | 3730 // Enable the first audio track if an audio track hasn't been enabled yet. |
3716 if (audioTracks().length() > 0 && !audioTracks().hasEnabledTrack()) | 3731 if (audioTracks().length() > 0 && !audioTracks().hasEnabledTrack()) |
3717 audioTracks().anonymousIndexedGetter(0)->setEnabled(true); | 3732 audioTracks().anonymousIndexedGetter(0)->setEnabled(true); |
3718 | 3733 |
3719 // Select the first video track if a video track hasn't been selected yet. | 3734 // Select the first video track if a video track hasn't been selected yet. |
3720 if (videoTracks().length() > 0 && videoTracks().selectedIndex() == -1) | 3735 if (videoTracks().length() > 0 && videoTracks().selectedIndex() == -1) |
3721 videoTracks().anonymousIndexedGetter(0)->setSelected(true); | 3736 videoTracks().anonymousIndexedGetter(0)->setSelected(true); |
3722 } | 3737 } |
3723 | 3738 |
3739 bool HTMLMediaElement::isUserGestureRequiredForPlay() const | |
3740 { | |
3741 return m_userGestureRequiredForPlay; | |
3742 } | |
3743 | |
3744 void HTMLMediaElement::removeUserGestureRequirement() | |
3745 { | |
3746 m_userGestureRequiredForPlay = false; | |
3747 } | |
3748 | |
3749 void HTMLMediaElement::setInitialPlayWithoutUserGestures(bool value) | |
3750 { | |
3751 m_initialPlayWithoutUserGestures = value; | |
philipj_slow
2015/08/13 11:12:48
You didn't add m_initialPlayWithoutUserGestures, b
liberato (no reviews please)
2015/09/01 06:54:20
Done.
| |
3752 } | |
3753 | |
3724 #if ENABLE(WEB_AUDIO) | 3754 #if ENABLE(WEB_AUDIO) |
3725 void HTMLMediaElement::clearWeakMembers(Visitor* visitor) | 3755 void HTMLMediaElement::clearWeakMembers(Visitor* visitor) |
3726 { | 3756 { |
3727 if (!Heap::isHeapObjectAlive(m_audioSourceNode)) | 3757 if (!Heap::isHeapObjectAlive(m_audioSourceNode)) |
3728 audioSourceProvider().setClient(nullptr); | 3758 audioSourceProvider().setClient(nullptr); |
3729 } | 3759 } |
3730 | 3760 |
3731 void HTMLMediaElement::AudioSourceProviderImpl::wrap(WebAudioSourceProvider* pro vider) | 3761 void HTMLMediaElement::AudioSourceProviderImpl::wrap(WebAudioSourceProvider* pro vider) |
3732 { | 3762 { |
3733 MutexLocker locker(provideInputLock); | 3763 MutexLocker locker(provideInputLock); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3783 visitor->trace(m_client); | 3813 visitor->trace(m_client); |
3784 } | 3814 } |
3785 | 3815 |
3786 DEFINE_TRACE(HTMLMediaElement::AudioSourceProviderImpl) | 3816 DEFINE_TRACE(HTMLMediaElement::AudioSourceProviderImpl) |
3787 { | 3817 { |
3788 visitor->trace(m_client); | 3818 visitor->trace(m_client); |
3789 } | 3819 } |
3790 #endif | 3820 #endif |
3791 | 3821 |
3792 } | 3822 } |
OLD | NEW |