Copy link to clipboard
Copied
Hello,
I am in a bad loop and I can't seem to get a slide to resume playing after hitting the pause button. The stop buttons works. The Play button works by restarting the slide after the stop button is pressed or the slide ends. The pause button works by pausing the audio. But it will not resume when the play button is pressed after clicking on the pause button. Issue: My script doesn't resume play (by pressing play) after the pause button was pressed.
Stop Button Advanced Action (works😞
Pause Button Advanced Action (works😞
Play Button Advanced Action (Plays after Stop is pressed - works)
Play button Advanced Action (Plays after Pause is pressed - doesn't work)
Copy link to clipboard
Copied
I don't really know what you want to do but I see a seriiouss bug: you do use the same name for a variable and an action. That is not allowed.
If you use the command Pause, the slide audio will be paused and the system variable cpCmndPause will automatically be toggled to 1. Why do you need another user variable? If you use the command Continue, the system varialbe cpCmndResume is automatically toggled to 1, and cpCmndPause to 0. What is for you the difference between Stop and Pause? Can you explain, to me that is exactly the same but I'm not a native English speaker.
Are you new to AA? Can you please use the Preview button to show the whole action with all decisions instead of all those screenshots which make it very hard to see the full pciture. The Preview button is the first button in the top right control panel (arrow-like).
Why do you restart the slide for StopAudio? The last expression doesn't make sense at all: cpCmndResume is a Boolean, it can only have the values 0 or 1, why do you use a slide number to set it?
Copy link to clipboard
Copied
Hello,
Thank you for your reply. I am trying to control the slide's audio. Each slide is static and has three buttons Stop, Play, and Pause.
The Pause button pauses the audio on the slide. So that when the user clicks on Play button again is continues on from where it was paused.
The Stop button stops the audio and if you press play it restarts the audio.
The Play button also restarts the audio if pressed at the end of the narration.
Copy link to clipboard
Copied
If it's Slide audio, it doesn't matter whether or not you're using a static image. You're playing, pausing, and stopping the timeline with your buttons...not specifically an audio file.
Copy link to clipboard
Copied
What is the use of all those user variables? You don't need them at all. Moreover as I wrote: you cannot use the SAME NAME for two different items, inthis case PLAYAUDIO is used as variable name and as action name.
Do you want HTML output? The Expression cpCmndGotoSlide = cpInfoCurrentSlide - is not to be trusted, worked great for SWF output. I explained that in a blog post: Replay (slide) Button - Captivate blog
Are you aware of the fact that the Pause command will pause not only the slide audio but the playhead simply stops, with a few exceptions everything is paused. Look at Pausing Captivate's Timeline - Captivate blog
Play/Pause could easily be done with one toggle button that has two states. That is what I use all the time in my projects. One conditional action, using the commands Pause and Continue, and Change state, based on the conditino 'IF cpCmndPause is equal to 1' To add the check for the end of the slide, you'll need to do some calculations based on the duration of the slide, and the first frame number of the slide. To be sure the Replay slide works, the present workaround (there is a bug in HTML output where On Enter action with micronavigation are not working correctly) add a shart dummy slide before the pressnt slide (0,1secs) and use Go to Previous slide as command to replay. That is working all the time.
Copy link to clipboard
Copied
I forgot to mention the buttons are located on the Master Slide.
Copy link to clipboard
Copied
Lieve and I crossed paths and are basically saying the same thing on the play/pause issue, but she's got a much more comprehensive look at everything you've got going on. She's got you covered here!
Thanks for the thorough explanation, Lieve.
Copy link to clipboard
Copied
Thanks, plan to write a blog about 'What is wrong with easy-peasy'? This is a typical example: why make it so complicated when it is really easy if you understand Captivate's core features.
Copy link to clipboard
Copied
OK. Wow, I didn't mean to create a frustrating issue. This skin with the three buttons was given to me as an already approved project. I started out as adding simple actions and it didn't work. I built it up to try to create the functions that are requirements which I explained above. I followed previous posts by Lilybiri and others that made things work but I never could find my exact scenario. The Play button has to do three things (1) Play audio when pressed (2) Play audio from the beginning of the timelline after the stop button was pressed and (3) Play audio from where the timeline stopped after pressing the pause button. Simple actions were not working.
These are also located on the Master Slide.
Copy link to clipboard
Copied
That is the reason why I asked you to post the full script for that conditional action. Of course this will not work with simple actions. But if you want help, try to offer all the details. Only then is it possible to analyze and offer possible solutions. But I started with was oviously a first stumbling block: same name for two items, a varialbe and an action is not allowed in Captivate.
It is not a 'ridiculous' question, I never have said, nor meant to say that. You need to identify all situations: in your last answer it is getting a little bit clear. First situation is not clear yet to me: Play audio when pressed? It is slide audio, you told before, which means it plays automatically when the slide is reached, or is the slide paused On Enter? The second situation is clear and the third as well You can use a tracking variable v_press that tracks the previous press: set to 'Stop' if the last action was a 'Stop' press, set to 'Pause' if the last action was a Pause button press. That tracking variable has to be reset to blank when the Play button is clicked. So far so good, but what is that first situation?
On Master slide? Important missing information!. Are they pausing all slides?
Thsi will not be a problem, except for somtething you didn't mention in the last answer but before: when the Play button is clicked and the slide is at its end, Ausio would have o be restarted. Is that still necessary?
Copy link to clipboard
Copied
Hello,
This is the script for the Play button:
The master slide has these three separate buttons. The slide automatically plays. If the user clicks on pause, the slide pauses. If they click Play right after, it continues to play from where it left off.
If they press the stop button, the audio stops. If they press the Play button after pressing the stop buttons the audio plays from the beginning.
The Play button plays the audio again when pressed after the timeline already finished.
Again, thank you for your help. I thought I was very close since most of it was working. It just won't resume play after pause.
Copy link to clipboard
Copied
You have to take out the variable 'PlayAudio', name is used for an action.
If you use one variable v_press to which you assign the word 'Stop' when the Stop button is pressed, and the word 'Pause' when the Pause button is pressed. Then create a dummy short slide as I told earleri. The two decisions for this Play button would be:
IF v_press is equal to Pause
Assign v_press with v_null
Continue
IF v_press is equal to Stop
Assign v_press with v_null
Go to Previous Slide
The variable v_null is an empty variable used to clear the var v_press. You could also have it separately in a third decision that is not conditional instead of having it twice in the two decisions.
As both Sabre and myself told: we have no idea what you meant to do with the ELSE part of the second decision? Can you explain? Pressing the Play button while the audio is playing, shouldn't do anything. To start the audio when entering the slide, you don't need to use the Play button.
Copy link to clipboard
Copied
Eureka! I got it to work. I removed the else statement and treated the cpCmndResume as a Boolean, which I didn't realize.
Stop Button:
Play Button:
Pause Button:
Thank you both for your help and extra information.
Copy link to clipboard
Copied
Maybe you are happy with your solution, you ignore my warnings about duplicate names, the Expression for Replay which is not to be trusted for HTML output, and th confusing names of the buttons. Exactly the same functionality could have been done with two buttons
If you want to avoid the conditional advanced action for the Pause/Playbutton, and the extra state, use two buttons which you hide and show. Three very easy actions, no confusion at all. And very logical.
Copy link to clipboard
Copied
Hi, I did eventually change the duplicate names after I posted the code above. I am happy with this solution since it works exactly as it should now. I have tested this on all platforms, SCORM server and 508 tested and there are no issues. I did explain that I was limited to this exact scenario with three independent buttons that control the slide audio. If I was allowed to change the course design I would have combined the buttons but this was not my call and the challenge I was provided. You and Sabre123 provided me information I wasn't aware of with the cpCmndResume being Boolean and removing an unnecessary extra else statement. This helped me understand the function better. Again, thank you for your assistance.
Copy link to clipboard
Copied
There still is a lot of misunderstanding: you seem to believe that variables can store only numbers. As I proposed, even for your solution, it would have been a lot easier to use ONE tracking variable that stored 'Stop' if the Stop button had been clicked, or 'Pause' if the Pause button had been clicked. No need to reset the 'other' variable as you have to do.
The Expression command can result in replay the slide, perfectly for SWF output, not guaranteed for HTML output but it means that the playhead is NOT re-entering the slide. If you have an On Enter action, which is very common to reset a situation on the slide or to clear variables, that will not happen. Micronavigation or the dummy slide approach is indispensable in that case. Especially since you use this actions on master slides, you have to check all slides using that master slide for On Enter actions.
Somewhere in the thread you wrote that Replay should have occurred also when the audio reached the end of the slide and the Pause button was clicked? I don't see that solution?
You could have downloaded my explanatory table with system variables from this blog post.
System variables in Captivate 8/9 and 2017 - Captivate blog
BTW You are not pausing (stopping is pausing as well) but the SLIDE. You are not continuing playing audio but the SLIDE. Those buttons are not audio buttons, but control the slide.
Copy link to clipboard
Copied
I don't understand why you keep replying in this aggressive manner. I thanked you for your time and the information you provided. The solution was found and it works. You make a lot of judgemental assumptions in your replies. Like you originally commented to Sabre123, the solution was simple I just didn't see it. There are more than one way to make things work. Yes I understand the buttons are not controlling the audio but the slide and these buttons were located on the master slides. I don't understanding why you keep replying with solutions that are only your way. I'd like to end this thread as solved. People come here for help not to be continually reprimanded for the code choices they make. Good day.
Copy link to clipboard
Copied
In your Play button action, you're assigning a value to cpCmndResume that can be a value that is neither true or false. cpCmndResume should be either a 0 or a 1. 1 resumes playback.
If after changing that, you find that is still doesn't resume, on the Play button object, tick the box that says, "Continue playing project" and see if that fixes things. If it does, remove your expression and remove "Continue" in your Play button action.