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

Side by Side Diff: content/renderer/media/android/webmediaplayer_android.cc

Issue 263333004: Add timelineOffset() support to WebMediaPlayerAndroid. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 7 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 unified diff | Download patch
« no previous file with comments | « content/renderer/media/android/webmediaplayer_android.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « content/renderer/media/android/webmediaplayer_android.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698