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

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: fixed review comments 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
« no previous file with comments | « Source/core/html/HTMLMediaElement.h ('k') | Source/platform/graphics/media/MediaPlayer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLMediaElement.cpp
diff --git a/Source/core/html/HTMLMediaElement.cpp b/Source/core/html/HTMLMediaElement.cpp
index 42f201be24c22d76ea68cd36081d7fbe823fab14..c178b28befaa4f01bb01358c51a60195960c8b8a 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()
@@ -1780,12 +1780,13 @@ void HTMLMediaElement::seek(double time, ExceptionState& exceptionState)
// time scale, we will ask the media engine to "seek" to the current movie time, which may be a noop and
// not generate a timechanged callback. This means m_seeking will never be cleared and we will never
// fire a 'seeked' event.
+ double mediaTime = webMediaPlayer()->mediaTimeForTimeValue(time);
+ if (time != mediaTime) {
#if !LOG_DISABLED
- double mediaTime = m_player->mediaTimeForTimeValue(time);
- if (time != mediaTime)
WTF_LOG(Media, "HTMLMediaElement::seek(%f) - media timeline equivalent is %f", time, mediaTime);
#endif
- time = m_player->mediaTimeForTimeValue(time);
+ time = mediaTime;
+ }
// 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
@@ -2830,7 +2831,7 @@ void HTMLMediaElement::mediaPlayerPlaybackStateChanged()
if (!m_player || m_pausedInternal)
return;
- if (m_player->paused())
+ if (webMediaPlayer()->paused())
pause();
else
playInternal();
@@ -3002,8 +3003,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())
@@ -3012,7 +3013,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));
@@ -3026,8 +3027,7 @@ void HTMLMediaElement::updatePlayState()
// The media engine should just stash the rate and muted values since it isn't already playing.
m_player->setRate(m_playbackRate);
updateVolume();
-
- m_player->play();
+ webMediaPlayer()->play();
}
if (hasMediaControls())
@@ -3036,8 +3036,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();
« no previous file with comments | « Source/core/html/HTMLMediaElement.h ('k') | Source/platform/graphics/media/MediaPlayer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698