Sets the media element network state to idle until playback is requested.

This is the expected behavior if the user agent intends to not attempt to fetch
the resource until the user requests it explicitly.

Review URL: https://codereview.chromium.org/23797004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@226440 0039d316-1c4b-4281-b951-d872f2087c98
parent 6c2063e1
......@@ -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() {
......
......@@ -348,6 +348,9 @@ class WebMediaPlayerAndroid
// Whether the mediaplayer is playing.
bool is_playing_;
// Wether the mediaplayer has already started playing.
bool playing_started_;
// Whether media player needs to re-establish the surface texture peer.
bool needs_establish_peer_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment