TypeError with Closed Captioning & Cornerstone On-Demand

schapman1885
schapman1885 Community Member Posts: 53
I have several courses to which I have added closed captions using the WebVTT method. I use a button to all the learner to turn the CC on/off. Tested in scorm cloud, works like a champ. Client loaded into SCOD and we're getting a

[OnMClkRunJS] TypeError: Cannot read property 'click' of null

Error on the button to turn the CC on/off.

The button performs the following:

1)Shows button to turn off CC

2) Hides itself

3) runs JS:

var mePl = parent.document.getElementsByClassName("mejs-container")[0].id;
var mePlId = mePl + "_captions_en";

parent.document.getElementById(mePlId).click();

4) Sets flag to know that CC is On, for use on following pages (if they have video to turn CC on accordingly.)

 

The course is published with: SCORM 1.2, seamless play on, responsive off.  I'm not sure where to go from here.

 

Comments

  • schapman1885
    schapman1885 Community Member Posts: 53
    Update: still having the issue. Seems like part of the problem may be that the LMS has a content type server... so the code resides on one server and runs on another. That's all I've gotten so far. Any help would be appreciated.
  • timk
    timk Community Member Posts: 1,236 ✭ Legend ✭
    Very difficult to troubleshoot if it only happens in the LMS and I don't know Cornerstone. It seems like the JS can't find the radio button to click. You could try to use getDisplayDocument() instead of "parent.document". You could also try to get the butttons directly. As long as you have only one video the ids will always be the same:

    getDisplayDocument().getElementById("mep_0_captions_en").click();
  • carlfink
    carlfink Community Member Posts: 1,099 ✭ Legend ✭
    I'm not an expert, but as a security thing some browsers will block JS from servers other than the one serving the page (XSS=Cross-Site Scripting is a potential security point of failure). Could that be the issue here?
  • klaatu
    klaatu Community Member Posts: 986 ☆ Roadie ☆
    Why are you loading jQuery (and a very old version at that)?
  • mnotermans5114
    mnotermans5114 Community Member Posts: 916 ☆ Roadie ☆
    COD has a setting for IE-compatibility. If thats set to a too low version, Javascript among other things will fail. Doublecheck what IE-comp setting it has, and ensure it is at least IE-11 compatible.
  • schapman1885
    schapman1885 Community Member Posts: 53
    First, thanks to everyone who responded.

    It seems that the error was.... the client didn't move the .vtt file associated with the closed captions to the LMS server and their server didn't recognize the MIME type.  Anyway, we've gotten past this hoop.  Now, on to why we cannot run these on mobile devices (ipad, iphone android).

    mnotermans.... any ideas on a mobile device deployment. I get a light blue screen and then nothing.

    Klaatu - not a good answer, but, I will research this. Do you think I don't need to load it at all or a newer version?

    CarlFink - yes!! This is probably the issue.

    timk - I have different videos in some of my .awts and noticed that the id changed every time I went back into a page, so I was trying to pick it up each time I needed it.
  • mnotermans5114
    mnotermans5114 Community Member Posts: 916 ☆ Roadie ☆
    You might wanna try put seamless off and test that on mobile. Just to see whether thats the issue it aint playing on mobiles. A sample to test would be good.
  • schapman1885
    schapman1885 Community Member Posts: 53
    Math, it is a problem with the seamless play. Unfortunately, the course design really requires the seamless play.

    So, the issue is... similar to the one described here for Lectora Online:

    http://community.trivantis.com/knowledge-base/containing-containers-custom-javascript-suggestions-lectora-online/

    You can't use window.top in COD... it freaks out. I changed the reference in the trivantis.js to window.parent...and off we go, it works as expected in scorm cloud, now to test on COD... I don't really like overwriting files like this...but, we've done some really thorough troubleshooting and were able to isolate exactly where the issue occurs.  So, it's hard to ignore....
  • timk
    timk Community Member Posts: 1,236 ✭ Legend ✭
    Did you try the code I posted above? It should work with seamless play.
  • schapman1885
    schapman1885 Community Member Posts: 53
    They added the .vtt document to the LMS and updated the MIME types...then, it worked. Once they moved it to an area that I could see, I was able to determine that they hadn't included the closed caption file... the button was working and executing part of the actions, just couldn't turn the CC on.
  • jasonadal
    jasonadal Community Member Posts: 448 ♪ Opening Act ♪
    I encountered a similar issue when I published to Pathlore. All of my captions were in SRT (which is the only option for output from Camtasia) and Pathlore was not picking up the captions. I tried XML and that worked like a charm, so I wonder if Pathlore has the same "limitation".

    If you do ever want to convert to XML, I found a great site (SRT to XML for JW Player) - the only drawback is that you can only do one at a time. When I use it, I add a checkmark to No CDATA, as it's easier to read in case I need to make edits.