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

Unified Diff: content/renderer/media/android/webmediaplayer_android.cc

Issue 23442021: Add loop implementation for HTML5 Video on Android (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/media/android/webmediaplayer_android.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/media/android/webmediaplayer_android.cc
diff --git a/content/renderer/media/android/webmediaplayer_android.cc b/content/renderer/media/android/webmediaplayer_android.cc
index 5d7769a455490c3c7a302398365645b192ca72d4..22abbade2bcdcd31ceb5b601496923660c435c85 100644
--- a/content/renderer/media/android/webmediaplayer_android.cc
+++ b/content/renderer/media/android/webmediaplayer_android.cc
@@ -97,6 +97,7 @@ WebMediaPlayerAndroid::WebMediaPlayerAndroid(
demuxer_(NULL),
media_stream_client_(NULL),
#endif // defined(GOOGLE_TV)
+ pending_playback_(false),
player_type_(MEDIA_PLAYER_TYPE_URL),
proxy_(proxy),
current_time_(0),
@@ -587,6 +588,15 @@ void WebMediaPlayerAndroid::OnPlaybackComplete() {
// current time to media duration when OnPlaybackComplete() get called.
OnTimeUpdate(duration_);
client_->timeChanged();
+
+ // if the loop attribute is set, timeChanged() will update the current time
+ // to 0. It will perform a seek to 0. As the requests to the renderer
+ // process are sequential, the OnSeekCompelete() will only occur
+ // once OnPlaybackComplete() is done. As the playback can only be executed
+ // upon completion of OnSeekComplete(), the request needs to be saved.
+ is_playing_ = false;
+ if (seeking_ && pending_seek_ == 0)
+ pending_playback_ = true;
}
void WebMediaPlayerAndroid::OnBufferingUpdate(int percentage) {
@@ -602,6 +612,11 @@ void WebMediaPlayerAndroid::OnSeekComplete(base::TimeDelta current_time) {
UpdateReadyState(WebMediaPlayer::ReadyStateHaveEnoughData);
client_->timeChanged();
+
+ if (pending_playback_) {
+ play();
+ pending_playback_ = false;
+ }
}
void WebMediaPlayerAndroid::OnMediaError(int error_type) {
« no previous file with comments | « content/renderer/media/android/webmediaplayer_android.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698