Results 1 to 3 of 3
  1. #1
    Bagesh is offline Member
    Join Date
    Jul 2007
    Posts
    1
    Rep Power
    0

    Default Playing sound in applet??????

    Hi,

    Demo program given below is supposed to play sound.
    --------------------------
    import java.net.*;
    import java.applet.*;

    public class Sound2 {
    public static void main(String a[]) throws java.net.MalformedURLException, InterruptedException {
    URL url = new URL("http://simplythebest.net/sounds/WAV/WAV_files/cartoon_WAV_files/aladdin_goodbye.wav");
    AudioClip clip = Applet.newAudioClip(url);
    clip.play();
    Thread.sleep(10000);
    }
    }
    -------------------------------------------------------------
    Is it possible to play (online .wav file) sound in Applet using URL Like
    (http://simplythebest.net/sounds/WAV/...in_goodbye.wav)

    Although I have tried

    URL ur=new URL("file:\\C:\\Demo\\abc.wav");
    AudioClip clip =Applet.newAudioClip(ur);
    It's working fine
    but while using URL "http://simplythebest.net/sounds/WAV/WAV_files/cartoon_WAV_files/aladdin_goodbye.wav" i can't hear any sound.


    Actually i want to play "http://" URL file directly in applet
    Please help me.
    Last edited by Bagesh; 07-09-2007 at 12:21 PM.

  2. #2
    simon is offline Member
    Join Date
    Jul 2007
    Posts
    44
    Rep Power
    0

    Default

    the applets only have access to the resources of the machine where they execute.

  3. #3
    satya123 is offline Member
    Join Date
    Jul 2007
    Posts
    3
    Rep Power
    0

    Default

    That's right..applet only accesses within the system or host...cross domain stuff isn't there here

Similar Threads

  1. add sound to my applet
    By anotsu in forum Java Applets
    Replies: 4
    Last Post: 03-25-2008, 12:26 AM
  2. Re-playing sound
    By JSK in forum CLDC and MIDP
    Replies: 0
    Last Post: 02-06-2008, 12:34 PM
  3. Replies: 2
    Last Post: 10-31-2007, 04:55 PM
  4. applet sound
    By marco in forum Java Applets
    Replies: 1
    Last Post: 09-28-2007, 11:31 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
  •