Problem with audioClip.play

I have written a simple code to play a wav file on a applet. Sometimes the audioClip.play() method doesn't play anything(inspite of the fact that the wav file is correct, i have confirmed that by playing the same wav in windows media player). Is something wrong with the code below??
Also is there any way that i can programmatically figure out that play doesn't play anything...
Thanks..
N.
public class playerApplet extends Applet implements ActionListener {
AudioClip clip;
URL outputWavURL;
public void actionPerformed(ActionEvent e) {
if(e.getSource==playButton) {
generateWavFile(); // native method to generate the wav file..
if(clip!=null)
     clip.stop();
outputWavURL = new URL("file", "localhost", "output.wav");
     clip = this.newAudioClip(outputWavURL);
     clip.play();
}

As an experiment, try adding a Thread.sleep (2000); after your clip.play(); statement.  I'm having similar symptoms in an application I'm writing and so far that is the only solution I've found to get the sound out.  I was searching the groups looking for answers to my problem when I saw your question.
P.S. You'll need to surround the Thread.sleep in an appropriate try/catch block.

Similar Messages

  • Problems with mirror play to Apple TV from macbook air

    Hi,
    I'm having difficulty's streaming from my macbook air to the tv screen via the apple tv.
    The Apple TV is conected to the Internet via wifi and it plays rented movies or streaming youtube fine but if i try to watch a movie from my laptop (stream of the net ) and watch it on the tv then it wont work properly , it has excessive lag and cuts out or wont connect to my laptop at all . it wont show the desk top intermittent either and massive delays when it does.
    i think it may have something to do with an update or something ? I have mavericks on the air and everything is updated , i have 2 apple tvs and 1 is connected through Ethernet and it seems ok I've also tried to do the same through my imac with parrot but its the same problems even tho its connected directly to the router.
    Thanks in advance
    stu

    The Imac has the same problem with playing to the lounge room atv but no where near as bad, ( can actually watch a movie) it just cuts in and out a little but when you watch it on the imac screen its playing fine.
    my modem is a netgear dual band and i have tryed both bands and still has the problem i also have a range extender and its bad through that but when I originally purchased the atv it worked fine with it.
    I don't watch a lot of movies mainly stream music through the iphone on it and this is why im thinking that an update may have affected it cause it used to work fine but i also did purchase the netgear router and im thinking it may also could be a problem but what i cant understand is the problem is only with airplay or parrot depending on laptop or desk top and no real problems with the iphone streaming movies or the stream ok through itunes apart from some movies don't have sound in itunes .
    When you say I can adjust the router could you tell me what to adjust or how ?
    Thanks for your help

  • Problems with instant play in some browsers

    This is not a problem with how Safari works, but I thought someone here might help me with a frustrating problem for which I can find no solution.
    I created several web pages with embedded QuickTime movies in mp4 format.  They are constructed so that the movies begin instantly to play as soon as the pages are accessed.  This has worked for the past couple of years regardless of which browser was used ( Mac versions of Safari, Firefox versions <4.x, Sunrise and others;  Windows versions of Internet Explorer and Firefox).
    It has recently been brought to my attention that this functionality is broken when updating to Firefox 4.x for Mac or when using Chrome for Mac.  Using either of these browsers to access the pages results in a static page with no video play.  The user must wait 1-2 minutes for the video to completely download and then it will automatically play.   Since the movies play fine on multiple browsers, including the new Firefox 4.x for Windows, it seems to me that the problem is not in how the movies were coded but rather in how the browsers handle the html code for the pages.
    The movies were edited in FCP, exported to Compressor, processed as mp4 streaming video and then embedded in web pages using Freeway Pro software with the "auto play" option enabled.
    Any ideas will be appreciated.
    John
    a sample page is:    http://lccut.org/videofiles/gospelvideo6high.html

    Here's the response I got from Freeway Pro support:
    Hi John
    There seems to be an issue at the moment with the way that Firefox 4 (and to a certain extent Chrome) handles QuickTime movies. If you go to the test page on our site at <http://users.softpress.com/keith/firefox4test/> you'll see that it is very erratic in what it shows and how it plays - but note that you may need to wait a while in between clicking on Firefox 4's Refresh button to see that the results change from one refresh to the next.
    Freeway is certainly publishing the code correctly, so this is does not appear to be a Freeway issue - though we would like to get to the source of the problem so we can advise customers on the best options to fix things. If you Google for "firefox4 quicktime movie problem" (without the quotes) you will see that this is not a problem specific to Freeway users.
    Leopard users report that Firefox 4 displays and plays QT movies fine, but Snow Leopard seems to have problems. This may be due to the way that QuickTime and Firefox 4 play together, as Leopard and Snow Leopard use slightly different versions of QuickTime.
    You should, however, be aware that non-Mac users will always need to download the QuickTime plug-in (which many PC users are reluctant to do, and some may not be allowed to by their IT department) for them to be able to see the movies play. The only truly universal method for offering video content on a web page is to use Flash .flv files and then use the FLV Player Action so that iPhone/iPad users will see an alternative (non-Flash) movie which is created by the Action. See the movie tutorial at <http://www.softpress.com/support/tutorials> (Episode 14) for details of how to set this up.
    As soon as we find a workaround for the problems with Firefox 4 and Chrome, we will put up an article on our KnowledgeBase at <http://www.softpress.com/kb/>. It might be that Firefox and Chrome will release a new update soon to fix the problem, in which case we will tell you which version you need to download an install.
    Best regards
    So the FW people insist that there software is encoded the pages properly and it is the fault of the newer Mac browsers causing the error.
    John

  • Problem with "stop playing causing camera light to flash

    Since ipgrading to ios 5.1 I se that Apple took away the Sleep ipod opton for the timer and relaced it with "stop playing".  Unfortunately, wen the timer reaches zero, the phone stops playing but the camera flas starts flashing until I unlock the phone.  Besides being annoying, this obviously defeats the purpose of resting the phone and saving battery life.  Any suggestions?  Note: I do have a flaslight app on the phone in case that makes a difference.

    Thanks again
    I have removed the keyframes in frame 2 and 6 on all the layers (please seen new pic below), however the problem still persists.
    Here is my code on my actions layer:
    stop();
    toolbar.addEventListener(MouseEvent.MOUSE_DOWN, fl_ClickToDrag);
    function fl_ClickToDrag(event:MouseEvent):void
        toolbar.startDrag();
    stage.addEventListener(MouseEvent.MOUSE_UP, fl_ReleaseToDrop);
    function fl_ReleaseToDrop(event:MouseEvent):void
        toolbar.stopDrag();
    about.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndPlayFromFrame_4);
    function fl_ClickToGoToAndPlayFromFrame_4(event:MouseEvent):void
        gotoAndPlay(2);
    latestnews.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndPlayFromFrame_6);
    function fl_ClickToGoToAndPlayFromFrame_6(event:MouseEvent):void
        gotoAndPlay(3);
    services.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndPlayFromFrame_7);
    function fl_ClickToGoToAndPlayFromFrame_7(event:MouseEvent):void
        gotoAndPlay(4);
    portfolio.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndPlayFromFrame_8);
    function fl_ClickToGoToAndPlayFromFrame_8(event:MouseEvent):void
        gotoAndPlay(5);
    contact.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndPlayFromFrame_9);
    function fl_ClickToGoToAndPlayFromFrame_9(event:MouseEvent):void
        gotoAndPlay(6);
    As you can see the code looks pretty correct to me. Ignore the code at the top, that is just for a draggable graphic on the page.
    Any clues from the code??

  • A problem with the Play/ Pause control button in a quiz project

    Hi,
    I have a probem with the play/ pause button in this project,
    it is a quiz project, the problem is when I click the pause the
    project does not pause and keep working ? Any idea why?
    http://www.megaupload.com/?d=995I8WX9
    Thanks

    If you have bought you Macbook within 90 days or have bought AppleCare you can call them for free and ask them what you should do. 1-800-MY-APPLE

  • Tens of Thousands having massive problems with Flash Playing Cityville

    Literally tens, possibly hundreds, of thousands of people are having problems with FlashPlayer crashing constantly while trying to play a Zynga game, Cityville, which plays on Facebook while running the game on Google Chrome. None of us had this problem before sometime last week and now playing the game is all but impossible. Sometimes the game works for a minute or two with great lag and sometimes it shuts down right after you get the game up and running. The only message we get is that Flashplayer has crashed. We can restore the page and go again for a minute but the problem occurs time after time. Does anyone know a solution or does  anyone know how to get Adobe, Zynga and Facebbok to get together and solve the problem? Most of us are just computer users and aren't computer savvy so don't know what to do.
    I followed instructions on my PC and got a little more info. It seems that Windows 'sees' the program on it's initiation as a possible threat to the system and/or running too slowly. Her is some information I found but I don't know and am afraid to do anything else with it.
    Heck, I can't even upload that; I'm told the file type isn't allowed. LOL  Anyhow it told me that I should go into my MOTO Connect Service and manually select (with instructions) the .EXE file for the app to bee an exception to the genral DEP. I didn't do that because I was a bit timid and also never found an .exe file that looked correct. Perhaps I should be happy about that....
    Anyhow, there are over 6 million people who regularly play Cityville and all of them no doubt have adjusted their opinions about Adobe because of this. Shame is that it is not likely even Adobe's problem.

    If you are having issues with the Flash Player, there is a forum dedicated to it that would be a more suitable place for discussions about it...
    http://forums.adobe.com/community/webplayers/flash_player

  • Safari with problems with video playing

    Hello all,
    I am using a new Macbook Pro 13'' with retina display. I have bought it less than 2 weeks ago and it shows it has OS version 10.9.1. Safari version is 7.
    When I try to stream videos from coursera.com I just see a black background when the video was supposed to be playing. The audio plays fine, but no video. Has anyone had a similar problem?
    Other question, has anyone managed to be able to play more videos from youtube without flash? I haven't installed because I have read it drains battery faster. I have survived without in mavericks, but I haven't been able to play many videos on youtube, only a few, and these cases are rare.
    Regards,

    try form safari to :
    Safari ▹ Preferences... ▹ Privacy ▹ Remove All Website Data
    then obviously make sure that the latest version of quicktime is install on you mac.
    let me know

  • PrObLeM WiTh IpOd pLaYiNg ViDeOs WiTh No SoUnD!! HELP ME!!

    i have a ipod nano 8gb 3rd generation i just got a couple of weeks ago. i got it, read the directions, got the latest downloads, loaded itunes, put my music, videos, everything on itunes, and connected my i sync all of my music on mai ipod with no problem. but when i sync my videos onto my ipod....THERE IS NO SOUND!! the videos were previously converted before i synced them on the ipod. PLEASE HELP ME RESOLVE THIS PLEASE!!

    QuickTime expects video files with separate video and audio tracks, but many MPEG formats used a muxed (multiplexed) single track that contains both. Therefore, when you convert videos in iTunes to iPod format they only show the video and no sound since iTunes (really QuickTime) is not looking for the audio track within the video track and it gets lost.
    iPod plays video but not audio of some exported files
    http://docs.info.apple.com/article.html?artnum=302588
    One way to work around this is to use MPEG Streamclip to convert the files to fix this issue...
    http://www.squared5.com/
    but there are other applications besides MPEG Streamclip you can try as well.
    Frequently asked questions about viewing and syncing video with iTunes and iPod
    http://docs.info.apple.com/article.html?artnum=302758
    The Complete Guide to Converting Video to iPod Format (Mac)
    http://www.ilounge.com/index.php/articles/comments/the-complete-guide-to-convert ing-video-to-ipod-format-mac/
    See other tutorial articles over at iLounge...
    http://www.ilounge.com/index.php/articles/tutorials/
    Patrick

  • Problems with iPod playing in the Car.

    I recently bought a new car and it has the hook up to play my iPod through the radio. It worked great at first but recently my iPod has started playing the music and not the words in the songs. This happens a lot. I have tried to restart the iPod, messing with the EQ settings, Restarting all the setting and nothing seems to work. I have to unplug the iPod and leave it alone for a few days before it would go back to normal. Also recently the iPod said that the hold button was on when it wasn't and it wouldn't let me do anything with the iPod. I restarted it again and it still said that the hold was on. Yet again I had to leave it alone for a few days before it would go back to normal. If anyone has had this problem and has found a solution, please let me know.

    Hi Jeff,
    Thanks for the help but I am unfortunately still not able to get my iPod Classic to connect. I have tried all the tricks in the article that you linked to.
    One thing is that when I reset the iPod (menu and center until the logo pops up) I get a critical error in iTunes and it shuts down. Could that indicate that my problem is with the iTunes installation rather than the iPod?
    I have tried to re-install iTunes before but maybe I shpuld give it  a go again?
    Brgds,
    Nik

  • Problem with AudioClip

    I am trying to play sound in an applet. I read through the forum and found some code that I thought would help, but I am still having trouble. My problem is I am trying to play an audio clip that is in a different location then my source code. My program compiles, but when I run it, I get an error saying permissions denied. However, I have full rights to the folder that my program is in and the folder where my audio clips are. Any suggestions would be helpful.
    Chad
    import java.applet.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import java.net.*;
    public class SoundExample2 extends Applet implements MouseListener
         AudioClip sound1;
         AudioClip sound2;
         public void init()
              File fileAudio = new File("//712student/users:/APPS/WINDOWS/JAVA/applets/drew laughing.au");
            URL url = null;
                    try {
                        url = fileAudio.toURL();
                    } catch (MalformedURLException ex) {
                        ex.printStackTrace();
            newAudioClip(url).play();
              //sound1 = getAudioClip(getDocumentBase(),"//712student/users:/APPS/WINDOWS/JAVA/applets/drew laughing.au");
              //sound2 = getAudioClip(getDocumentBase(), "S:/APPS/WINDOWS/JAVA/applets/drew laughing.au");
              addMouseListener(this);
              setBackground(Color.yellow);
              //sound1.play();
         public void paint(Graphics g)
              g.drawString("Click to hear a sound", 20, 20);
         public void mouseClicked(MouseEvent me)
              sound2.play();
         public void mousePressed(MouseEvent me)
         public void mouseReleased(MouseEvent me)
         public void mouseEntered(MouseEvent me)
         public void mouseExited(MouseEvent me)
    }

    Change
    midFile = Applet.getAudioClip(getCodeBase(),"test.mid");
    to
    midFile = getAudioClip(getCodeBase(),"test.mid");

  • Suddenly problems with air play

    I have without any problems used airplay to see Danish television using screen mirroring from my Ipad to our TV- it worked perfect from day 1.
    But the last week I get error messsages saying error while reading in the program, try later or can't do  this a action.
    I can still see all the old news and programs from last week on the television using airplay, but the news and programs which is about a week old and up to today I only can watch on the Ipad and not via airplay on the television.
    Is it my apple tv/air play connection which is the problem ( it is conneceting to the Ipad ( white light) ? and if so any idea how to solve the problem? or is it the the Danish television who have changed something in the way they make their programs on line?

    Welcome to the Apple Community.
    Websites and third party Apps need enabling before they will allow AirPlay of Video content. Some Website/App developers have not enabled their products, some simply haven't got around to it yet, others have stated that they won't be enabling AirPlay (likely as a result of licensing issues).
    Sky block their App from working with AirPlay.

  • Problem with song playing...

    Hey everyone...I'm trying to lay down a song to play with my movie and a window keeps popping up saying that the song is not authorized to play on this computer. I purchased the song from iTunes and I go ahead and authorize it and it keeps popping back up not allowing me to hear the song. Keep in mind this is my laptop that has all of my songs on it from iTunes so I don't know why I would be getting this error message. Thanks in advance...

    updated Quicktime and that did the trick...

  • Problem with music playing

    Hi, when I'm playing music on my Blackberry curve 8520 the music will stop playing when I receive a Message or email. Then an erros pops up and says Error ocurred attenting to play track. what should I do to fix this. Before this my music would play regarsless of receivng any type of message. Thanks.

    Might sound a bit simple but - this happened to my ipod after i used skull kandi head phones, apparentyly the headphone jack was broken. Took it to apple store and they replaced the whole ipod. Not really anthing to do with syncing

  • Lacie HD freezes MBP13 // Problem with music played on TBD

    Hi all,
    I have three questions related to my peripherals, below is my configuration:
    I'm using a MBP Retina 13 inch, Mid 2014, 3 GHz i7, 16 GB RAM, OS 10.10.2
    I'm using a Thunderbolt Display 27" as external display
    1.) A couple of weeks ago I purchased a Lacie d2 Thunderbolt 2 hard disk. When I connect the hard disk through USB connection everything works perfectly fine. However when I connect it via the Thunderbolt connection my MBP freezes and I have to reboot my computer. Does anyone experience similar issues and if so, how did you resolve them?
    2.) Also, since I installed 10.10.2. when I play music on MBP over my TBD after 30-45 minutes the music is overlaid with a signal noise. When I pause the track that's currently being played it goes away. Any suggestions are welcome.
    3.) Can I power up my MBP with my TBD? (I have not found guidance how to do it online, I assume it is not possible but hey, you never know)
    Thanks,
    JS

    Hi Smokerz,
    Thanks for your reply. On number #3 that's how it do it now, however, I would have thought that there must be a way to start the MBP when connected to TBD through a keyboard combination or so. Apparently that is not an option and I have to take the MBP out of its stand. Not a big deal, just an inconvenience.
    On #1: I'm surprised that TB should not be used like USB, I do it when I use the TB port to connect a projector and that works without any issues. I will certainly try your recommendation, but I'm under the believe that this should be plug and play.
    Again thanks a lot for your reply.

  • Problem with chapters playing when i dont want them to

    OK let me explain what I have going here. I have 4 timelines for seperate videos in my project. Each has a motion button on the main menu that will play each one independantly and then return to the main menu and a "play it all" button the will play them in order. Ok all that works fine except for one thing. I want to video that shows in my thumbnails on the main menu to be a seperate video than what is actually in the feature DVD so after searching the forum I found a solution that is working. What I did was to take the video I wanted to use for the thumbnails and add that to the end of each timeline as a new chapter and then added a poster frame to control what showed in the thumbnail.
    So to review.....each timeline had two chapters one that I want to show in the feature DVD and one that I do not.
    By using the end actions oneach of the first videos in each timeline I can get the DVD to play from the beginning and skip the video I dont want seen. However, .....and here is the reason for my post FINALLY....when i use the chapter skip on the preview it of course skips to the video I dont want shown.....the last video on each timeline. So instead of having 4 chapters I now have 8....4 of each i would like to not be accessable at all.
    Any way to to what I am wanting to do which essentially is tell Encore to skipthose chapters on the chapter skip button on the player??
    thanks for any help in advance!!!!!!!!!!!

    Unfortunately not, if you are using that workaround. I can offer two suggestions:
    1. Create your entire motion menu background (including the thumbnail animations) in Premiere or After Effects, then use that as a background video on your menu that is set up with buttons containing
    only subpicture layers (no other layers, including thumbnail layers).
    2. Keep your current workaround and add user operations to the timeline so that Next/Previous chapter navigation is prohibited.

Maybe you are looking for

  • Microsoft Visual C++ Runtime Library-Error

    I have installed 9.0 Version an when go to open I get the Runtime Error! Program: C:\ProgramFiles\Adobe\Reader9.0\Reader\AcroRd32.exe This application has requested the Runtime to terminate it in an unusual way Please contact the appilication's suppo

  • MAU Enhancement Guide Problem

    Hey, I´m trying to get acquainted with developing ME/MI applications. Therefore I have read some documentation around the whole system. Then I started with the MDK-Tutorial and made it until the end. But that tutorial is more for learning to create S

  • Error during export from portal using CTS+

    Hi, Our portal lansacape consists of EP7 EHP1 systems (EPD --> EPQ --> EPP). For transports in portal we have configured CTS+ on PI system which is a NW 7.1 system acting as a domain controller. All the configurations are completed. When I go to the

  • How to watch .avi video in iphone?

    Hi I use win Vista and I just bought a new iphone. Everything works well. Only one question is : how to watch .avi video in iphone. I download a lot of video in that format but cannot add them into intunes, therefore cannot sync into iphone. I search

  • Why we need to call writeFloat twice?

    When we playback the audio recorded, why we need to call  e.data.writeFloat(sample) twice? private function playRecorded(e:SampleDataEvent): void                 if (!rec.bytesAvailable > 0)                            return;                 var leng