Auto Start and Stop of Audio clips

Hello all, new to Compozer, so please be gentle :grinning_face:

I am in the process of authoring several courses, in each lesson we have several “pages” each with its own audio file to narrate the text on screen.

I need to be able to do two things, firstly when a new screen is openned, auto play an audio clip, and then again when pressing “Continue” stopping the current audio clip, before then starting to auto play the next audio clip associated with the next page.

I appreciate there is no “native” block to do this, but lookign online it seems there are some useful snippets of code out there that could possible do the trick, but not wanting to re-invent the wheel, I wondered if anyone else has got this working, and how?

Also, if not, is there a way to “inject” code into a course to add custom function like this.

Many thanks in advance for any help.

3 Likes

Bit of a late answer, I just joined up, didn’t know this community existed :upside_down_face: Not sure if you’ve worked it out but anyways, I’ll reply lol… from what I seen you can’t do it natively. So there’s no autoplay on audio blocks, which I personally think is old school, the learner actually has to hit play. On the code injection question the embed block is the only place you can put code and whatever you paste in there runs inside an iframe. So it’s sandboxed off from the rest of the lesson. I’ve played with that before and it’s really cool. Also worth knowing, even if Compozer did hand you full JS access, Chrome and Safari won’t allow audio to autoplay with sound until the learner has clicked something on the page. So your first clip on a fresh screen gets blocked regardless.

The bit that might actually help you though. I’ve worked out that if you have a Continue button at the end of a lesson that actually moves the learner to a new lesson, the player gets torn down with the page and the audio stops by itself. But test that before you plan around it. But if your “pages” are really just sections stacked inside one long scrolling lesson, that’ll be why audio bleeds into the next screen. Split them so it’s one lesson per page and that half fixes itself.

For the autoplay half I’d stop fighting it tbh. Audio block at the top of every screen, same spot every time. Learners pick up the pattern fast. Fewer and longer clips helps too, just less clicking overall :oncoming_fist:

2 Likes

I’m personally not a fan of auto play audio. Just thought I’d throw my 2cents in :grimacing: