Author Message

Posted: Tue Apr 16, 2013 3:59 pm   Post subject: Getting completion status from Javascript

Hi,
I have converted one PPT file to HTML5.
how can I get completion status from presentation??
Can I modify player.js and set a global variable which I can access from parent window, I am embedding this presentation within iframe and I want to set an action on completion of presentation.


Profile profile test

Posted: Tue Apr 16, 2013 5:42 pm   Post subject: Re: Getting completion status from Javascript

There is no HTML5 API ready yet so you cannot get a status of completion in the current iSpring 7 version. Player.js code is obfuscated and therefore indecipherable so modifications couldn't be made.

All I can suggest at this point is to wait till the official iSpring Platform 7 release closer to the end of this year.


Profile profile test

Posted: Wed May 15, 2013 3:53 pm   Post subject: Re: Getting completion status from Javascript

It's a bit of a hack but I use this code to find when a presentation is complete (uses jQuery but it could be done without). Put it in the parent HTML script so you don't need to modify anything generated by iSpring.

Code:
     setTimeout(function() {
        iframe = $('#html5trainingframe').contents();

        var playbtn = iframe.find('button.play');
        var nextbtn = iframe.find('button.next');

        var check_if_finished = setInterval(function () {
            if (playbtn.is(':disabled') && nextbtn.is(':disabled')) {
                clearInterval(check_if_finished);
                alert('Presentation complete.');
            }
        }, 500);
    }, 10000);

What it does is it waits 10 seconds before starting any checks, just to make sure everything is loaded. Then it will regularly look at both the play button and next slide button. If both buttons are disabled then we know the presentation is at the end.


Profile profile test

Posted: Thu May 16, 2013 8:04 am   Post subject: Re: Getting completion status from Javascript

@Mark, thank you for your idea and code sample. It's a great workaround for now!

Please mention that iSpring 7 has several navigation scenarios in Playback and Navigation settings: Free, Limited and Forward only. Two of them (except Free) disable Forward button at the very beginning so your script will treat this presentation as finished.

Free navigation is a default setting though and unless a user changes it, your example will function just fine.


Profile profile test
Display posts from previous:  Sort by  

  


Who is online
Who is online In total there are 5 users online :: 0 registered, 0 hidden and 5 guests (based on users active over the past 5 minutes)
Most users ever online was 108 on Thu Nov 21, 2013 3:41 pm

Registered users: No registered users