Index: Source/core/html/HTMLMediaElement.cpp |
diff --git a/Source/core/html/HTMLMediaElement.cpp b/Source/core/html/HTMLMediaElement.cpp |
index 91ef6708e6f5e78594ef9b36ad751aec9955cc39..9c001f5f1ccb05d5aecf15b6d685fd7ed57d5885 100644 |
--- a/Source/core/html/HTMLMediaElement.cpp |
+++ b/Source/core/html/HTMLMediaElement.cpp |
@@ -324,6 +324,7 @@ HTMLMediaElement::HTMLMediaElement(const QualifiedName& tagName, Document& docum |
, m_duration(std::numeric_limits<double>::quiet_NaN()) |
, m_lastTimeUpdateEventWallTime(0) |
, m_lastTimeUpdateEventMovieTime(std::numeric_limits<double>::max()) |
+ , m_defaultPlaybackStartPosition(0) |
, m_loadState(WaitingForSource) |
, m_deferredLoadState(NotDeferred) |
, m_deferredLoadTimer(this, &HTMLMediaElement::deferredLoadTimerFired) |
@@ -1822,6 +1823,12 @@ void HTMLMediaElement::setReadyState(ReadyState state) |
if (isHTMLVideoElement()) |
scheduleEvent(EventTypeNames::resize); |
scheduleEvent(EventTypeNames::loadedmetadata); |
+ |
+ if (m_defaultPlaybackStartPosition > 0) { |
+ seek(m_defaultPlaybackStartPosition); |
+ m_defaultPlaybackStartPosition = 0; |
+ } |
+ |
if (hasMediaControls()) |
mediaControls()->reset(); |
if (renderer()) |
@@ -1922,18 +1929,12 @@ void HTMLMediaElement::prepareToPlay() |
startDeferredLoad(); |
} |
-void HTMLMediaElement::seek(double time, ExceptionState& exceptionState) |
+void HTMLMediaElement::seek(double time) |
{ |
WTF_LOG(Media, "HTMLMediaElement::seek(%f)", time); |
// 4.8.10.9 Seeking |
amogh.bihani
2014/09/08 10:26:38
While working on media fragments URI it came out t
philipj_slow
2014/09/08 15:00:58
It sounds like the problem is that setting MediaCo
amogh.bihani
2014/09/09 05:30:52
Yes applyMediaFragmentURI seeks only the correspon
philipj_slow
2014/09/09 08:39:37
I think the root problem is that, regardless of me
|
- // 1 - If the media element's readyState is HAVE_NOTHING, then raise an InvalidStateError exception. |
- if (m_readyState == HAVE_NOTHING) { |
- exceptionState.throwDOMException(InvalidStateError, "The element's readyState is HAVE_NOTHING."); |
- return; |
- } |
- |
// If the media engine has been told to postpone loading data, let it go ahead now. |
if (m_preload < MediaPlayer::Auto && m_readyState < HAVE_FUTURE_DATA) |
prepareToPlay(); |
@@ -1979,7 +1980,7 @@ void HTMLMediaElement::seek(double time, ExceptionState& exceptionState) |
// Short circuit seeking to the current time by just firing the events if no seek is required. |
// Don't skip calling the media engine if we are in poster mode because a seek should always |
// cancel poster display. |
- bool noSeekRequired = !seekableRanges->length() || (time == now && displayMode() != Poster); |
+ bool noSeekRequired = !seekableRanges->length() || (time == now && !m_defaultPlaybackStartPosition && displayMode() != Poster); |
amogh.bihani
2014/09/04 13:44:06
Because of line 1944 we get time == now and hence
philipj_slow
2014/09/04 13:53:40
Ah, right, this is a bit tricky now. The spec has
amogh.bihani
2014/09/08 10:26:38
Should I add a TODO here that this condition shoul
philipj_slow
2014/09/08 15:00:58
If you want to work on official playback position
amogh.bihani
2014/09/09 05:30:52
Acknowledged.
|
if (noSeekRequired) { |
if (time == now) { |
@@ -2074,6 +2075,9 @@ double HTMLMediaElement::currentTime() const |
static const double minCachedDeltaForWarning = 0.01; |
#endif |
+ if (m_defaultPlaybackStartPosition) |
+ return m_defaultPlaybackStartPosition; |
+ |
if (m_readyState == HAVE_NOTHING) |
return 0; |
@@ -2102,7 +2106,15 @@ void HTMLMediaElement::setCurrentTime(double time, ExceptionState& exceptionStat |
exceptionState.throwDOMException(InvalidStateError, "The element is slaved to a MediaController."); |
return; |
} |
- seek(time, exceptionState); |
+ |
+ // If the media element's readyState is HAVE_NOTHING, then set the default |
+ // playback start position to that time. |
+ if (m_readyState == HAVE_NOTHING) { |
+ m_defaultPlaybackStartPosition = time; |
+ return; |
+ } |
+ |
+ seek(time); |
} |
double HTMLMediaElement::duration() const |
@@ -2241,7 +2253,7 @@ void HTMLMediaElement::playInternal() |
scheduleDelayedAction(LoadMediaResource); |
if (endedPlayback()) |
- seek(0, IGNORE_EXCEPTION); |
+ seek(0); |
if (m_mediaController) |
m_mediaController->bringElementUpToSpeed(this); |
@@ -3103,7 +3115,7 @@ void HTMLMediaElement::mediaPlayerTimeChanged() |
if (loop() && !m_mediaController) { |
m_sentEndEvent = false; |
// then seek to the earliest possible position of the media resource and abort these steps. |
- seek(0, IGNORE_EXCEPTION); |
+ seek(0); |
} else { |
// If the media element does not have a current media controller, and the media element |
// has still ended playback, and the direction of playback is still forwards, and paused |
@@ -3157,7 +3169,7 @@ void HTMLMediaElement::durationChanged(double duration, bool requestSeek) |
renderer()->updateFromElement(); |
if (requestSeek) |
- seek(duration, IGNORE_EXCEPTION); |
+ seek(duration); |
} |
void HTMLMediaElement::mediaPlayerPlaybackStateChanged() |
@@ -3188,10 +3200,10 @@ void HTMLMediaElement::mediaPlayerRequestSeek(double time) |
{ |
// The player is the source of this seek request. |
if (m_mediaController) { |
- m_mediaController->setCurrentTime(time, IGNORE_EXCEPTION); |
+ m_mediaController->setCurrentTime(time); |
return; |
} |
- setCurrentTime(time, IGNORE_EXCEPTION); |
+ setCurrentTime(time, ASSERT_NO_EXCEPTION); |
} |
// MediaPlayerPresentation methods |
@@ -3889,7 +3901,7 @@ void HTMLMediaElement::applyMediaFragmentURI() |
if (m_fragmentStartTime != MediaPlayer::invalidTime()) { |
m_sentEndEvent = false; |
UseCounter::count(document(), UseCounter::HTMLMediaElementSeekToFragmentStart); |
- seek(m_fragmentStartTime, IGNORE_EXCEPTION); |
+ seek(m_fragmentStartTime); |
} |
} |