Custom captions button with seamless play

jellis5612
jellis5612 Community Member Posts: 4
Seamless play seems to break everything that I've programmed in non-seamless courses and it's getting frustrating.  Anyway, I'd been using

if(document.getElementById(“mep_0_captions_none”).checked){
document.getElementById(“mep_0_captions_en”).click();
} else {
document.getElementById(“mep_0_captions_none”).click();
};

Of course with seamless play enabled this breaks.  So I changed the code up to

if(getDisplayDocument().getElementById("mep_0_captions_none").checked){
getDisplayDocument().getElementById("mep_0_captions_en").click();
} else {
getDisplayDocument().getElementById("mep_0_captions_none").click();
};

 

This works on the first page of the course, one time only.  All other pages give a null error.  When going back to the first page, it gives a null error as well.  So it's not finding the mep_0_captions.

 

Is there another element to target to do this?

 

Comments

  • timk
    timk Community Member Posts: 1,239 ✭ Legend ✭
    Where's your video located in the title explorer? Is it on chapter or title level?

    I just tested this in Lectora 17.1.4:

    My video is on chapter level.

    When I open the first page the caption buttons id is "mep_0_captions_none"

    When I go to the next page that also contains the video from chapter level the id is "mep_1_captions_none"

    When I return to the first page the id is "mep_2_captions_none"

    So it may not be able to find the button by id because it does not exist.

    When published without Seamless Play the id stays the same "mep_0_captions_none"

     
  • jellis5612
    jellis5612 Community Member Posts: 4
    Yeah, all the default controls were hidden with css and when I un-hid them, I could see that those id's get incremented with seamless play.  Using querySelector now to just search for part of the id that stays the same throughout and that's working (for now).