Author Message

Posted: Tue Oct 16, 2012 4:25 pm   Post subject: onPresentationPlaybackComplete event, iSpring Pro6.2

We have an issue with the onPresentationPlaybackComplete event within a modifed index.html file not firing for the AS3 Streamline player.

If you publish with player type Legacy - Lite, the event fires correctly. If you publish again, this time as Streamline - AS3, the event fails to fire. Looking 'behind' the scenes, the Legacy player code is very different to the AS3 code, as you would imagine. I have a vague suspicion that the linking method in the fsplayer.js file hasn't been updated (but I'm not 100% sure).

The legacy flash file has a valid function call within the code to the function "setEventListener", but the new AS3 flash code does not implement this function:

fsplayer calls:

Code:
var thisPtr = this;
   this.m_movie.playbackController_setEventListener("playbackListener_onPresentationPlaybackComplete", "fsplayer.api.PlaybackControllerEvents.PresentationPlaybackCompleteHandlers." + this.m_id);
   fsplayer.api.PlaybackControllerEvents.PresentationPlaybackCompleteHandlers[this.m_id] = function()
{
   thisPtr.onPresentationPlaybackComplete();
};


Here is my modified index.html file, that works with legacy lite player but not as3 streamline player:

Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
   <title>PowerPoint Presentation</title>
   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
   <script type="text/javascript" src="js/fsplayer.js"></script>
   <script type="text/javascript" src="lms.js"></script>
   <script type="text/javascript" src="js/swfobject.js"></script>
   <style type="text/css" media="screen">
      html, body, table, td
      {
         height: 100%;
      }
      html
      {
         background-color: #ffffff;
      }
      body
      {
         margin: 0px;
      }
      table
      {
         width: 100%;
         border-collapse:collapse;
      }
      td
      {
         padding: 0px;
         text-align: center;
      }
   </style>
</head>
<body>
   <table>
      <tr>
         <td id="movieContent"></td>
      </tr>
   </table>

   <script type="text/javascript">
      //<!--
      
      var loader = new fsplayer.api.PresentationLoader();
      
      // vars
      var lmsType = "2004";
      var debug = false;
      var lmsId = "lmsId";
      var quizzes = [];
      var rateSlidesCount = 16;
      var rateSlidesWeight = 1;
      var gradeTotalScore = 100;
      var gradePassingScore = 100;
      var limitTime = 0;
      var limitTimeShowMessage = false;
      var limitTimeExit = false;

        var limitTimeMessage = "You have exceeded available time.\n"
           + (limitTimeExit ? "The lesson will be interrupted." : "You may continue the lesson.");

      var quizzesInfo = [];
      for (var i = 0; i < quizzes.length; ++i)
      {
         quizzesInfo.push({
            index:  quizzes[i][0],
            weight: quizzes[i][1]
         });
      }

      if (debug)
      {
         document.write("<textarea id=\"iSpring_log\" style=\"width: 100%; height: 100px;\"></textarea><br>");
      }

      var lmsObject;
      var pc = null;

      var thisPtr = this;
      loader.onPlayerInit = function(player)
      {
         lmsObject = new iSpring.LMS(thisPtr.lmsId, thisPtr.lmsType, player,
               thisPtr.limitTime, thisPtr.limitTimeExit, thisPtr.limitTimeShowMessage, thisPtr.limitTimeMessage,
               thisPtr.quizzesInfo, thisPtr.rateSlidesWeight, thisPtr.rateSlidesCount,
               thisPtr.gradeTotalScore, thisPtr.gradePassingScore);

         window.onunload = function()
         {
            lmsObject.closeLms();
         }
         
         window.onbeforeunload = function()
         {
            lmsObject.closeLms();
         }
         
         pc = player.getPlaybackController();
         
         pc.enableAllEventHandlers();
         pc.onPresentationPlaybackComplete = playbackComplete;
      }
      loader.load("movie.swf", "movieContent", "newPlayerId", "722", "577");
      
      // function to handle playbackComplete event - D Forrest 29/3/12
      function playbackComplete()
      {
         // get all anchor tags
         anchors = parent.document.getElementsByTagName("a");
         var discoveredLink = "";
         
         // look through anchor tags, look for exit link
         for(i=0; i < anchors.length; i++)
         {
            if(anchors[i].title == "Exit activity")
            {
               // found exit link so get href
               discoveredLink = anchors[i].href;
            }
         }
         
         // if we found the link
         if(discoveredLink.length > 0)
         {
            // forward on browser
            parent.location.href = discoveredLink;
         }
         else
         {
            alert("Please click the 'Exit activity' link to return to the course menu.");
         }
      }
      
      // aicc
      function aiccDataFrameLoaded()
      {
         document.getElementById("aiccFrameLoaded").value = "1";
      }
      //-->
   </script>
   <input type="hidden" id="aiccFrameLoaded" name="aiccFrameLoaded" value="0" />
   <iframe id="aiccDataFrame" name="aiccDataFrame" src="empty.html" style="width:1px;height:1px;border:0px" onload="aiccDataFrameLoaded();"></iframe>
   <iframe id="target_frame" name="target_frame" src="empty.html" style="width:1px;height:1px;border:0px"></iframe>
   <iframe id="emptyFrame" name="emptyFrame" src="empty.html" style="width:1px;height:1px;border:0px"></iframe>
   <form id="aiccDataForm" name="aiccDataForm" method="POST" action="empty.html" target="aiccDataFrame">
      <input type="hidden" id="session_id" name="session_id" value="">
      <input type="hidden" id="command" name="command" value="">
      <input type="hidden" id="version" name="version" value="4">
      <input type="hidden" id="aicc_data" name="aicc_data" value="">
   </form>
</body>
</html>


Just to note: We are not trying this locally, it's on a server AND we HAVE ticked the 'Enable interaction with Javascript' option while publishing!!

Do I need to adjust my code for the AS3 Streamline player? Or, is the AS3 player wired differently, in which case, do iSpring need to modify the fsplayer.js event wirings?

Thanks in advance.

Dave


Profile profile test

Posted: Wed Oct 17, 2012 6:55 pm   Post subject: Re: onPresentationPlaybackComplete event, iSpring Pro6.2

There is a difference in how this onPresentationComplete event is generated in AS2 and AS3. On the last slide when last animation is completed onPresentationComplete is broadcasted in AS2 immediately, while in AS3 a user should click play button again to end the show and generate this event.

We have changed that because PowerPoint ends a show also on click after the last animation.

There is a workaround if you want to make it done in AS3 like in AS2:

You need to check for slide progress changes and when onSlidePositionChanged will be equal 1 it will mean that the presentation is ended. You can adjust your code based on this information to get the same behavior in AS3.


Profile profile test

Posted: Thu Oct 18, 2012 11:00 am   Post subject: Re: onPresentationPlaybackComplete event, iSpring Pro6.2

Thanks Mikhail,

From your answer I discovered a much simpler solution.

On the final slide, under the animations tab menu bar - Advance Slide, instead of ticking "On Mouse Click", set Automatically after to 1 second. Eureka!! The onPresentationPlaybackComplete event now fires in AS3 when the final slide is reached!!! Saves having to recode everything.

Thanks for your help.


Profile profile test

Posted: Thu Oct 18, 2012 12:13 pm   Post subject: Re: onPresentationPlaybackComplete event, iSpring Pro6.2

Great solution! Thank you for sharing it here.


Profile profile test
Display posts from previous:  Sort by  

  


Who is online
Who is online In total there are 2 users online :: 1 registered, 0 hidden and 1 guest (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: Google [Bot]


cron