• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to play sound files from remote client in browser

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

Iam having this requirement, i have a sound file (.wav or .mp3) in my local machine which is referred in server-side java code
to play the sound using awt TOOLKIT, it works fine when running in my own local browser, but when accessed from another
m/c through web browser (internet) it wont work since sound file is in my server code and not in client's code.

Is there any better way to implement this, also the sound file should not be included directly in client code.
Please do reply whatever possibilities you know of?.

I doubt how all the music websites play sounds on entering the website (which is a remote client nothing but our browser)

I'm using JSF in front with java in server-side.

please please do reply back as it is some kind of urgent.

By
Ibrahim.
 
Ranch Hand
Posts: 650
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For a web application, the simplest method would be to serve the sound file as you would any other multi-media content and let the browser (and ultimately the user) decide how to deal with it. In the ServletsFaq there's an article on how to create an Image Servlet: http://faq.javaranch.com/java/ImageServlet. Although this was geared toward image files, the same principle is involved in sound files (just a different content-type header).

Of course, there are more advanced ways of doing this, including using flash or other players.
 
Ranch Hand
Posts: 820
IntelliJ IDE VI Editor Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Md Ibrahim wrote:Hi all,

Iam having this requirement, i have a sound file (.wav or .mp3) in my local machine which is referred in server-side java code
to play the sound using awt TOOLKIT, it works fine when running in my own local browser, but when accessed from another
m/c through web browser (internet) it wont work since sound file is in my server code and not in client's code.

Is there any better way to implement this, also the sound file should not be included directly in client code.
Please do reply whatever possibilities you know of?.

I doubt how all the music websites play sounds on entering the website (which is a remote client nothing but our browser)

I'm using JSF in front with java in server-side.

please please do reply back as it is some kind of urgent.



turn up the volume on the server REALLY LOUD.

no, don't. When music sites do this, they do it through a player of some sort (flash, quicktime, even a java applet). Check out this page full of audio applets:
http://javaboutique.internet.com/audio/
 
reply
    Bookmark Topic Watch Topic
  • New Topic