| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "webkit/media/android/webmediaplayer_impl_android.h" |
| 6 |
| 7 #include "base/bind.h" |
| 8 #include "base/logging.h" |
| 9 #include "media/base/android/media_player_bridge.h" |
| 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" |
| 11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
| 12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayerClient.
h" |
| 13 #include "webkit/media/android/stream_texture_factory_android.h" |
| 14 #include "webkit/media/android/webmediaplayer_manager_android.h" |
| 15 #include "webkit/media/android/webmediaplayer_proxy_android.h" |
| 16 |
| 17 using WebKit::WebMediaPlayerClient; |
| 18 using WebKit::WebMediaPlayer; |
| 19 |
| 20 namespace webkit_media { |
| 21 |
| 22 WebMediaPlayerImplAndroid::WebMediaPlayerImplAndroid( |
| 23 WebKit::WebFrame* frame, |
| 24 WebMediaPlayerClient* client, |
| 25 WebMediaPlayerManagerAndroid* manager, |
| 26 WebMediaPlayerProxyAndroid* proxy, |
| 27 StreamTextureFactory* factory) |
| 28 : WebMediaPlayerAndroid(client, manager, factory), |
| 29 frame_(frame), |
| 30 proxy_(proxy), |
| 31 current_time_(0) { |
| 32 } |
| 33 |
| 34 WebMediaPlayerImplAndroid::~WebMediaPlayerImplAndroid() { |
| 35 Destroy(); |
| 36 } |
| 37 |
| 38 void WebMediaPlayerImplAndroid::InitializeMediaPlayer(GURL url) { |
| 39 GURL first_party_url = frame_->document().firstPartyForCookies(); |
| 40 if (proxy_) { |
| 41 proxy_->Initialize(player_id(), url.spec(), first_party_url.spec()); |
| 42 } |
| 43 |
| 44 UpdateNetworkState(WebMediaPlayer::NetworkStateLoading); |
| 45 UpdateReadyState(WebMediaPlayer::ReadyStateHaveNothing); |
| 46 } |
| 47 |
| 48 void WebMediaPlayerImplAndroid::PlayInternal() { |
| 49 if (paused() && proxy_) |
| 50 proxy_->Start(player_id()); |
| 51 } |
| 52 |
| 53 void WebMediaPlayerImplAndroid::PauseInternal() { |
| 54 if (proxy_) |
| 55 proxy_->Pause(player_id()); |
| 56 } |
| 57 |
| 58 void WebMediaPlayerImplAndroid::SeekInternal(base::TimeDelta time) { |
| 59 if (proxy_) |
| 60 proxy_->Seek(player_id(), time); |
| 61 } |
| 62 |
| 63 float WebMediaPlayerImplAndroid::GetCurrentTimeInternal() const { |
| 64 return current_time_; |
| 65 } |
| 66 |
| 67 void WebMediaPlayerImplAndroid::ReleaseResourcesInternal() { |
| 68 if (proxy_) |
| 69 proxy_->ReleaseResources(player_id()); |
| 70 } |
| 71 |
| 72 void WebMediaPlayerImplAndroid::OnTimeUpdate(base::TimeDelta current_time) { |
| 73 current_time_ = static_cast<float>(current_time.InSecondsF()); |
| 74 } |
| 75 |
| 76 void WebMediaPlayerImplAndroid::Destroy() { |
| 77 proxy_->DestroyPlayer(player_id()); |
| 78 proxy_ = NULL; |
| 79 } |
| 80 |
| 81 void WebMediaPlayerImplAndroid::SetVideoSurface(jobject j_surface) {} |
| 82 |
| 83 } // namespace webkit_media |
| OLD | NEW |