Java

Moderators: zibadian
Number of threads: 7818
Number of posts: 18218

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
applet sound won't play Posted by nschm230 on 5 Dec 2007 at 1:12 AM
Hey, It's my first time trying to get an applet to play sound, and I'm banging my head a bit here. The sound won't play (it's a .wav) and What's getting me is that there's no exception thrown when run. If anyone can point out my error, it'd be much appreciated.

thanks in advance,
~ Nate
        //:: Grab Songs
        //   grab urls
        try {
            clipurl1 = new URL(Defines.HTTP_CONTEXT, Defines.MUSIC_URL_1);
            clipurl2 = new URL(Defines.HTTP_CONTEXT, Defines.MUSIC_URL_2);
            clipurl3 = new URL(Defines.HTTP_CONTEXT, Defines.MUSIC_URL_3);
        } catch(MalformedURLException e) {
            System.out.println("music urls invalid");
            System.exit(1);
        }

        //   grab AudioClips
        clip1 = Applet.newAudioClip(clipurl1);
        clip1 . play();
        System.out.println("playing...");

Report
Re: applet sound won't play Posted by zibadian on 5 Dec 2007 at 6:52 AM
: Hey, It's my first time trying to get an applet to play sound, and
: I'm banging my head a bit here. The sound won't play (it's a .wav)
: and What's getting me is that there's no exception thrown when run.
: If anyone can point out my error, it'd be much appreciated.
:
: thanks in advance,
: ~ Nate
:
: 
:         //:: Grab Songs
:         //   grab urls
:         try {
:             clipurl1 = new URL(Defines.HTTP_CONTEXT, Defines.MUSIC_URL_1);
:             clipurl2 = new URL(Defines.HTTP_CONTEXT, Defines.MUSIC_URL_2);
:             clipurl3 = new URL(Defines.HTTP_CONTEXT, Defines.MUSIC_URL_3);
:         } catch(MalformedURLException e) {
:             System.out.println("music urls invalid");
:             System.exit(1);
:         }
: 
:         //   grab AudioClips
:         clip1 = Applet.newAudioClip(clipurl1);
:         clip1 . play();
:         System.out.println("playing...");
: 
:
:
Are the sound clips on the same host as the applet? The default security manager of the JVM doesn't allow unsigned applets access to any other host than its own.



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.