Results 1 to 2 of 2
  1. #1
    AndrewM16921 is offline Senior Member
    Join Date
    Jan 2009
    Location
    CA, USA
    Posts
    264
    Rep Power
    6

    Default [SOLVED] Audio in Applet

    I'm trying to play an audio file in an applet, but for some reason it isn't working. I've Googled solutions, but from what I've seen I'm doing it right. If anyone can point me toward a better tutorial or something, please do.

    Java Code:
    import java.awt.*;
    import java.awt.event.*;
    import java.applet.*;
    import java.util.Random;
    import java.util.ArrayList;
    
    public class Window extends Applet implements Runnable, KeyListener
    {
    
    	...
    
    	public AudioClip bgMusic = getAudioClip(getCodeBase(), "Song1.au");
    	
    	public void init()
    	{
    
    		...
        
    		bgMusic.play();
        
    		repaint();
    	}
    
    ...
    Last edited by AndrewM16921; 04-06-2009 at 02:17 AM.

  2. #2
    AndrewM16921 is offline Senior Member
    Join Date
    Jan 2009
    Location
    CA, USA
    Posts
    264
    Rep Power
    6

    Default

    Heh... I moved " = getAudioClip(getCodeBase(), "Song1.au");" into init() and it worked. K well, thanks anywho... lol.

Similar Threads

  1. playing audio in J-App??
    By ashton in forum New To Java
    Replies: 3
    Last Post: 01-30-2009, 09:50 AM
  2. Control audio sound
    By Masuka in forum Sun Java Wireless Toolkit
    Replies: 0
    Last Post: 08-05-2008, 11:24 AM
  3. Download audio tracks for films
    By jSarK0Y in forum Forum Lobby
    Replies: 0
    Last Post: 04-30-2008, 02:06 AM
  4. Please help Transmitting Audio and Video using RTP
    By pedaramanareddy in forum New To Java
    Replies: 0
    Last Post: 01-03-2008, 03:39 PM
  5. Audio Recorder
    By elizabeth in forum Java Applets
    Replies: 1
    Last Post: 08-06-2007, 10:21 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •