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

Unified Diff: webkit/media/android/webmediaplayer_impl_android.cc

Issue 10979047: Upstream fullscreen video implementation for android (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merging latest changes Created 8 years, 2 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
Index: webkit/media/android/webmediaplayer_impl_android.cc
diff --git a/webkit/media/android/webmediaplayer_impl_android.cc b/webkit/media/android/webmediaplayer_impl_android.cc
index e38d1f29cec144bfef8711e827c8f9658484c18f..c43605f8d818c6c5e28804d3bb4d09f1cfd2b2c0 100644
--- a/webkit/media/android/webmediaplayer_impl_android.cc
+++ b/webkit/media/android/webmediaplayer_impl_android.cc
@@ -8,8 +8,10 @@
#include "base/logging.h"
#include "media/base/android/media_player_bridge.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayerClient.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
#include "webkit/media/android/stream_texture_factory_android.h"
#include "webkit/media/android/webmediaplayer_manager_android.h"
#include "webkit/media/android/webmediaplayer_proxy_android.h"
@@ -35,10 +37,28 @@ WebMediaPlayerImplAndroid::~WebMediaPlayerImplAndroid() {
Destroy();
}
+void WebMediaPlayerImplAndroid::enterFullscreen() {
+ if (proxy_ && manager()->CanEnterFullscreen(frame_)) {
+ proxy_->EnterFullscreen(player_id());
+ SetNeedsEstablishPeer(false);
+ }
+}
+
+void WebMediaPlayerImplAndroid::exitFullscreen() {
+ if (proxy_)
+ proxy_->ExitFullscreen(player_id());
+}
+
+bool WebMediaPlayerImplAndroid::canEnterFullscreen() const {
+ return manager()->CanEnterFullscreen(frame_);
+}
+
void WebMediaPlayerImplAndroid::InitializeMediaPlayer(GURL url) {
GURL first_party_url = frame_->document().firstPartyForCookies();
if (proxy_) {
proxy_->Initialize(player_id(), url.spec(), first_party_url.spec());
+ if (manager()->IsInFullscreen(frame_))
+ proxy_->EnterFullscreen(player_id());
}
UpdateNetworkState(WebMediaPlayer::NetworkStateLoading);
@@ -73,6 +93,37 @@ void WebMediaPlayerImplAndroid::OnTimeUpdate(base::TimeDelta current_time) {
current_time_ = static_cast<float>(current_time.InSecondsF());
}
+void WebMediaPlayerImplAndroid::OnDidEnterFullscreen() {
+ if (!manager()->IsInFullscreen(frame_)) {
+ frame_->view()->willEnterFullScreen();
+ frame_->view()->didEnterFullScreen();
+ manager()->DidEnterFullscreen(frame_);
+ }
+}
+
+void WebMediaPlayerImplAndroid::OnDidExitFullscreen() {
+ SetNeedsEstablishPeer(true);
+ // We had the fullscreen surface connected to Android MediaPlayer,
+ // so reconnect our surface texture for embedded playback.
+ if (!paused())
+ EstablishSurfaceTexturePeer();
+
+ frame_->view()->willExitFullScreen();
+ frame_->view()->didExitFullScreen();
+ manager()->DidExitFullscreen();
+ client()->repaint();
+}
+
+void WebMediaPlayerImplAndroid::OnMediaPlayerPlay() {
+ UpdatePlayingState(true);
+ client()->playbackStateChanged();
+}
+
+void WebMediaPlayerImplAndroid::OnMediaPlayerPause() {
+ UpdatePlayingState(false);
+ client()->playbackStateChanged();
+}
+
void WebMediaPlayerImplAndroid::Destroy() {
proxy_->DestroyPlayer(player_id());
proxy_ = NULL;
« no previous file with comments | « webkit/media/android/webmediaplayer_impl_android.h ('k') | webkit/media/android/webmediaplayer_manager_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698