Clip question - stopping and pausing

I use the Clip objects to play sounds. When the clip reaches its end, when I call its start() method, it doesn't play. It turned out that its frame position is set to the last one, so in fact it plays, but ends immedietaly. So I figured out to add a LineListener, and if the Type == STOP, I set the frame position to 0. But in this manner, when I call my pause method:
public void stop(Clip c) {
    c.stop();
    c.setFramePosition(0);
public void pause(Clip c) {
    c.stop();
}it also generates the STOP event, and repositions to the beginning. Does anybody have any idea how to go about it?

MediaPlayer has the methods saveMediaTime() and restoreMediaTime() for pausing and starting the media playing. Have a look through the documentation and see if Clip has these. Otherwise you could try using JMF's MediaPlayer (but I don't know how that would affect your app. or the sound)...
Alastair

Similar Messages

  • TA38565 When I rent a movie, it stops and pauses to download and takes forever to watch.  Is this to be expected?

    Why does my apple TV stop and download or buffer for long periods of time?

    Could be heavy traffic on your ISP, or at Apple's server end. Is this a problem you've had for a while, or just started recently?

  • Stop and Pause Buttons and Estimated Execution Time

    I have more or less completed my programme (as attached).
    I am just left with two doubts - first: is it possible to let the user know the estimated time to finish executing the entire code/ running the entire experiment on my devices?
    I am currently trying to calculate this estimated time by using the arithmetic functions and time stamp. I tried putting on both the left and right sides of my case structure but it never runs - I tired running the code and after all other commands are executed, the estimated time is still not displayed. I suspect that even if the estimated time is displayed, it would only be displayed after all other commands are executed.
    I have tried looking up on timed structures but they don't seem to fit the job.
    Do you have any advice on this?
    Second: While loops could only be stopped (by pressing my 'STOP' button/Boolean that is linked to the loop condition) only after the first execution of the loop. How could I let my user stop the execution of code during the first run of the loop or should I wire my code differently using another structure?
    As for the 'Pause' button to pause the VI, I have read about the 'Wait for' function (http://zone.ni.com/reference/en-XX/help/371361H-01/glang/wait_for_front_panel_act/). I am not sure if this is the right function I am looking for and if this function enables the user to 'un-pause'/toggle the switch and enable the execution of the subsequent commands.
    This function seems useful but it does not solve the problem of the while loop having to execute at least once before I terminate it and it seems like this function acts like a 'Stop' function that exits the loop, terminating all commands instead of pausing the VI.
    What is your advice on this?
    Thank you so so much!

    Duplicate Post

  • How to stop and (rewind) videos.

    Hi.
    I am trying to create my first 100% to be the page of a Multi-Artistic Performance i have with some friends.
    All the content of the site is being displayed inside a Movie Clip (called "pageContainer_mc").
    I have then 6 diferent pages, each with different content that load inside the "pageContainer_mc" acording to the use of the menu buttons.
    the navigation worked fine.
    But now i ran into a problem that i cannot find how to solve.
    Inside 4 of the 6 pages i would like to put a video.
    I have put it there with the FLVPlayback and then created Play, Stop and Pause Buttons.
    The problem is, that when i click to go to another page the video continues playing back and then, when i come back to the previous page it is still going...
    What i would like is, for instance, when i am at Page2 and click to go to Page3, then the Video on Page2 will stop.  Once i click back to Page2 i would like that the video is again ready to start from the Begining (and not the place where it stoped previously).
    The code animating the menu and loading the diferent contents is on Scene 1. The code animating the buttons for the videos is on each page.
    Any ideas on how to achieve this?
    you can take a look at the .FLA file here:
    http://www.4shared.com/file/9Zos4HVd/four_elements.html?refurl=d1url
    Thank you for your time and help.

    well, if there is someone out there with the same kind of problem, this seems to have done the trick
    FLVPlayback.addEventListener (Event.REMOVED_FROM_STAGE, killVideo);
    function killVideo(e:Event){
    FLVPlayback.stop();

  • How come when I stop and start an audio clip before its done...

    How come when I stop and start an audio clip when before its done, that when I play it it only plays part of the file?

    I'm not sure if I got you right, but do you mean that it's like pausing...
    I have never played an audio clip with java, but if this is the case, maybe you have to rewind the clip.
    /J Lindroos

  • My question mark and forward slash key have suddenly stopped working.  have I pressed something to make this happen.  Any ideas.

    My question mark and forward slash key have suddenly stopped working.  Have I pressed something I shouldn't have.  Any ideas what to do.

    judith147 wrote:
    My question mark and forward slash key have suddenly stopped working. 
    If they do nothing at all, double check system preferences/speech and make sure they have not somehow gotten set as the trigger for Text to speech or speech recognition, etc.
    Also try an external keyboard.  If it works ok, then your internal keyboard is probably damaged and needs repair or replacement.

  • IMAC PAUSES, Stops and Goes HELP!!!

    Hello,
    I bought my computer in November. It is a 24" Imac. I have a pausing problem myself. It got so bad I brought the computer back to Apple and they reload Leopard for me from the beginning. Again, my computer is pausing when I do everything. It's getting so bad that my wife has noticed it and now asking me why I went from Windows to Apple. (OUCH) Plus, she knows nothing about computers. I need help quick. Any one out there with any answers would help. I am sick of things stopping and going with everything I do.
    Thanks
    Scott

    silentpartner,
    Unless your issues match a known problem, (wouldn't appear too likely if no result from the Apple Hardware Test) before Apple will accept your iMac for hardware repairs, you'll have to prove it's not a software issue by reinstalling the OS. FWIW, if it's a hardware issue and in particular if the hard drive needs replacing, you'll want to back up your important data anyway, prior to turning it in for any repair.

  • ITunes songs skip and pause the abruptly stop and skip to another song

    Please help. I have had my macbook for just under two weeks and earlier this evening my itunes has stopped working properly. Every song i play it skips and pauses much like a cd, and then eventually stops abrubtly mid song and skips to another. Please help me to resolve this issue.
    Thanks

    I just bought a new MacBook and am having the same problem with certain songs. It'll pause at the same point each time, then jump to the next song.

  • Help please! My macbook air (2015) startup showed a folder with question mark so i tried "Command   R" for internet recovery but after few minutes it stopped and showed error.. Please hepl me!

    Help please! My macbook air (2015) startup showed a folder with question mark so i tried "Command   R" for internet recovery but after few minutes it stopped and showed error.. Please hepl me!

    Startup – Question Mark
    Startup Issues - Resolve
    Startup Issues - Resolve (2)
    Startup Issues - Resolve (3)

  • I have a problem, when i start the project i open the browser window and whenh i select a clip premiere stops working!!!

    i have a problem, when i start the project i open the browser window and whenh i select a clip premiere stops working!!!

    More information needed for someone to help... please click below and provide the requested information
    -Premiere Pro Video Editing Information FAQ http://forums.adobe.com/message/4200840

  • Adding a title to a clip makes the image pause and not respond correctly.

    Hi
    I have Imovie running on my Mac book and when I add a title to a clip, the image when pauses (audio continues).
    The other error that occurs is that when the title is put in place there is a jump in the audio and video like the clip has been cut and a few frames have been removed or some times added.
    Ilife came free with my mac so I cant re install it. Also the new Imovie is not something I'm after. But if the free download comes with all the effects etc then I may consider geting the new Ilife 08.
    So whats going on in Imovie 06?
    any one?

    It may just be that you have insufficient disk space, or are storing your project on an external disk that is not formatted for Apple. It should be Mac OS extended or Mac OS extended (journaled).
    IF none of the above apply, for the heck of it try closing iMovie and trashing the Fonts Collections Folder (NOT the Font Book) located in user/Library/Font Collections. When iMovie is relaunched it will create a new Fonts Collection Folder with the info that it needs. Inexplicably, that sometimes resolves these glitches. You could also try removing any duplicate fonts that you find in your Font Book Folder. (They will have a black dot next to them.) Select any with a black dot and then go to the Edit menu and select Resolve Duplicates.
    If none of the above works, you can always try closing the iMovie project and then trashing the com.apple.iMovie.plist file located in your User/Library/Preferences folder. When you relaunch iMovie a new iMovie.plist file will be created.
    You can repair permissions through the Apple Utility App.
    Some of the more experienced tech persons on this forum may have some better suggestions.

  • HT3775 Why won't a video clip play all the way through without stopping and loading so many times?

    Any video clip that comes via email will not play all the way through without stopping so many times to load that a short clip takes 10 minutes to watch.  Sometimes, the video simply stops and loads forever and ceases to work at all.
    This happens for Youtube videos also.
    I am using a Snow Leopard Imac.

    This happens for Youtube videos also.
    Uninstall the currently installed Flash plugin then reinstall new.
    Very important to uninstall the old first.
    Uninstall >  Troubleshoot Flash Player | Mac OS
    Then reinstall new from here >   http://get.adobe.com/flashplayer/
    Then restart your Mac.

  • Simple question?  - stop and start code

    hi, can anyone tell me how to stop this code and then start it again, as all it dose now is move to the last instruction. the code is on an action of a button being pressed, i would like it to stop in the code were it stays stop and then continue again when the button that it is on is pressed.
                   board.setImage(0, 2, im); // move counter
                   board.setImage(0, 1, null); //  removing the last counter
                   //stop
                   board.setImage(0, 4, im); // move counter
                   board.setImage(0, 3, null); //  removing the last counter
                    Is there any way of doing this?

    helen852008 wrote:
    hi, can anyone tell me how to stop this code and then start it again, as all it dose now is move to the last instruction. I'm guessing that you're trying to do some CPU-intensive animation processing on the EDT (event dispatch thread). You probably need to do some of your labor-intensive processing in a background worker thread. A SwingWorker object might work well for you. If you look at the api for this and search the forum you'll get an idea on what it does and some sample code. If this doesn't help, then you may do well to post a compilable subsection of your code, or SSCCE. Read up on posting SSCCEs here:
    http://homepage1.nifty.com/algafield/sscce.html

  • ITunes radio starts playing after I check email.  What can I do to stop that from happening.  It is a nuisance to open iTunes and pause the song playing.

    On my iPhone 5c, after I check email or other apps not related to phone use, frequently iTunes radio starts playing.  I have learned to open app and pause the song being played.  Is there a way to not have that happen?

    HI,
    Most likely this is the server end and may improve on changing ports
    https://discussions.apple.com/thread/4749776?tstart=0
    8:59 PM      Tuesday; January 29, 2013
    Please, if posting Logs, do not post any Log info after the line "Binary Images for iChat"
      iMac 2.5Ghz 5i 2011 (Mountain Lion 10.8.2)
     G4/1GhzDual MDD (Leopard 10.5.8)
     MacBookPro 2Gb (Snow Leopard 10.6.8)
     Mac OS X (10.6.8),
     Couple of iPhones and an iPad
    "Limit the Logs to the Bits above Binary Images."  No, Seriously

  • In Flex 3 how to Stop and Replay .swf animation created in Flash

    Hi
    I have an animation file that is created in Flash (I think
    CS3). In Flex if I import it inside a SWFLoader or if I import it
    as an Image. It plays once and stops. Then I can not replay it. I
    also can not pause it when its playing.
    I have tried few things based on help and code available in
    the Web to of no help. I have tried to convert the swfLoader
    instance to a movie clip like so to stop
    var c:MovieClip = swfLoaderHeaddress1.content as MovieClip;
    c.stop();
    <mx:SWFLoader x="53" y="116" width="206" height="255.3"
    visible="true"
    source="assets/animations/curatorial/ZoomHeadress_2nd.swf"
    id="swfLoaderHeaddress1"/>
    It does not work.
    I have not created the .swf animation, I am not sure how it
    is done. I belive it may not be using any ActionScript as I know
    the artist who created it does not know ActionScript. Does
    something need to be done inside the Flash to support the stop and
    play? Or is there a way to restart/replay stop a .swf animation in
    Flex 3 no matter how (and whether or not its developed using
    ActionScript) its developed in Flash?

    One way is she has to add some AS code to the animation, or
    you can do it yourself.
    In swf there must be something like this:
    var connReciever:LocalConnection = new LocalConnection();
    connReciever.client = this;
    connReciever.connect("fromFlexToSWF");
    function myFunction(parameter:SomeClass):void {...}
    And in Flex:
    var connSender:LocalConnection = new LocalConnection();
    connSender.send("fromFlexToSWF", "myFunction", [..args]);
    The other way: in case with just play/stop there is a way to
    resolve this by using that Flex Component Kit (or maybe "Flex Skin
    Design Extension", i do not remember), it is something like she
    just adding labels to animation frames then she exports it with
    Flex Kit and then you can work with it like with an object with
    "states".

Maybe you are looking for