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

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

Issue 23797004: Sets the media element network state to idle until playback is requested. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased 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 c3dbc5836888ad94ad85c13eab1deacfe696a66e..c3f97fc465b7c6ca7f28932c2992eef834875abd 100644
--- a/content/renderer/media/android/webmediaplayer_android.cc
+++ b/content/renderer/media/android/webmediaplayer_android.cc
@@ -83,6 +83,7 @@ WebMediaPlayerAndroid::WebMediaPlayerAndroid(
texture_mailbox_sync_point_(0),
stream_id_(0),
is_playing_(false),
+ playing_started_(false),
needs_establish_peer_(true),
stream_texture_proxy_initialized_(false),
has_size_info_(false),
@@ -300,6 +301,11 @@ void WebMediaPlayerAndroid::DidLoadMediaInfo(
UpdateReadyState(WebMediaPlayer::ReadyStateHaveMetadata);
UpdateReadyState(WebMediaPlayer::ReadyStateHaveEnoughData);
}
+ // Android doesn't start fetching resources until an implementation-defined
+ // event (e.g. playback request) occurs. Sets the network state to IDLE
+ // if play is not requested yet.
+ if (!playing_started_)
+ UpdateNetworkState(WebMediaPlayer::NetworkStateIdle);
}
void WebMediaPlayerAndroid::play() {
@@ -318,6 +324,8 @@ void WebMediaPlayerAndroid::play() {
if (paused())
proxy_->Start(player_id_);
UpdatePlayingState(true);
+ UpdateNetworkState(WebMediaPlayer::NetworkStateLoading);
+ playing_started_ = true;
}
void WebMediaPlayerAndroid::pause() {
« 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