-1

I am trying to run a sound file in Java using this code in Google App Engine:

 @UiHandler("btnRecite")
void btnRecite(ClickEvent event) throws Exception{
     URL soundFile =new URL( "http://everyayah.com/data/Ghamadi_40kbps/audhubillah.mp3");
      AudioInputStream ais = AudioSystem.getAudioInputStream(soundFile);
      AudioPlayer.player.start(ais);
}

I am getting this exception

       GAE:javax.sound.sampled.AudioInputStream is not supported by Google App Engine's Java runtime environment

any idea what could be the reason

thanks

user1226162
  • 1,972
  • 8
  • 27
  • 42

2 Answers2

5

Without wanting to be flippant, I imagine its because, as the error states, this is not supported in the AppEngine Java environment.

Playing sound on the server doesn't make any sense. Why would you want to do this? To entertain the server hosting staff?

Sam Holder
  • 32,535
  • 13
  • 101
  • 181
  • i am playing sound at the client side ,I am adding this code on a click of a button (edited my code, that was mistakenly posted), if you can guide me what could be the solution, thanks – user1226162 Apr 27 '12 at 03:04
  • if you want to play the sound on the client side then you will need to use some browser based player won't you? you can't play it on the client side by having a method on the server. you need to play it using some javascript/html5 code. [This question](http://stackoverflow.com/questions/8703975/html-5-play-tiny-mp3-inline) might help. – Sam Holder Apr 27 '12 at 08:13
  • and so might [this one](http://stackoverflow.com/questions/1933969/sound-effects-in-javascript-html5). – Sam Holder Apr 27 '12 at 08:19
1

In addition to what @Sam Holder told you, there is no main(..) method in web apps. It is specific to console & desktop apps.

Peter Knego
  • 79,991
  • 11
  • 123
  • 154