Member
Last active 5 years ago
Hi Angelo,
Yes I was/am looking for a consistent way of knowing if the read aloud is playing.
The programming I did above was a "poor mans" way of doing it. If I test the first word(s) and have it trigger an action. i.e image switch on a button.
Again, thanks for you help.
- Rob W -
Thanks Angelo
The only way I figured out to check, is by watching the CSS changes using the following Javascript:
/* ==========================================*/
// Add this Javascript script to 'Load' event of a hidden button
var triggerWord = 'word30'; // CSS class name of the trigger word to watch in the read-aloud text
var triggerObject = $("#obj3689"); // ID of object that has the script that is triggered (hidden button)
var triggerEvent = 'TouchDown'; // The event that triggers the script in 'triggerObject' (hidden button)
// The 'triggerEvent' (TouchDown) of the 'triggerObject' can be added to the same hidden button as 'Load'
/* ==========================================*/
var observeWord = document.getElementById(triggerWord);
// Generate the observers:
// ---- observer ----
var observer = new MutationObserver(function(mutations){
mutations.forEach(function(mutation){
if ($( "#"+triggerWord ).hasClass( "-epub-media-overlay-active" )){
observer.disconnect();
triggerObject.trigger(PubCoder.Events.TouchDown);
}
});
});
/* ==========================================*/
// Start observing:
observer.observe(observeWord, {attributes: true});
FYI: I don't know if this will work on all devices.
Regards, Rob W.
I have been creating a epub with PubCoder, which is working great, thanks.
I have a question about using the Read-Aloud feature.
Is there anyway, through Javascript, to identify that the Read-Aloud feature is active/running? (a variable maybe?) when you open/load a page?
Thanks
Regards,
Rob Waterman
Thanks Angelo,
I had started doing that, but then thought that there might be an easier way. :)
Love the program.
Hi,
Having fun learning PubCoder. :)
Is there anyway through just Javascript to start or stop an animation object? I realize I could use the 'Play Animation' action, but I would like to know if there is a way to control the animations through Javascript. For example have a Javascript to randomly play and stop animations.
Or better yet, a way to play and stop only certain sections/frames of the animation object!
Thanks