| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <limits> | 9 #include <limits> |
| 10 | 10 |
| (...skipping 848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 859 // When playback is about to finish, android media player often stops | 859 // When playback is about to finish, android media player often stops |
| 860 // at a time which is smaller than the duration. This makes webkit never | 860 // at a time which is smaller than the duration. This makes webkit never |
| 861 // know that the playback has finished. To solve this, we set the | 861 // know that the playback has finished. To solve this, we set the |
| 862 // current time to media duration when OnPlaybackComplete() get called. | 862 // current time to media duration when OnPlaybackComplete() get called. |
| 863 interpolator_.SetBounds(duration_, duration_); | 863 interpolator_.SetBounds(duration_, duration_); |
| 864 client_->timeChanged(); | 864 client_->timeChanged(); |
| 865 | 865 |
| 866 // If the loop attribute is set, timeChanged() will update the current time | 866 // If the loop attribute is set, timeChanged() will update the current time |
| 867 // to 0. It will perform a seek to 0. Issue a command to the player to start | 867 // to 0. It will perform a seek to 0. Issue a command to the player to start |
| 868 // playing after seek completes. | 868 // playing after seek completes. |
| 869 if (seeking_ && seek_time_.is_zero()) | 869 if (is_playing_ && seeking_ && seek_time_.is_zero()) |
| 870 player_manager_->Start(player_id_); | 870 player_manager_->Start(player_id_); |
| 871 else | 871 else |
| 872 playback_completed_ = true; | 872 playback_completed_ = true; |
| 873 } | 873 } |
| 874 | 874 |
| 875 void WebMediaPlayerAndroid::OnBufferingUpdate(int percentage) { | 875 void WebMediaPlayerAndroid::OnBufferingUpdate(int percentage) { |
| 876 buffered_[0].end = duration() * percentage / 100; | 876 buffered_[0].end = duration() * percentage / 100; |
| 877 did_loading_progress_ = true; | 877 did_loading_progress_ = true; |
| 878 | 878 |
| 879 if (percentage == 100 && network_state_ < WebMediaPlayer::NetworkStateLoaded) | 879 if (percentage == 100 && network_state_ < WebMediaPlayer::NetworkStateLoaded) |
| (...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1679 result = PREDICTION_RESULT_PATH_BASED_WAS_BETTER; | 1679 result = PREDICTION_RESULT_PATH_BASED_WAS_BETTER; |
| 1680 } else if (is_hls_url == is_hls) { | 1680 } else if (is_hls_url == is_hls) { |
| 1681 result = PREDICTION_RESULT_URL_BASED_WAS_BETTER; | 1681 result = PREDICTION_RESULT_URL_BASED_WAS_BETTER; |
| 1682 } | 1682 } |
| 1683 UMA_HISTOGRAM_ENUMERATION( | 1683 UMA_HISTOGRAM_ENUMERATION( |
| 1684 "Media.Android.IsHttpLiveStreamingMediaPredictionResult", | 1684 "Media.Android.IsHttpLiveStreamingMediaPredictionResult", |
| 1685 result, PREDICTION_RESULT_MAX); | 1685 result, PREDICTION_RESULT_MAX); |
| 1686 } | 1686 } |
| 1687 | 1687 |
| 1688 } // namespace content | 1688 } // namespace content |
| OLD | NEW |