OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "media/blink/webmediaplayer_impl.h" | 5 #include "media/blink/webmediaplayer_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <limits> | 9 #include <limits> |
10 #include <string> | 10 #include <string> |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 } | 415 } |
416 #endif | 416 #endif |
417 paused_ = false; | 417 paused_ = false; |
418 is_idle_ = false; | 418 is_idle_ = false; |
419 pipeline_.SetPlaybackRate(playback_rate_); | 419 pipeline_.SetPlaybackRate(playback_rate_); |
420 background_pause_timer_.Stop(); | 420 background_pause_timer_.Stop(); |
421 | 421 |
422 if (data_source_) | 422 if (data_source_) |
423 data_source_->MediaIsPlaying(); | 423 data_source_->MediaIsPlaying(); |
424 | 424 |
| 425 if (observer_) |
| 426 observer_->OnPlaying(); |
| 427 |
425 DCHECK(watch_time_reporter_); | 428 DCHECK(watch_time_reporter_); |
426 watch_time_reporter_->OnPlaying(); | 429 watch_time_reporter_->OnPlaying(); |
427 media_log_->AddEvent(media_log_->CreateEvent(MediaLogEvent::PLAY)); | 430 media_log_->AddEvent(media_log_->CreateEvent(MediaLogEvent::PLAY)); |
428 UpdatePlayState(); | 431 UpdatePlayState(); |
429 } | 432 } |
430 | 433 |
431 void WebMediaPlayerImpl::pause() { | 434 void WebMediaPlayerImpl::pause() { |
432 DVLOG(1) << __func__; | 435 DVLOG(1) << __func__; |
433 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 436 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
434 | 437 |
(...skipping 11 matching lines...) Expand all Loading... |
446 | 449 |
447 pipeline_.SetPlaybackRate(0.0); | 450 pipeline_.SetPlaybackRate(0.0); |
448 | 451 |
449 // pause() may be called after playback has ended and the HTMLMediaElement | 452 // pause() may be called after playback has ended and the HTMLMediaElement |
450 // requires that currentTime() == duration() after ending. We want to ensure | 453 // requires that currentTime() == duration() after ending. We want to ensure |
451 // |paused_time_| matches currentTime() in this case or a future seek() may | 454 // |paused_time_| matches currentTime() in this case or a future seek() may |
452 // incorrectly discard what it thinks is a seek to the existing time. | 455 // incorrectly discard what it thinks is a seek to the existing time. |
453 paused_time_ = | 456 paused_time_ = |
454 ended_ ? pipeline_.GetMediaDuration() : pipeline_.GetMediaTime(); | 457 ended_ ? pipeline_.GetMediaDuration() : pipeline_.GetMediaTime(); |
455 | 458 |
| 459 if (observer_) |
| 460 observer_->OnPaused(); |
| 461 |
456 DCHECK(watch_time_reporter_); | 462 DCHECK(watch_time_reporter_); |
457 watch_time_reporter_->OnPaused(); | 463 watch_time_reporter_->OnPaused(); |
458 media_log_->AddEvent(media_log_->CreateEvent(MediaLogEvent::PAUSE)); | 464 media_log_->AddEvent(media_log_->CreateEvent(MediaLogEvent::PAUSE)); |
459 UpdatePlayState(); | 465 UpdatePlayState(); |
460 } | 466 } |
461 | 467 |
462 bool WebMediaPlayerImpl::supportsSave() const { | 468 bool WebMediaPlayerImpl::supportsSave() const { |
463 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 469 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
464 return supports_save_; | 470 return supports_save_; |
465 } | 471 } |
(...skipping 1538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2004 return delegate_ && delegate_->IsHidden(); | 2010 return delegate_ && delegate_->IsHidden(); |
2005 } | 2011 } |
2006 | 2012 |
2007 void WebMediaPlayerImpl::ActivateViewportIntersectionMonitoring(bool activate) { | 2013 void WebMediaPlayerImpl::ActivateViewportIntersectionMonitoring(bool activate) { |
2008 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 2014 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
2009 | 2015 |
2010 client_->activateViewportIntersectionMonitoring(activate); | 2016 client_->activateViewportIntersectionMonitoring(activate); |
2011 } | 2017 } |
2012 | 2018 |
2013 } // namespace media | 2019 } // namespace media |
OLD | NEW |