Explore the community Forums Lectora Lectora Questions & Answers Jump to and play audio issue Reply To: Jump to and play audio issue

#386968 Score: 0
Profile photo of Jason Dalrymple
Jason Dalrymple
Member
beginner
intermediate
profile
wise owl
curious george
contributor
friend finder
advanced
picture perfect
54 pts
@JasonADal

It sounds like the variables idea is way more of a hassle – I’ve used an excel spreadsheet before something like this, where one cell is the “static”, then others are the “variable” so that I can just enter the values, copy and paste – sometimes much faster than trying to highlight and change (where I find myself accidentally deleting parentheses a lot).

Also, I made a tweak to the player behavior when clicking the play/pause button. In testing, the audio always reset to “begin” if the user paused the audio. I can see this easily becoming an annoyance for some of my users. So instead, I added the below so that if the pause occurs in the middle of the segment, it pauses then resumes where it left off. If the audio reaches the end of the segment and the user clicks “play”, then it resets the “begin” time and replays the segment.

// allows user to pause and resume without resetting time
if (player.CurrentTime < finish){
player.pause();
}else{
// returns player to 0:00 if at end of segment
if(begin < finish && player.currentTime >= finish){
player.setCurrentTime(begin);

The only caveat with this is that if the user wants to pause and restart the audio, they’d have to use the slider, but that’s the case with any audio, as the player does not have a restart button or function that I’ve found.