Difference between revisions of "Interactivity"

From A-SMIL.org
Jump to: navigation, search
(Created)
 
(Button Events: Updated with GPIO mapping)
Line 38: Line 38:
 
     <excl repeatCount="indefinite">
 
     <excl repeatCount="indefinite">
 
       <priorityClass>
 
       <priorityClass>
         <par begin="accesskey(2);accesskey(A)" dur="5s">
+
         <par begin="accesskey(GPI0);accesskey(A)" dur="5s">
 
           <img src="news.jpg" dur="indefinite" fit="fill" />
 
           <img src="news.jpg" dur="indefinite" fit="fill" />
 
           <ref src="adapi:lightControl" dur="indefinite">
 
           <ref src="adapi:lightControl" dur="indefinite">
Line 44: Line 44:
 
           </ref>
 
           </ref>
 
         </par>
 
         </par>
         <par begin="accesskey(4);accesskey(B)" dur="5s">
+
         <par begin="accesskey(GPI1);accesskey(B)" dur="5s">
 
           <img src="interest.jpg" dur="indefinite" fit="fill" />
 
           <img src="interest.jpg" dur="indefinite" fit="fill" />
 
           <ref src="adapi:lightControl" dur="indefinite">
 
           <ref src="adapi:lightControl" dur="indefinite">
Line 50: Line 50:
 
           </ref>
 
           </ref>
 
         </par>
 
         </par>
         <par begin="accesskey(6);accesskey(C)" dur="5s">
+
         <par begin="accesskey(GPI2);accesskey(C)" dur="5s">
 
           <img src="exch.jpg" dur="indefinite" fit="fill" />
 
           <img src="exch.jpg" dur="indefinite" fit="fill" />
 
           <ref src="adapi:lightControl" dur="indefinite">
 
           <ref src="adapi:lightControl" dur="indefinite">
Line 56: Line 56:
 
           </ref>
 
           </ref>
 
         </par>
 
         </par>
         <par begin="accesskey(8);accesskey(D)" dur="5s">
+
         <par begin="accesskey(GPI3);accesskey(D)" dur="5s">
 
           <img src="stock.jpg" dur="indefinite" fit="fill" />
 
           <img src="stock.jpg" dur="indefinite" fit="fill" />
 
           <ref src="adapi:lightControl" dur="indefinite">
 
           <ref src="adapi:lightControl" dur="indefinite">

Revision as of 10:56, 29 April 2011

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

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.

Button Events

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>