Creating HTML5 Content With Sample Template

In order to best use the capacities of the Splash Player, some types of content should be created using the following template. This allows the player to preload content, pause if necessary, detect if spots should be skipped, report diagnostic information, etc.

If the web page has any sound or animation, these should be paused on page load. The following functions should be exposed as global JavaScript functions:

Function Description
Play Called when the web page is shown by the player. The page should start its animations, play its sounds, etc.
Pause Called when the player needs to interrupt playback. The page should pause its animations and sounds, and wait for a Play call to resume them. The player can be instructed to skip the spot entirely and provide diagnostics information for why it skipped the spot. To do this, refer to Skipping HTML-Based Spots.
Skipping Spots The player can be instructed to skip the spot entirely and provide diagnostics information fo why it skipped the spot.

An Example

location.xml

If the user wants to access location.xml or location_formal.xml from an HTML file, the following example can be useful:

Copy
// Loads the Face Number from the xml file
     function loadLocationFile()
     {
       $.ajax(
       {
          url: "formal_location.xml",
          success: afterLoadLocationFile,        
          dataType: "text",        
          error: function(data)        
          {        
               document.title = 'skip:Error loading location file';        
               console.log('Error loading location file: ' + data.statusText);
          }            
});            
}            
// Parses the Face Number from the loaded xml file
function afterLoadLocationFile(xmlString)            
     faceNumber = xmlString.match(/<FaceID>(.*)<\/FaceID>/)[1];            
     if (faceNumber == null)            
     {            
console.log('Error reading Face data from Location File');            
     }            
     else            
     {
     console.log('Face Number: ' + faceNumber);            
     }            
}

See Also: