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

Unified Diff: content/renderer/media/android/webmediaplayer_android.cc

Issue 120693002: Fix- WebMediaPlayerAndroid::hasAudio() to query status of audio and return actual value (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: adding {} to if statement Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/media/android/webmediaplayer_android.cc
diff --git a/content/renderer/media/android/webmediaplayer_android.cc b/content/renderer/media/android/webmediaplayer_android.cc
index 6a0d2fc7a1a723312fec80f6f8c97013b0ad9611..bdb2d6997572e46f174f8e89e827249f76a5c790 100644
--- a/content/renderer/media/android/webmediaplayer_android.cc
+++ b/content/renderer/media/android/webmediaplayer_android.cc
@@ -440,8 +440,18 @@ bool WebMediaPlayerAndroid::hasVideo() const {
}
bool WebMediaPlayerAndroid::hasAudio() const {
- // TODO(hclam): Query status of audio and return the actual value.
- return true;
+ if (!url_.has_path())
+ return false;
+ std::string mime;
+ if (!net::GetMimeTypeFromFile(base::FilePath(url_.path()), &mime))
+ return true;
+
+ if (mime.find("audio/") != std::string::npos ||
+ mime.find("video/") != std::string::npos ||
+ mime.find("application/ogg") != std::string::npos) {
+ return true;
+ }
+ return false;
}
bool WebMediaPlayerAndroid::paused() const {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698