I found this instruction to be very helpful, and works like a charm . . .
Stopping Audio within an HTML Widget
Audio playing in an HTML widget (in the form of embedded video or audio) will continue playing once your users have left the scene. To stop any audio playing from an HTML widget when leaving the scene, you’ll need to add a small snippet of JavaScript to trigger ‘On Scene Unload.’ Here’s the workflow for implementing this:
Select your HTML widget.
Open the ‘Identity Inspector’ and fill in a value for the Unique Element ID. This ID will allow us to directly target the HTML widget. In this example, we’ll be using the ID video1
In the On Scene Unload section of the Scene Inspector, add a Run JavaScript action.
Add the following code:
var emptyInnerHTML = '';
hypeDocument.getElementById("video1").innerHTML = emptyInnerHTML
Note : Audio playing within a standard audio or video element will stop when exiting the scene. Visit the Audio & Video documentation for more information.
. . . but is there a Javascript function to refill the InnerHTML?
I've placed embed code for a YouTube video in an HTML widget.
The widget is set to 0 percent scale and 0 percent visibility when the scene loads.
When the user clicks a play button, the widget animates to 100 percent scale and 100 percent visibility.
When the user clicks a close button, the widget animates back to 0 percent scale and 0 percent visibility. Emptying the innerHTML makes the audio stop.
Good.
But if the user clicks the play button again, the widget reanimates with an emptyHTML. How do I refill it with the original content if I do all this within the same scene?
You would need to put this inside of a regular rectangle, not an HTML widget. So the element with the id of 'frame2' in the example above would be a rect. There's lots of ways to do this but I think the method above is the simplest. Make sure you enclose your code above with ' and you can then use " internally to setup the properties of the iframe.