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 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
629 WebMediaPlayer::NetworkState WebMediaPlayerImpl::getNetworkState() const { | 629 WebMediaPlayer::NetworkState WebMediaPlayerImpl::getNetworkState() const { |
630 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 630 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
631 return network_state_; | 631 return network_state_; |
632 } | 632 } |
633 | 633 |
634 WebMediaPlayer::ReadyState WebMediaPlayerImpl::getReadyState() const { | 634 WebMediaPlayer::ReadyState WebMediaPlayerImpl::getReadyState() const { |
635 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 635 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
636 return ready_state_; | 636 return ready_state_; |
637 } | 637 } |
638 | 638 |
| 639 blink::WebString WebMediaPlayerImpl::getErrorMessage() { |
| 640 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
| 641 return blink::WebString::fromUTF8(media_log_->GetLastErrorMessage()); |
| 642 } |
| 643 |
639 blink::WebTimeRanges WebMediaPlayerImpl::buffered() const { | 644 blink::WebTimeRanges WebMediaPlayerImpl::buffered() const { |
640 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 645 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
641 | 646 |
642 Ranges<base::TimeDelta> buffered_time_ranges = | 647 Ranges<base::TimeDelta> buffered_time_ranges = |
643 pipeline_.GetBufferedTimeRanges(); | 648 pipeline_.GetBufferedTimeRanges(); |
644 | 649 |
645 const base::TimeDelta duration = pipeline_.GetMediaDuration(); | 650 const base::TimeDelta duration = pipeline_.GetMediaDuration(); |
646 if (duration != kInfiniteDuration()) { | 651 if (duration != kInfiniteDuration()) { |
647 buffered_data_source_host_.AddBufferedTimeRanges( | 652 buffered_data_source_host_.AddBufferedTimeRanges( |
648 &buffered_time_ranges, duration); | 653 &buffered_time_ranges, duration); |
(...skipping 896 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1545 bool WebMediaPlayerImpl::IsAutomaticResumeAllowed() { | 1550 bool WebMediaPlayerImpl::IsAutomaticResumeAllowed() { |
1546 #if defined(OS_ANDROID) | 1551 #if defined(OS_ANDROID) |
1547 return !hasVideo() || (delegate_ && !delegate_->IsHidden()); | 1552 return !hasVideo() || (delegate_ && !delegate_->IsHidden()); |
1548 #else | 1553 #else |
1549 // On non-Android platforms Resume() is always allowed. | 1554 // On non-Android platforms Resume() is always allowed. |
1550 return true; | 1555 return true; |
1551 #endif | 1556 #endif |
1552 } | 1557 } |
1553 | 1558 |
1554 } // namespace media | 1559 } // namespace media |
OLD | NEW |