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

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

Issue 533543004: WebMediaPlayerImpl should notify ended event Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 3 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 | « no previous file | media/blink/webmediaplayer_impl.cc » ('j') | 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/android/build_info.h" 9 #include "base/android/build_info.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 if (success) 745 if (success)
746 OnVideoSizeChanged(width, height); 746 OnVideoSizeChanged(width, height);
747 747
748 has_valid_metadata_ = success; 748 has_valid_metadata_ = success;
749 749
750 if (need_to_signal_duration_changed) 750 if (need_to_signal_duration_changed)
751 client_->durationChanged(); 751 client_->durationChanged();
752 } 752 }
753 753
754 void WebMediaPlayerAndroid::OnPlaybackComplete() { 754 void WebMediaPlayerAndroid::OnPlaybackComplete() {
755 // When playback is about to finish, android media player often stops
756 // at a time which is smaller than the duration. This makes webkit never
757 // know that the playback has finished. To solve this, we set the
758 // current time to media duration when OnPlaybackComplete() get called.
759 interpolator_.SetBounds(duration_, duration_); 755 interpolator_.SetBounds(duration_, duration_);
760 client_->timeChanged(); 756 // If the duration in the metadata is not correct, then actual duration should
757 // be updated in blink.
758 if (duration() != currentTime())
759 OnDurationChanged(base::FromSecondsD(currentTime()));
761 760
762 // if the loop attribute is set, timeChanged() will update the current time 761 client_->mediaEnded();
762
763 // If the 'loop' attribute is set, mediaEnded() will update the current time
763 // to 0. It will perform a seek to 0. As the requests to the renderer 764 // to 0. It will perform a seek to 0. As the requests to the renderer
764 // process are sequential, the OnSeekComplete() will only occur 765 // process are sequential, the OnSeekComplete() will only occur
765 // once OnPlaybackComplete() is done. As the playback can only be executed 766 // once OnPlaybackComplete() is done. As the playback can only be executed
766 // upon completion of OnSeekComplete(), the request needs to be saved. 767 // upon completion of OnSeekComplete(), the request needs to be saved.
767 is_playing_ = false; 768 is_playing_ = false;
768 if (seeking_ && seek_time_ == base::TimeDelta()) 769 if (seeking_ && seek_time_ == base::TimeDelta())
769 pending_playback_ = true; 770 pending_playback_ = true;
770 } 771 }
771 772
772 void WebMediaPlayerAndroid::OnBufferingUpdate(int percentage) { 773 void WebMediaPlayerAndroid::OnBufferingUpdate(int percentage) {
(...skipping 1018 matching lines...) Expand 10 before | Expand all | Expand 10 after
1791 1792
1792 bool WebMediaPlayerAndroid::IsHLSStream() const { 1793 bool WebMediaPlayerAndroid::IsHLSStream() const {
1793 std::string mime; 1794 std::string mime;
1794 GURL url = redirected_url_.is_empty() ? url_ : redirected_url_; 1795 GURL url = redirected_url_.is_empty() ? url_ : redirected_url_;
1795 if (!net::GetMimeTypeFromFile(base::FilePath(url.path()), &mime)) 1796 if (!net::GetMimeTypeFromFile(base::FilePath(url.path()), &mime))
1796 return false; 1797 return false;
1797 return !mime.compare("application/x-mpegurl"); 1798 return !mime.compare("application/x-mpegurl");
1798 } 1799 }
1799 1800
1800 } // namespace content 1801 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | media/blink/webmediaplayer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698