There must be a simple way of doing this but, unexpectedly, it does not work
I want students to play an audio clip. At the moment if they multiple click the play button I have created, they will initiate multiple plays of the clip simultaneously e.g. they click three times on the button, they will hear 3 playbacks all offset in relation to one another – very messy.
I wrote this
onmclick stop clip
onmclick play clip
I would expect this to stop the clip if it is playing, then play the clip.
BUT… that does not work and nothing is played. Nothing happens.
I suppose I could disable/hide the button until the clip is played etc. but that would add a complication and also force the student to listen to the entire clip (unless I create a stop button etc.). I could just use a toggle but would prefer to start playback from the beginning. I could show a player but would prefer not to.
There must be a way of doing this simply without resorting to JS. Seems like a lot of trouble but maybe there is no option.
ok. I fixed it by toggling a variable – but it seems like a lot of work for something that should be quite simple – and I have to re-link a file several times (unless I use a change contents strategy).
Is there anything else happening with the audio on that page or with the button? Which version do you have? I tested a button to “Stop” and “Play” and it’s working without issues, i.e. always playing the audio from the beginning, in Lectora 17.1.3 and 16.1.2.
Try to put a short delay on the “Play” action, in case the Stop command isn’t finished before the “Play” comes.