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

Side by Side Diff: Source/core/html/HTMLMediaElement.cpp

Issue 517593003: Allow HTMLMediaElement.currentTime to be set before the transition to HAVE_METADATA (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fast-Forward to origin/master and rebase Created 6 years, 3 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
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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 , m_defaultPlaybackRate(1.0f) 317 , m_defaultPlaybackRate(1.0f)
318 , m_networkState(NETWORK_EMPTY) 318 , m_networkState(NETWORK_EMPTY)
319 , m_readyState(HAVE_NOTHING) 319 , m_readyState(HAVE_NOTHING)
320 , m_readyStateMaximum(HAVE_NOTHING) 320 , m_readyStateMaximum(HAVE_NOTHING)
321 , m_volume(1.0f) 321 , m_volume(1.0f)
322 , m_lastSeekTime(0) 322 , m_lastSeekTime(0)
323 , m_previousProgressTime(std::numeric_limits<double>::max()) 323 , m_previousProgressTime(std::numeric_limits<double>::max())
324 , m_duration(std::numeric_limits<double>::quiet_NaN()) 324 , m_duration(std::numeric_limits<double>::quiet_NaN())
325 , m_lastTimeUpdateEventWallTime(0) 325 , m_lastTimeUpdateEventWallTime(0)
326 , m_lastTimeUpdateEventMovieTime(std::numeric_limits<double>::max()) 326 , m_lastTimeUpdateEventMovieTime(std::numeric_limits<double>::max())
327 , m_defaultPlaybackStartPosition(0)
327 , m_loadState(WaitingForSource) 328 , m_loadState(WaitingForSource)
328 , m_deferredLoadState(NotDeferred) 329 , m_deferredLoadState(NotDeferred)
329 , m_deferredLoadTimer(this, &HTMLMediaElement::deferredLoadTimerFired) 330 , m_deferredLoadTimer(this, &HTMLMediaElement::deferredLoadTimerFired)
330 , m_webLayer(0) 331 , m_webLayer(0)
331 , m_preload(MediaPlayer::Auto) 332 , m_preload(MediaPlayer::Auto)
332 , m_displayMode(Unknown) 333 , m_displayMode(Unknown)
333 , m_cachedTime(MediaPlayer::invalidTime()) 334 , m_cachedTime(MediaPlayer::invalidTime())
334 , m_fragmentStartTime(MediaPlayer::invalidTime()) 335 , m_fragmentStartTime(MediaPlayer::invalidTime())
335 , m_fragmentEndTime(MediaPlayer::invalidTime()) 336 , m_fragmentEndTime(MediaPlayer::invalidTime())
336 , m_pendingActionFlags(0) 337 , m_pendingActionFlags(0)
(...skipping 1473 matching lines...) Expand 10 before | Expand all | Expand 10 after
1810 prepareMediaFragmentURI(); 1811 prepareMediaFragmentURI();
1811 1812
1812 selectInitialTracksIfNecessary(); 1813 selectInitialTracksIfNecessary();
1813 1814
1814 m_duration = duration(); 1815 m_duration = duration();
1815 scheduleEvent(EventTypeNames::durationchange); 1816 scheduleEvent(EventTypeNames::durationchange);
1816 1817
1817 if (isHTMLVideoElement()) 1818 if (isHTMLVideoElement())
1818 scheduleEvent(EventTypeNames::resize); 1819 scheduleEvent(EventTypeNames::resize);
1819 scheduleEvent(EventTypeNames::loadedmetadata); 1820 scheduleEvent(EventTypeNames::loadedmetadata);
1821
1822 if (m_defaultPlaybackStartPosition > 0) {
1823 seek(m_defaultPlaybackStartPosition);
1824 m_defaultPlaybackStartPosition = 0;
philipj_slow 2014/09/10 09:57:05 Either move this out of the if clause, like the sp
amogh.bihani 2014/09/10 11:18:33 Done.
1825 }
1826
1820 if (hasMediaControls()) 1827 if (hasMediaControls())
1821 mediaControls()->reset(); 1828 mediaControls()->reset();
1822 if (renderer()) 1829 if (renderer())
1823 renderer()->updateFromElement(); 1830 renderer()->updateFromElement();
1824 } 1831 }
1825 1832
1826 bool shouldUpdateDisplayState = false; 1833 bool shouldUpdateDisplayState = false;
1827 1834
1828 if (m_readyState >= HAVE_CURRENT_DATA && oldState < HAVE_CURRENT_DATA && !m_ haveFiredLoadedData) { 1835 if (m_readyState >= HAVE_CURRENT_DATA && oldState < HAVE_CURRENT_DATA && !m_ haveFiredLoadedData) {
1829 m_haveFiredLoadedData = true; 1836 m_haveFiredLoadedData = true;
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
1910 { 1917 {
1911 WTF_LOG(Media, "HTMLMediaElement::prepareToPlay(%p)", this); 1918 WTF_LOG(Media, "HTMLMediaElement::prepareToPlay(%p)", this);
1912 if (m_havePreparedToPlay) 1919 if (m_havePreparedToPlay)
1913 return; 1920 return;
1914 m_havePreparedToPlay = true; 1921 m_havePreparedToPlay = true;
1915 1922
1916 if (loadIsDeferred()) 1923 if (loadIsDeferred())
1917 startDeferredLoad(); 1924 startDeferredLoad();
1918 } 1925 }
1919 1926
1920 void HTMLMediaElement::seek(double time, ExceptionState& exceptionState) 1927 void HTMLMediaElement::seek(double time)
1921 { 1928 {
1922 WTF_LOG(Media, "HTMLMediaElement::seek(%p, %f)", this, time); 1929 WTF_LOG(Media, "HTMLMediaElement::seek(%p, %f)", this, time);
1923 1930
1924 // 4.8.10.9 Seeking 1931 // 4.7.14.9 Seeking
philipj_slow 2014/09/10 09:57:05 Now it's "4.8.14.9 Seeking" in the spec. The secti
amogh.bihani 2014/09/10 11:18:33 Done.
1925 1932
1926 // 1 - If the media element's readyState is HAVE_NOTHING, then raise an Inva lidStateError exception. 1933 // 2 - If the media element's readyState is HAVE_NOTHING, abort these steps.
1927 if (m_readyState == HAVE_NOTHING) { 1934 if (m_readyState == HAVE_NOTHING)
1928 exceptionState.throwDOMException(InvalidStateError, "The element's ready State is HAVE_NOTHING.");
1929 return; 1935 return;
1930 }
1931 1936
1932 // If the media engine has been told to postpone loading data, let it go ahe ad now. 1937 // If the media engine has been told to postpone loading data, let it go ahe ad now.
1933 if (m_preload < MediaPlayer::Auto && m_readyState < HAVE_FUTURE_DATA) 1938 if (m_preload < MediaPlayer::Auto && m_readyState < HAVE_FUTURE_DATA)
1934 prepareToPlay(); 1939 prepareToPlay();
1935 1940
1936 // Get the current time before setting m_seeking, m_lastSeekTime is returned once it is set. 1941 // Get the current time before setting m_seeking, m_lastSeekTime is returned once it is set.
1937 refreshCachedTime(); 1942 refreshCachedTime();
1938 double now = currentTime(); 1943 // This is needed to avoid getting default playback start position from curr entTime().
1944 double now = m_cachedTime;
1939 1945
1940 // 2 - If the element's seeking IDL attribute is true, then another instance of this algorithm is 1946 // 3 - If the element's seeking IDL attribute is true, then another instance of this algorithm is
1941 // already running. Abort that other instance of the algorithm without waiti ng for the step that 1947 // already running. Abort that other instance of the algorithm without waiti ng for the step that
1942 // it is running to complete. 1948 // it is running to complete.
1943 // Nothing specific to be done here. 1949 // Nothing specific to be done here.
1944 1950
1945 // 3 - Set the seeking IDL attribute to true. 1951 // 4 - Set the seeking IDL attribute to true.
1946 // The flag will be cleared when the engine tells us the time has actually c hanged. 1952 // The flag will be cleared when the engine tells us the time has actually c hanged.
1947 bool previousSeekStillPending = m_seeking; 1953 bool previousSeekStillPending = m_seeking;
1948 m_seeking = true; 1954 m_seeking = true;
1949 1955
1950 // 5 - If the new playback position is later than the end of the media resou rce, then let it be the end 1956 // 6 - If the new playback position is later than the end of the media resou rce, then let it be the end
1951 // of the media resource instead. 1957 // of the media resource instead.
1952 time = std::min(time, duration()); 1958 time = std::min(time, duration());
1953 1959
1954 // 6 - If the new playback position is less than the earliest possible posit ion, let it be that position instead. 1960 // 7 - If the new playback position is less than the earliest possible posit ion, let it be that position instead.
1955 time = std::max(time, 0.0); 1961 time = std::max(time, 0.0);
1956 1962
1957 // Ask the media engine for the time value in the movie's time scale before comparing with current time. This 1963 // Ask the media engine for the time value in the movie's time scale before comparing with current time. This
1958 // is necessary because if the seek time is not equal to currentTime but the delta is less than the movie's 1964 // is necessary because if the seek time is not equal to currentTime but the delta is less than the movie's
1959 // time scale, we will ask the media engine to "seek" to the current movie t ime, which may be a noop and 1965 // time scale, we will ask the media engine to "seek" to the current movie t ime, which may be a noop and
1960 // not generate a timechanged callback. This means m_seeking will never be c leared and we will never 1966 // not generate a timechanged callback. This means m_seeking will never be c leared and we will never
1961 // fire a 'seeked' event. 1967 // fire a 'seeked' event.
1962 double mediaTime = webMediaPlayer()->mediaTimeForTimeValue(time); 1968 double mediaTime = webMediaPlayer()->mediaTimeForTimeValue(time);
1963 if (time != mediaTime) { 1969 if (time != mediaTime) {
1964 WTF_LOG(Media, "HTMLMediaElement::seek(%p, %f) - media timeline equivale nt is %f", this, time, mediaTime); 1970 WTF_LOG(Media, "HTMLMediaElement::seek(%p, %f) - media timeline equivale nt is %f", this, time, mediaTime);
1965 time = mediaTime; 1971 time = mediaTime;
1966 } 1972 }
1967 1973
1968 // 7 - If the (possibly now changed) new playback position is not in one of the ranges given in the 1974 // 8 - If the (possibly now changed) new playback position is not in one of the ranges given in the
1969 // seekable attribute, then let it be the position in one of the ranges give n in the seekable attribute 1975 // seekable attribute, then let it be the position in one of the ranges give n in the seekable attribute
1970 // that is the nearest to the new playback position. ... If there are no ran ges given in the seekable 1976 // that is the nearest to the new playback position. ... If there are no ran ges given in the seekable
1971 // attribute then set the seeking IDL attribute to false and abort these ste ps. 1977 // attribute then set the seeking IDL attribute to false and abort these ste ps.
1972 RefPtrWillBeRawPtr<TimeRanges> seekableRanges = seekable(); 1978 RefPtrWillBeRawPtr<TimeRanges> seekableRanges = seekable();
1973 1979
1974 // Short circuit seeking to the current time by just firing the events if no seek is required. 1980 // Short circuit seeking to the current time by just firing the events if no seek is required.
1975 // Don't skip calling the media engine if we are in poster mode because a se ek should always 1981 // Don't skip calling the media engine if we are in poster mode because a se ek should always
1976 // cancel poster display. 1982 // cancel poster display.
1977 bool noSeekRequired = !seekableRanges->length() || (time == now && displayMo de() != Poster); 1983 bool noSeekRequired = !seekableRanges->length() || (time == now && displayMo de() != Poster);
1978 1984
(...skipping 12 matching lines...) Expand all
1991 } 1997 }
1992 time = seekableRanges->nearest(time); 1998 time = seekableRanges->nearest(time);
1993 1999
1994 if (m_playing) { 2000 if (m_playing) {
1995 if (m_lastSeekTime < now) 2001 if (m_lastSeekTime < now)
1996 addPlayedRange(m_lastSeekTime, now); 2002 addPlayedRange(m_lastSeekTime, now);
1997 } 2003 }
1998 m_lastSeekTime = time; 2004 m_lastSeekTime = time;
1999 m_sentEndEvent = false; 2005 m_sentEndEvent = false;
2000 2006
2001 // 8 - Queue a task to fire a simple event named seeking at the element. 2007 // 10 - Queue a task to fire a simple event named seeking at the element.
2002 scheduleEvent(EventTypeNames::seeking); 2008 scheduleEvent(EventTypeNames::seeking);
2003 2009
2004 // 9 - Set the current playback position to the given new playback position 2010 // 11 - Set the current playback position to the given new playback position
philipj_slow 2014/09/10 09:57:06 Can you add the missing period here?
amogh.bihani 2014/09/10 11:18:33 Done.
2005 webMediaPlayer()->seek(time); 2011 webMediaPlayer()->seek(time);
2006 2012
2007 // 10-14 are handled, if necessary, when the engine signals a readystate cha nge or otherwise 2013 // 12-17 are handled, if necessary, when the engine signals a readystate cha nge or otherwise
philipj_slow 2014/09/10 09:57:06 It's step 14-17 that's handled in finishSeek(). Ca
amogh.bihani 2014/09/10 11:18:33 Done.
2008 // satisfies seek completion and signals a time change. 2014 // satisfies seek completion and signals a time change.
2009 } 2015 }
2010 2016
2011 void HTMLMediaElement::finishSeek() 2017 void HTMLMediaElement::finishSeek()
2012 { 2018 {
2013 WTF_LOG(Media, "HTMLMediaElement::finishSeek(%p)", this); 2019 WTF_LOG(Media, "HTMLMediaElement::finishSeek(%p)", this);
2014 2020
2015 // 4.8.10.9 Seeking completion 2021 // 4.8.10.9 Seeking completion
2016 // 12 - Set the seeking IDL attribute to false. 2022 // 12 - Set the seeking IDL attribute to false.
2017 m_seeking = false; 2023 m_seeking = false;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
2050 2056
2051 void HTMLMediaElement::invalidateCachedTime() 2057 void HTMLMediaElement::invalidateCachedTime()
2052 { 2058 {
2053 WTF_LOG(Media, "HTMLMediaElement::invalidateCachedTime(%p)", this); 2059 WTF_LOG(Media, "HTMLMediaElement::invalidateCachedTime(%p)", this);
2054 m_cachedTime = MediaPlayer::invalidTime(); 2060 m_cachedTime = MediaPlayer::invalidTime();
2055 } 2061 }
2056 2062
2057 // playback state 2063 // playback state
2058 double HTMLMediaElement::currentTime() const 2064 double HTMLMediaElement::currentTime() const
2059 { 2065 {
2066 if (m_defaultPlaybackStartPosition)
2067 return m_defaultPlaybackStartPosition;
2068
2060 if (m_readyState == HAVE_NOTHING) 2069 if (m_readyState == HAVE_NOTHING)
2061 return 0; 2070 return 0;
2062 2071
2063 if (m_seeking) { 2072 if (m_seeking) {
2064 WTF_LOG(Media, "HTMLMediaElement::currentTime(%p) - seeking, returning % f", this, m_lastSeekTime); 2073 WTF_LOG(Media, "HTMLMediaElement::currentTime(%p) - seeking, returning % f", this, m_lastSeekTime);
2065 return m_lastSeekTime; 2074 return m_lastSeekTime;
2066 } 2075 }
2067 2076
2068 if (m_cachedTime != MediaPlayer::invalidTime() && m_paused) { 2077 if (m_cachedTime != MediaPlayer::invalidTime() && m_paused) {
2069 #if LOG_CACHED_TIME_WARNINGS 2078 #if LOG_CACHED_TIME_WARNINGS
2070 static const double minCachedDeltaForWarning = 0.01; 2079 static const double minCachedDeltaForWarning = 0.01;
2071 double delta = m_cachedTime - webMediaPlayer()->currentTime(); 2080 double delta = m_cachedTime - webMediaPlayer()->currentTime();
2072 if (delta > minCachedDeltaForWarning) 2081 if (delta > minCachedDeltaForWarning)
2073 WTF_LOG(Media, "HTMLMediaElement::currentTime(%p) - WARNING, cached time is %f seconds off of media time when paused", this, delta); 2082 WTF_LOG(Media, "HTMLMediaElement::currentTime(%p) - WARNING, cached time is %f seconds off of media time when paused", this, delta);
2074 #endif 2083 #endif
2075 return m_cachedTime; 2084 return m_cachedTime;
2076 } 2085 }
2077 2086
2078 refreshCachedTime(); 2087 refreshCachedTime();
2079 2088
2080 return m_cachedTime; 2089 return m_cachedTime;
2081 } 2090 }
2082 2091
2083 void HTMLMediaElement::setCurrentTime(double time, ExceptionState& exceptionStat e) 2092 void HTMLMediaElement::setCurrentTime(double time, ExceptionState& exceptionStat e)
2084 { 2093 {
2085 if (m_mediaController) { 2094 if (m_mediaController) {
2086 exceptionState.throwDOMException(InvalidStateError, "The element is slav ed to a MediaController."); 2095 exceptionState.throwDOMException(InvalidStateError, "The element is slav ed to a MediaController.");
2087 return; 2096 return;
2088 } 2097 }
2089 seek(time, exceptionState); 2098
2099 // If the media element's readyState is HAVE_NOTHING, then set the default
2100 // playback start position to that time.
2101 if (m_readyState == HAVE_NOTHING) {
2102 m_defaultPlaybackStartPosition = time;
2103 return;
2104 }
2105
2106 seek(time);
2090 } 2107 }
2091 2108
2092 double HTMLMediaElement::duration() const 2109 double HTMLMediaElement::duration() const
2093 { 2110 {
2094 // FIXME: remove m_player check once we figure out how m_player is going 2111 // FIXME: remove m_player check once we figure out how m_player is going
2095 // out of sync with readystate. m_player is cleared but readystate is not se t 2112 // out of sync with readystate. m_player is cleared but readystate is not se t
2096 // to HAVE_NOTHING 2113 // to HAVE_NOTHING
2097 if (!m_player || m_readyState < HAVE_METADATA) 2114 if (!m_player || m_readyState < HAVE_METADATA)
2098 return std::numeric_limits<double>::quiet_NaN(); 2115 return std::numeric_limits<double>::quiet_NaN();
2099 2116
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
2218 2235
2219 void HTMLMediaElement::playInternal() 2236 void HTMLMediaElement::playInternal()
2220 { 2237 {
2221 WTF_LOG(Media, "HTMLMediaElement::playInternal(%p)", this); 2238 WTF_LOG(Media, "HTMLMediaElement::playInternal(%p)", this);
2222 2239
2223 // 4.8.10.9. Playing the media resource 2240 // 4.8.10.9. Playing the media resource
2224 if (!m_player || m_networkState == NETWORK_EMPTY) 2241 if (!m_player || m_networkState == NETWORK_EMPTY)
2225 scheduleDelayedAction(LoadMediaResource); 2242 scheduleDelayedAction(LoadMediaResource);
2226 2243
2227 if (endedPlayback()) 2244 if (endedPlayback())
2228 seek(0, IGNORE_EXCEPTION); 2245 seek(0);
2229 2246
2230 if (m_mediaController) 2247 if (m_mediaController)
2231 m_mediaController->bringElementUpToSpeed(this); 2248 m_mediaController->bringElementUpToSpeed(this);
2232 2249
2233 if (m_paused) { 2250 if (m_paused) {
2234 m_paused = false; 2251 m_paused = false;
2235 invalidateCachedTime(); 2252 invalidateCachedTime();
2236 scheduleEvent(EventTypeNames::play); 2253 scheduleEvent(EventTypeNames::play);
2237 2254
2238 if (m_readyState <= HAVE_CURRENT_DATA) 2255 if (m_readyState <= HAVE_CURRENT_DATA)
(...skipping 837 matching lines...) Expand 10 before | Expand all | Expand 10 after
3076 double now = currentTime(); 3093 double now = currentTime();
3077 double dur = duration(); 3094 double dur = duration();
3078 3095
3079 // When the current playback position reaches the end of the media resource when the direction of 3096 // When the current playback position reaches the end of the media resource when the direction of
3080 // playback is forwards, then the user agent must follow these steps: 3097 // playback is forwards, then the user agent must follow these steps:
3081 if (!std::isnan(dur) && dur && now >= dur && directionOfPlayback() == Forwar d) { 3098 if (!std::isnan(dur) && dur && now >= dur && directionOfPlayback() == Forwar d) {
3082 // If the media element has a loop attribute specified and does not have a current media controller, 3099 // If the media element has a loop attribute specified and does not have a current media controller,
3083 if (loop() && !m_mediaController) { 3100 if (loop() && !m_mediaController) {
3084 m_sentEndEvent = false; 3101 m_sentEndEvent = false;
3085 // then seek to the earliest possible position of the media resourc e and abort these steps. 3102 // then seek to the earliest possible position of the media resourc e and abort these steps.
3086 seek(0, IGNORE_EXCEPTION); 3103 seek(0);
3087 } else { 3104 } else {
3088 // If the media element does not have a current media controller, an d the media element 3105 // If the media element does not have a current media controller, an d the media element
3089 // has still ended playback, and the direction of playback is still forwards, and paused 3106 // has still ended playback, and the direction of playback is still forwards, and paused
3090 // is false, 3107 // is false,
3091 if (!m_mediaController && !m_paused) { 3108 if (!m_mediaController && !m_paused) {
3092 // changes paused to true and fires a simple event named pause a t the media element. 3109 // changes paused to true and fires a simple event named pause a t the media element.
3093 m_paused = true; 3110 m_paused = true;
3094 scheduleEvent(EventTypeNames::pause); 3111 scheduleEvent(EventTypeNames::pause);
3095 } 3112 }
3096 // Queue a task to fire a simple event named ended at the media elem ent. 3113 // Queue a task to fire a simple event named ended at the media elem ent.
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
3130 WTF_LOG(Media, "HTMLMediaElement::durationChanged(%p) : %f -> %f", this, m_d uration, duration); 3147 WTF_LOG(Media, "HTMLMediaElement::durationChanged(%p) : %f -> %f", this, m_d uration, duration);
3131 m_duration = duration; 3148 m_duration = duration;
3132 scheduleEvent(EventTypeNames::durationchange); 3149 scheduleEvent(EventTypeNames::durationchange);
3133 3150
3134 if (hasMediaControls()) 3151 if (hasMediaControls())
3135 mediaControls()->reset(); 3152 mediaControls()->reset();
3136 if (renderer()) 3153 if (renderer())
3137 renderer()->updateFromElement(); 3154 renderer()->updateFromElement();
3138 3155
3139 if (requestSeek) 3156 if (requestSeek)
3140 seek(duration, IGNORE_EXCEPTION); 3157 seek(duration);
3141 } 3158 }
3142 3159
3143 void HTMLMediaElement::mediaPlayerPlaybackStateChanged() 3160 void HTMLMediaElement::mediaPlayerPlaybackStateChanged()
3144 { 3161 {
3145 WTF_LOG(Media, "HTMLMediaElement::mediaPlayerPlaybackStateChanged(%p)", this ); 3162 WTF_LOG(Media, "HTMLMediaElement::mediaPlayerPlaybackStateChanged(%p)", this );
3146 3163
3147 if (!m_player || m_pausedInternal) 3164 if (!m_player || m_pausedInternal)
3148 return; 3165 return;
3149 3166
3150 if (webMediaPlayer()->paused()) 3167 if (webMediaPlayer()->paused())
(...skipping 10 matching lines...) Expand all
3161 // user interaction or when it is technically required to play the video. 3178 // user interaction or when it is technically required to play the video.
3162 UserGestureIndicator gestureIndicator(DefinitelyProcessingNewUserGesture); 3179 UserGestureIndicator gestureIndicator(DefinitelyProcessingNewUserGesture);
3163 3180
3164 enterFullscreen(); 3181 enterFullscreen();
3165 } 3182 }
3166 3183
3167 void HTMLMediaElement::mediaPlayerRequestSeek(double time) 3184 void HTMLMediaElement::mediaPlayerRequestSeek(double time)
3168 { 3185 {
3169 // The player is the source of this seek request. 3186 // The player is the source of this seek request.
3170 if (m_mediaController) { 3187 if (m_mediaController) {
3171 m_mediaController->setCurrentTime(time, IGNORE_EXCEPTION); 3188 m_mediaController->setCurrentTime(time);
3172 return; 3189 return;
3173 } 3190 }
3174 setCurrentTime(time, IGNORE_EXCEPTION); 3191 setCurrentTime(time, ASSERT_NO_EXCEPTION);
3175 } 3192 }
3176 3193
3177 // MediaPlayerPresentation methods 3194 // MediaPlayerPresentation methods
3178 void HTMLMediaElement::mediaPlayerRepaint() 3195 void HTMLMediaElement::mediaPlayerRepaint()
3179 { 3196 {
3180 if (m_webLayer) 3197 if (m_webLayer)
3181 m_webLayer->invalidate(); 3198 m_webLayer->invalidate();
3182 3199
3183 updateDisplayState(); 3200 updateDisplayState();
3184 if (renderer()) 3201 if (renderer())
(...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after
3863 3880
3864 if (m_fragmentStartTime != MediaPlayer::invalidTime() && m_readyState < HAVE _FUTURE_DATA) 3881 if (m_fragmentStartTime != MediaPlayer::invalidTime() && m_readyState < HAVE _FUTURE_DATA)
3865 prepareToPlay(); 3882 prepareToPlay();
3866 } 3883 }
3867 3884
3868 void HTMLMediaElement::applyMediaFragmentURI() 3885 void HTMLMediaElement::applyMediaFragmentURI()
3869 { 3886 {
3870 if (m_fragmentStartTime != MediaPlayer::invalidTime()) { 3887 if (m_fragmentStartTime != MediaPlayer::invalidTime()) {
3871 m_sentEndEvent = false; 3888 m_sentEndEvent = false;
3872 UseCounter::count(document(), UseCounter::HTMLMediaElementSeekToFragment Start); 3889 UseCounter::count(document(), UseCounter::HTMLMediaElementSeekToFragment Start);
3873 seek(m_fragmentStartTime, IGNORE_EXCEPTION); 3890 seek(m_fragmentStartTime);
3874 } 3891 }
3875 } 3892 }
3876 3893
3877 WebMediaPlayer::CORSMode HTMLMediaElement::corsMode() const 3894 WebMediaPlayer::CORSMode HTMLMediaElement::corsMode() const
3878 { 3895 {
3879 const AtomicString& crossOriginMode = fastGetAttribute(crossoriginAttr); 3896 const AtomicString& crossOriginMode = fastGetAttribute(crossoriginAttr);
3880 if (crossOriginMode.isNull()) 3897 if (crossOriginMode.isNull())
3881 return WebMediaPlayer::CORSModeUnspecified; 3898 return WebMediaPlayer::CORSModeUnspecified;
3882 if (equalIgnoringCase(crossOriginMode, "use-credentials")) 3899 if (equalIgnoringCase(crossOriginMode, "use-credentials"))
3883 return WebMediaPlayer::CORSModeUseCredentials; 3900 return WebMediaPlayer::CORSModeUseCredentials;
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
3970 3987
3971 #if ENABLE(WEB_AUDIO) 3988 #if ENABLE(WEB_AUDIO)
3972 void HTMLMediaElement::clearWeakMembers(Visitor* visitor) 3989 void HTMLMediaElement::clearWeakMembers(Visitor* visitor)
3973 { 3990 {
3974 if (!visitor->isAlive(m_audioSourceNode) && audioSourceProvider()) 3991 if (!visitor->isAlive(m_audioSourceNode) && audioSourceProvider())
3975 audioSourceProvider()->setClient(0); 3992 audioSourceProvider()->setClient(0);
3976 } 3993 }
3977 #endif 3994 #endif
3978 3995
3979 } 3996 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698