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 "content/renderer/media/android/webmediaplayer_android.h" | 5 #include "content/renderer/media/android/webmediaplayer_android.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 // HTML5 spec requires duration to be NaN if readyState is HAVE_NOTHING | 390 // HTML5 spec requires duration to be NaN if readyState is HAVE_NOTHING |
391 if (ready_state_ == WebMediaPlayer::ReadyStateHaveNothing) | 391 if (ready_state_ == WebMediaPlayer::ReadyStateHaveNothing) |
392 return std::numeric_limits<double>::quiet_NaN(); | 392 return std::numeric_limits<double>::quiet_NaN(); |
393 | 393 |
394 if (duration_ == media::kInfiniteDuration()) | 394 if (duration_ == media::kInfiniteDuration()) |
395 return std::numeric_limits<double>::infinity(); | 395 return std::numeric_limits<double>::infinity(); |
396 | 396 |
397 return duration_.InSecondsF(); | 397 return duration_.InSecondsF(); |
398 } | 398 } |
399 | 399 |
| 400 double WebMediaPlayerAndroid::timelineOffset() const { |
| 401 base::Time timeline_offset; |
| 402 if (media_source_delegate_) |
| 403 timeline_offset = media_source_delegate_->GetTimelineOffset(); |
| 404 |
| 405 if (timeline_offset.is_null()) |
| 406 return std::numeric_limits<double>::quiet_NaN(); |
| 407 |
| 408 return timeline_offset.ToJsTime(); |
| 409 } |
| 410 |
400 double WebMediaPlayerAndroid::currentTime() const { | 411 double WebMediaPlayerAndroid::currentTime() const { |
401 // If the player is processing a seek, return the seek time. | 412 // If the player is processing a seek, return the seek time. |
402 // Blink may still query us if updatePlaybackState() occurs while seeking. | 413 // Blink may still query us if updatePlaybackState() occurs while seeking. |
403 if (seeking()) { | 414 if (seeking()) { |
404 return pending_seek_ ? | 415 return pending_seek_ ? |
405 pending_seek_time_.InSecondsF() : seek_time_.InSecondsF(); | 416 pending_seek_time_.InSecondsF() : seek_time_.InSecondsF(); |
406 } | 417 } |
407 | 418 |
408 return current_time_; | 419 return current_time_; |
409 } | 420 } |
(...skipping 1134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1544 | 1555 |
1545 void WebMediaPlayerAndroid::exitFullscreen() { | 1556 void WebMediaPlayerAndroid::exitFullscreen() { |
1546 manager_->ExitFullscreen(player_id_); | 1557 manager_->ExitFullscreen(player_id_); |
1547 } | 1558 } |
1548 | 1559 |
1549 bool WebMediaPlayerAndroid::canEnterFullscreen() const { | 1560 bool WebMediaPlayerAndroid::canEnterFullscreen() const { |
1550 return manager_->CanEnterFullscreen(frame_); | 1561 return manager_->CanEnterFullscreen(frame_); |
1551 } | 1562 } |
1552 | 1563 |
1553 } // namespace content | 1564 } // namespace content |
OLD | NEW |