Index: media/blink/webmediaplayer_impl.cc |
diff --git a/media/blink/webmediaplayer_impl.cc b/media/blink/webmediaplayer_impl.cc |
index 7c67743e982b430e3c7794a1e1d2a3310806ee3c..eda938bd8ba9744c66ff5008e80e363c6eac3ffc 100644 |
--- a/media/blink/webmediaplayer_impl.cc |
+++ b/media/blink/webmediaplayer_impl.cc |
@@ -227,7 +227,8 @@ WebMediaPlayerImpl::WebMediaPlayerImpl( |
suppress_destruction_errors_(false), |
can_suspend_state_(CanSuspendState::UNKNOWN), |
is_encrypted_(false), |
- underflow_count_(0) { |
+ underflow_count_(0), |
+ observer_(params.media_observer()) { |
DCHECK(!adjust_allocated_memory_cb_.is_null()); |
DCHECK(renderer_factory_); |
DCHECK(client_); |
@@ -337,11 +338,15 @@ void WebMediaPlayerImpl::DisableOverlay() { |
void WebMediaPlayerImpl::enteredFullscreen() { |
if (!force_video_overlays_ && !disable_fullscreen_video_overlays_) |
EnableOverlay(); |
+ if (observer_) |
+ observer_->OnEnteredFullscreen(); |
} |
void WebMediaPlayerImpl::exitedFullscreen() { |
if (!force_video_overlays_ && !disable_fullscreen_video_overlays_) |
DisableOverlay(); |
+ if (observer_) |
+ observer_->OnExitedFullscreen(); |
} |
void WebMediaPlayerImpl::DoLoad(LoadType load_type, |
@@ -953,6 +958,9 @@ void WebMediaPlayerImpl::SetCdm(const CdmAttachedCB& cdm_attached_cb, |
return; |
} |
+ if (observer_) |
+ observer_->OnSetCdm(cdm_context); |
+ |
// If CDM initialization succeeded, tell the pipeline about it. |
pipeline_.SetCdm(cdm_context, cdm_attached_cb); |
} |
@@ -1091,6 +1099,9 @@ void WebMediaPlayerImpl::OnMetadata(PipelineMetadata metadata) { |
client_->setWebLayer(video_weblayer_.get()); |
} |
+ if (observer_ && (hasVideo() || hasAudio())) |
+ observer_->OnMetadata(metadata); |
xhwang
2016/10/04 06:30:29
The MediaObserver interface doesn't say that OnMet
xjz
2016/10/04 19:21:29
Done.
|
+ |
CreateWatchTimeReporter(); |
UpdatePlayState(); |
} |
@@ -1821,4 +1832,14 @@ void WebMediaPlayerImpl::CreateWatchTimeReporter() { |
watch_time_reporter_->OnShown(); |
} |
+void WebMediaPlayerImpl::ancestorEnteredFullscreen() { |
+ if (observer_) |
+ observer_->OnEnteredFullscreen(); |
+} |
+ |
+void WebMediaPlayerImpl::ancestorExitedFullscreen() { |
+ if (observer_) |
+ observer_->OnExitedFullscreen(); |
+} |
+ |
} // namespace media |