1

i have tried to create an applet to just play sound, no buttons or controls. The sound should start playing as soon as the applet starts. But the sound doesnt come. There r no compile-time or run-time error, i've even created the correct policy for Audio Permissions but still no sound ? Heres my code...

import java.applet.*;  
import java.net.*; 

/* 

<applet code="Audio2" width="300" height="300">
</applet> 
*/

public class Audio2 extends Applet 
{

    public void init() 
    {
    
        try 
        {
        
            URL url1 = new URL("file://C:/jdk1.5/bin/Cool.wav"); 
            AudioClip cli = Applet.newAudioClip(url1); 
            getAudioClip(url1); 
            
            cli.play(); 
            cli.loop();
        }
        catch (MalformedURLException ex)  
        { 
            ex.printStackTrace(); 
        }
    
    
    
    }
}

What am i doing wrong ?
:sad:

2
Contributors
1
Reply
2
Views
10 Years
Discussion Span
Last Post by peter_budo
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.