Playing media only the first time a page is entered

MINI LESSONS ›› Media Players ››

MINI LESSON

PLAYING MEDIA ONLY THE FIRST TIME A PAGE IS ENTERED

If you turn on the Auto Start feature of a media player, this tells ToolBook to play the media every time you enter the page.


What if you don't want it to play every time? What if you only want it to play the first time the page is visited, but then never again for that user?


This Mini Lesson will demonstrate one way to accomplish this.


OVERVIEW

Below is a brief overview of how this will be accomplished.


  1. For this example a Universal Media Player will be used
  2. Turn OFF the Auto Start feature for the media player
  3. Use the Actions Editor to tell the media player when to play


STEP 1: Turning off the Auto Start

Ensure that the Auto Start feature of the media player is turned off. This will prevent it from automatically starting when the page is entered.


 


STEP 2: Defining a Global Variable

In order to keep track of whether or not ToolBook has already played the media, a Global Variable needs to be configured.


Before you can define a new Global Variable, first you must open the Actions Editor by doing the following:


  1. Select your Universal Media Player object
  2. From the OBJECT menu of ToolBook, choose Actions...


 


To define the new Global Variable, we need to first decide on an appropriate name for the variable. For this example a variable named FireSafetyHasPlayed will be used, and will be set to either true (meaning it has already played), or false (meaning it has not yet played).


  1. From the Actions Editor menus, choose Action | Define Variables...
  2. Use the Global Variables tab to define the new variable
  3. Ensure the Save Variable's Value To LMS Between Sessions option is turned ON
  4. Ensure the Initial Value is set to false


 


STEP 3: Adding the Actions Editor Logic

Since the Auto Start feature has been intentionally turned off, a few lines of Actions Editor logic will need to be written in order to tell ToolBook when to (and when not to) play the media.


Before you add the logic, first you must open the Actions Editor:


  1. Select your Universal Media Player object
  2. From the OBJECT menu of ToolBook, choose Actions...


The Event we need to work with is On Load Page. It is very likely that the On Load Page event will not be currently showing.


In order to choose On Load Page, click on the current event name and a list of other events will display, allowing you to choose the On Load Page.


 


Add the following logic to complete the task


 



Created with the Personal Edition of HelpNDoc: Easily create EPub books