AppletTalk.com Forum Index AppletTalk.com
Java discussions newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Opening an audio file in Java

 
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java Help
View previous topic :: View next topic  
Author Message
Isha
Guest





PostPosted: Thu May 11, 2006 8:07 pm    Post subject: Opening an audio file in Java Reply with quote



Hello I'm trying to find some way to develop a web service that plays
music. I was wondering if there was a way in which I could make a Java
piece of code open a music file? I know I can open a text file and read
it's contents by making use of the ByteBuffer, but how about music? Is
it possible to open the music file and stream and play it using the
WIndows Media Player plugin available on browsers for example? I know
I'm a bit confusing here, but if anyone could help and advice me, I'd
be reeaally grateful.
Back to top
Oliver Wong
Guest





PostPosted: Thu May 11, 2006 8:07 pm    Post subject: Re: Opening an audio file in Java Reply with quote



"Isha" <i5ha (AT) yahoo (DOT) com> wrote in message
news:1147376176.337826.26120 (AT) v46g2000cwv (DOT) googlegroups.com...
Quote:
Hello I'm trying to find some way to develop a web service that plays
music. I was wondering if there was a way in which I could make a Java
piece of code open a music file? I know I can open a text file and read
it's contents by making use of the ByteBuffer, but how about music? Is
it possible to open the music file and stream and play it using the
WIndows Media Player plugin available on browsers for example? I know
I'm a bit confusing here, but if anyone could help and advice me, I'd
be reeaally grateful.


If you're going to use a browser side plugin, then you don't need to use
Java at all. You just have to emit the HTML that will tell the browser to
embed the music file at the appropriate location. Contact an HTML newsgroup
to find out the best way to do that.

- Oliver
Back to top
steve
Guest





PostPosted: Sun May 14, 2006 11:07 am    Post subject: Re: Opening an audio file in Java Reply with quote



On Fri, 12 May 2006 03:36:16 +0800, Isha wrote
(in article <1147376176.337826.26120 (AT) v46g2000cwv (DOT) googlegroups.com>):

Quote:
Hello I'm trying to find some way to develop a web service that plays
music. I was wondering if there was a way in which I could make a Java
piece of code open a music file? I know I can open a text file and read
it's contents by making use of the ByteBuffer, but how about music? Is
it possible to open the music file and stream and play it using the
WIndows Media Player plugin available on browsers for example? I know
I'm a bit confusing here, but if anyone could help and advice me, I'd
be reeaally grateful.


heres something from our company app that plays whilst it is updating.


private static AudioClip audioClip;

try {
setUpPropFile(); // get any properties
if( PlayIntro==true) {
//start by loading sound file
dosoundLoad(
new URL((((//"file:" +
ourProgramDirectory) +"/") + IntroFile)));

}
dosetupsplash();

if( PlayIntro==true) {
dosoundplay();
}


private static void dosoundLoad(final URL file){

audioClip = Applet.newAudioClip(file);
}

private static void dosoundplay(){
try{
Runnable r2 = new Runnable() {
public void run() {
try {
//AudioClip audioClip = Applet.newAudioClip(file);
audioClip.play();

Thread.yield();
Thread.sleep(2 * 1000L); //sleep for n seconds to load file
} catch (Exception e) {
System.out.println(e);

}
}
}
;

SwingUtilities.invokeLater(r2);}
catch (Exception e) {}

}

--
NewsGuy.Com 30Gb $9.95 Carry Forward and On Demand Bandwidth
Back to top
Display posts from previous:   
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.