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

Unified Diff: Source/core/html/HTMLMediaElement.cpp

Issue 298093004: Eliminate MediaPlayer & MediaPlayerClient abstractions(play/pause, other APIs) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/html/HTMLMediaElement.cpp
diff --git a/Source/core/html/HTMLMediaElement.cpp b/Source/core/html/HTMLMediaElement.cpp
index 0a8cab5474df71b56555b93d3a1b7a185cae76d1..cd7f1b28cf8a55d0f2bc0265cca67fe5171a7965 100644
--- a/Source/core/html/HTMLMediaElement.cpp
+++ b/Source/core/html/HTMLMediaElement.cpp
@@ -1724,7 +1724,7 @@ void HTMLMediaElement::addPlayedRange(double start, double end)
bool HTMLMediaElement::supportsSave() const
{
- return m_player ? m_player->supportsSave() : false;
+ return webMediaPlayer() && webMediaPlayer()->supportsSave();
}
void HTMLMediaElement::prepareToPlay()
@@ -1781,11 +1781,12 @@ void HTMLMediaElement::seek(double time, ExceptionState& exceptionState)
// not generate a timechanged callback. This means m_seeking will never be cleared and we will never
// fire a 'seeked' event.
#if !LOG_DISABLED
- double mediaTime = m_player->mediaTimeForTimeValue(time);
+ double mediaTime = webMediaPlayer() ? webMediaPlayer()->mediaTimeForTimeValue(time) : time;
philipj_slow 2014/05/27 20:54:56 This ends up looking a bit weird given the followi
if (time != mediaTime)
WTF_LOG(Media, "HTMLMediaElement::seek(%f) - media timeline equivalent is %f", time, mediaTime);
#endif
- time = m_player->mediaTimeForTimeValue(time);
+ if (webMediaPlayer())
+ time = webMediaPlayer()->mediaTimeForTimeValue(time);
// 7 - If the (possibly now changed) new playback position is not in one of the ranges given in the
// seekable attribute, then let it be the position in one of the ranges given in the seekable attribute
@@ -2835,7 +2836,7 @@ void HTMLMediaElement::mediaPlayerPlaybackStateChanged()
if (!m_player || m_pausedInternal)
return;
- if (m_player->paused())
+ if (webMediaPlayer() && webMediaPlayer()->paused())
pause();
else
playInternal();
@@ -3007,8 +3008,8 @@ void HTMLMediaElement::updatePlayState()
return;
if (m_pausedInternal) {
- if (!m_player->paused())
- m_player->pause();
+ if (webMediaPlayer() && !webMediaPlayer()->paused())
+ webMediaPlayer()->pause();
refreshCachedTime();
m_playbackProgressTimer.stop();
if (hasMediaControls())
@@ -3017,7 +3018,7 @@ void HTMLMediaElement::updatePlayState()
}
bool shouldBePlaying = potentiallyPlaying();
- bool playerPaused = m_player->paused();
+ bool playerPaused = webMediaPlayer() && webMediaPlayer()->paused();
WTF_LOG(Media, "HTMLMediaElement::updatePlayState - shouldBePlaying = %s, playerPaused = %s",
boolString(shouldBePlaying), boolString(playerPaused));
@@ -3032,7 +3033,8 @@ void HTMLMediaElement::updatePlayState()
m_player->setRate(m_playbackRate);
updateVolume();
- m_player->play();
+ if (webMediaPlayer())
+ webMediaPlayer()->play();
}
if (hasMediaControls())
@@ -3041,8 +3043,8 @@ void HTMLMediaElement::updatePlayState()
m_playing = true;
} else { // Should not be playing right now
- if (!playerPaused)
- m_player->pause();
+ if (!playerPaused && webMediaPlayer())
+ webMediaPlayer()->pause();
refreshCachedTime();
m_playbackProgressTimer.stop();

Powered by Google App Engine
This is Rietveld 408576698