diff options
author | qinmin@chromium.org <qinmin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-02 06:36:31 +0000 |
---|---|---|
committer | qinmin@chromium.org <qinmin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-02 06:36:31 +0000 |
commit | adcff2dfcc7d4916ccc322aa53d35098b66c026a (patch) | |
tree | 47ade2efe9accbe03572f81d4030bd194909ee87 /webkit/media | |
parent | a334864d9687516534a1b0cc8c18208a63c9e136 (diff) | |
download | chromium_src-adcff2dfcc7d4916ccc322aa53d35098b66c026a.zip chromium_src-adcff2dfcc7d4916ccc322aa53d35098b66c026a.tar.gz chromium_src-adcff2dfcc7d4916ccc322aa53d35098b66c026a.tar.bz2 |
Extract metadata for media elements
In our current html5 media implemtation, we pretend everything is loaded and gave a temporary duration of 100 seconds to WebKit.
However, this will break things if developer do sth like video.seek(video.duration). Also, width and height information are not available.
This change adds a thread in browser process to extract media metadata from the elements, before reporting to WebKit that media is loaded.
This only works if wifi or ethernet is available.
Review URL: https://chromiumcodereview.appspot.com/12518035
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@191786 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/media')
-rw-r--r-- | webkit/media/android/webmediaplayer_android.cc | 6 | ||||
-rw-r--r-- | webkit/media/android/webmediaplayer_android.h | 3 |
2 files changed, 7 insertions, 2 deletions
diff --git a/webkit/media/android/webmediaplayer_android.cc b/webkit/media/android/webmediaplayer_android.cc index 2cf9297..5b00e5d 100644 --- a/webkit/media/android/webmediaplayer_android.cc +++ b/webkit/media/android/webmediaplayer_android.cc @@ -284,7 +284,8 @@ unsigned WebMediaPlayerAndroid::videoDecodedByteCount() const { return 0; } -void WebMediaPlayerAndroid::OnMediaPrepared(base::TimeDelta duration) { +void WebMediaPlayerAndroid::OnMediaMetadataChanged( + base::TimeDelta duration, int width, int height, bool success) { if (url_.SchemeIs("file")) UpdateNetworkState(WebMediaPlayer::NetworkStateLoaded); @@ -293,6 +294,9 @@ void WebMediaPlayerAndroid::OnMediaPrepared(base::TimeDelta duration) { UpdateReadyState(WebMediaPlayer::ReadyStateHaveEnoughData); } + if (success) + OnVideoSizeChanged(width, height); + if (hasVideo() && !video_weblayer_ && client_->needsWebLayerForVideo()) { video_weblayer_.reset( new webkit::WebLayerImpl(cc::VideoLayer::Create(this))); diff --git a/webkit/media/android/webmediaplayer_android.h b/webkit/media/android/webmediaplayer_android.h index b5ad22e..a0fb5bb 100644 --- a/webkit/media/android/webmediaplayer_android.h +++ b/webkit/media/android/webmediaplayer_android.h @@ -104,7 +104,8 @@ class WebMediaPlayerAndroid OVERRIDE; // Media player callback handlers. - virtual void OnMediaPrepared(base::TimeDelta duration); + virtual void OnMediaMetadataChanged(base::TimeDelta duration, int width, + int height, bool success); virtual void OnPlaybackComplete(); virtual void OnBufferingUpdate(int percentage); virtual void OnSeekComplete(base::TimeDelta current_time); |