Vote count:
0
I have a problem to get the correct sound file with the MediaPlayer. For example, when I want the audio file of the norwegian word "følelse" I make the request: "http://ift.tt/1ngrAUQ=følelse" in my browser and the correct sound file is played. But when i try the same request with the Android MediaPlayer (code below), I get the sound file of the word "folelse". The norwegian special character "ø" is not properly set up. Even when I encode this part of the url. When I print the String "request" the result is: "http://ift.tt/1ktZF55" and this works fine with my desktop browser, but unfortunately not with the MediaPlayer.
Can anybody help me or can give me a hint for a correct solution?
My code is:
MediaPlayer mediaPlayer = new MediaPlayer();
String encoded = URLEncoder.encode(text, "UTF-8");
URI uri = new URI(
"http",
"translate.google.com",
"/translate_tts",
"tl=no&q=følelse",
null);
String request = uri.toASCIIString();
mediaPlayer.setDataSource(request);
mediaPlayer.prepareAsync();
mediaPlayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
mediaPlayer.start();
}
});
asked 27 secs ago
Aucun commentaire:
Enregistrer un commentaire