Difference between revisions of "Interactivity"

From A-SMIL.org
Jump to: navigation, search
(Button Events: Updated with GPIO mapping)
m (Simplified example)
Line 1: Line 1:
 
Certain SMIL media appliances support buttons for triggering playlists when user provides interactive input.  
 
Certain SMIL media appliances support buttons for triggering playlists when user provides interactive input.  
 +
 +
== Button Events ==
 +
 +
With supporting hardware, external triggers can be programmed into SMIL using the <tt>accesskey</tt> event.
 +
 +
The following example illustrates playing different content when user presses one of the four buttons available. When the content runs, <tt>welcome.jpg</tt> is first played. When user pressed one of the four buttons, one of the four media items <tt>news.jpg</tt>, <tt>interest.jpg</tt>, <tt>exch.jpg</tt> or <tt>stock.jpg</tt> is played for 5 seconds.
 +
 +
<source lang="smil">
 +
<smil>
 +
  <head />
 +
  <body>
 +
    <excl repeatCount="indefinite">
 +
      <priorityClass>
 +
        <par begin="accesskey(GPI0);accesskey(A)" dur="5s">
 +
          <img src="news.jpg" dur="indefinite" fit="fill" />
 +
        </par>
 +
        <par begin="accesskey(GPI1);accesskey(B)" dur="5s">
 +
          <img src="interest.jpg" dur="indefinite" fit="fill" />
 +
        </par>
 +
        <par begin="accesskey(GPI2);accesskey(C)" dur="5s">
 +
          <img src="exch.jpg" dur="indefinite" fit="fill" />
 +
        </par>
 +
        <par begin="accesskey(GPI3);accesskey(D)" dur="5s">
 +
          <img src="stock.jpg" dur="indefinite" fit="fill" />
 +
        </par>
 +
      </priorityClass>
 +
      <priorityClass>
 +
        <par begin="0">
 +
          <img src="welcome.jpg" dur="indefinite" fit="fill" />
 +
        </par>
 +
      </priorityClass>
 +
    </excl>
 +
  </body>
 +
</smil>
 +
</source>
  
 
== Visual Clues ==
 
== Visual Clues ==
Line 26: Line 61:
 
The sample above turns the indicator lights on the touch buttons on for 2 seconds and off for 0.5 seconds, achieving a blinking visual effect to guide users to the buttons.
 
The sample above turns the indicator lights on the touch buttons on for 2 seconds and off for 0.5 seconds, achieving a blinking visual effect to guide users to the buttons.
  
== Button Events ==
+
== Combining Interactive Features ==
  
 
Buttons are programmed by allowing playlists to be triggered by <tt>accesskey</tt> events.  
 
Buttons are programmed by allowing playlists to be triggered by <tt>accesskey</tt> events.  

Revision as of 06:44, 18 May 2011

Certain SMIL media appliances support buttons for triggering playlists when user provides interactive input.

Button Events

With supporting hardware, external triggers can be programmed into SMIL using the accesskey event.

The following example illustrates playing different content when user presses one of the four buttons available. When the content runs, welcome.jpg is first played. When user pressed one of the four buttons, one of the four media items news.jpg, interest.jpg, exch.jpg or stock.jpg is played for 5 seconds.

<smil>
  <head />
  <body>
    <excl repeatCount="indefinite">
      <priorityClass>
        <par begin="accesskey(GPI0);accesskey(A)" dur="5s">
          <img src="news.jpg" dur="indefinite" fit="fill" />
        </par>
        <par begin="accesskey(GPI1);accesskey(B)" dur="5s">
          <img src="interest.jpg" dur="indefinite" fit="fill" />
        </par>
        <par begin="accesskey(GPI2);accesskey(C)" dur="5s">
          <img src="exch.jpg" dur="indefinite" fit="fill" />
        </par>
        <par begin="accesskey(GPI3);accesskey(D)" dur="5s">
          <img src="stock.jpg" dur="indefinite" fit="fill" />
        </par>
      </priorityClass>
      <priorityClass>
        <par begin="0">
          <img src="welcome.jpg" dur="indefinite" fit="fill" />
        </par>
      </priorityClass>
    </excl>
  </body>
</smil>

Visual Clues

Often indicator lights are available to inform the user that input is being accepted at the particular moment. Lights can be controlled using the adapi:lightControl pseudo content.

        <par>
 
          <seq>
            <!-- Foreground content here -->
          </seq>
 
          <seq repeatCount="indefinite">
            <ref src="adapi:lightControl" dur="2s">
              <param name="touchButton" value="on" />
            </ref>
            <ref src="adapi:lightControl" dur="0.5s">
              <param name="touchButton" value="off" />
            </ref>
          </seq>
 
        </par>

The sample above turns the indicator lights on the touch buttons on for 2 seconds and off for 0.5 seconds, achieving a blinking visual effect to guide users to the buttons.

Combining Interactive Features

Buttons are programmed by allowing playlists to be triggered by accesskey events.

The following example illustrates playing different content when user presses one of the four buttons available. When the content runs, welcome.jpg is first played and lights blink. When user pressed one of the four buttons, one of the four media items news.jpg, interest.jpg, exch.jpg or stock.jpg is played for 5 seconds, during which the lights are turned off.

<smil>
  <head />
  <body>
    <excl repeatCount="indefinite">
      <priorityClass>
        <par begin="accesskey(GPI0);accesskey(A)" dur="5s">
          <img src="news.jpg" dur="indefinite" fit="fill" />
          <ref src="adapi:lightControl" dur="indefinite">
            <param name="touchButton" value="off" />
          </ref>
        </par>
        <par begin="accesskey(GPI1);accesskey(B)" dur="5s">
          <img src="interest.jpg" dur="indefinite" fit="fill" />
          <ref src="adapi:lightControl" dur="indefinite">
            <param name="touchButton" value="off" />
          </ref>
        </par>
        <par begin="accesskey(GPI2);accesskey(C)" dur="5s">
          <img src="exch.jpg" dur="indefinite" fit="fill" />
          <ref src="adapi:lightControl" dur="indefinite">
            <param name="touchButton" value="off" />
          </ref>
        </par>
        <par begin="accesskey(GPI3);accesskey(D)" dur="5s">
          <img src="stock.jpg" dur="indefinite" fit="fill" />
          <ref src="adapi:lightControl" dur="indefinite">
            <param name="touchButton" value="off" />
          </ref>
        </par>
      </priorityClass>
      <priorityClass>
        <par begin="0">
          <img src="welcome.jpg" dur="indefinite" fit="fill" />
          <seq repeatCount="indefinite">
            <ref src="adapi:lightControl" dur="2s">
              <param name="touchButton" value="on" />
            </ref>
            <ref src="adapi:lightControl" dur="0.5s">
              <param name="touchButton" value="off" />
            </ref>
          </seq>
        </par>
      </priorityClass>
    </excl>
  </body>
</smil>