Problem with mimetype when calling MediaPlayer.addTimedTextSource

218 views
Skip to first unread message

Alex M

unread,
Jul 18, 2014, 5:24:12 PM7/18/14
to android-...@googlegroups.com

I found a stupid error in android source code, it's quite minor but it would be useful to fix it. When you try to add subtitles in a MediaPlayer object, you need to specify the mimetype as an argument. The problem is if you don't use the MediaPlayer.MEDIA_MIMETYPE_TEXT_SUBRIP constant, the code will throw an exception since the test done on the string is a == operator instead of equals. So that means if you call this : 

MediaPlayer.addTimedTextSource( "/sdcard/subs.srt", "application/x-subrip" );

The code will throw an "java.lang.IllegalArgumentException: Illegal mimeType for timed text source: application/x-subrip" even though it's exactly the (only) mime type supported. I ran into this because i'm using Xamarin's mono and the string marshalling will prevent me from being able to send MEDIA_MIMETYPE_TEXT_SUBRIP as an argument.
So i writing here in hope some android contributor read this and make a patch for it.


File to modify --> MediaPlayer.java : 1718

Glenn Kasten

unread,
Jul 18, 2014, 5:59:24 PM7/18/14
to android-...@googlegroups.com
Thank you for your post.  Can you please file a bug here:
I also encourage you to become a contributor to AOSP so you can upload your fix for this.
In your patch commit message, please reference the URL of the issue.
Thanks!
Reply all
Reply to author
Forward
0 new messages