Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Add music to applet?

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello.. i have this coding in my applet..

{

AudioClip audioClip = getAudioClip(getCodeBase(), "17 Track 17.WAV");
audioClip.loop();

}
 
may tan
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry.. havent type finish my previuos qns..

okay i have the coding in my public void paint() method

{
AudioClip audioClip = getAudioClip(getCodeBase(), "17 Track 17.WAV");
audioClip.loop();
}

And also the follwoing html file in my "class" folder

<HTML>
<TITLE> Sound Demo APPLET </TITLE>
<APPLET CODE = "ComputeResistance.class" WIDTH=900 HEIGHT=1000></APPLET>
</HTML>

but why it doesnt seems to play any music?


Btw is it possible to add "4.17MB" song into my java?
will it hangs?

And what is the extension if it frm "window media player"??
is it .WAV?


Thanks =)
 
Sheriff
Posts: 9099
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry.. havent type finish my previuos qns..

You can edit any of your own posts by clicking on the icon (that looks like a paper and pencil) of the post you want to edit.

okay i have the coding in my public void paint() method
{
AudioClip audioClip = getAudioClip(getCodeBase(), "17 Track 17.WAV");
audioClip.loop();
}


but why it doesnt seems to play any music?

paint() is for visual, not audio. I would suggest using another method for this.

Also, you might want to rename the .wav file to one with no spaces (at least to start with). Also remember that Java is case sensitive. Is your wav file really in all caps?

Btw is it possible to add "4.17MB" song into my java?
Will it hang?


After you get the small wav running, you can try with a larger file.

And what is the extension if it from "window media player"??
is it .WAV?


It depends on the operating system. Windows media player does indeed play wav files, but whether or not it is the default is system dependent.
 
Cob is sand, clay and sometimes straw. This tiny ad is made of cob:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic