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

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

Powered by Google App Engine
This is Rietveld 408576698