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
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
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_SUBRIPconstant, 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 :
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.