Difference between revisions of "Interactivity"

From A-SMIL.org
Jump to: navigation, search
(Visual Clues)
(Visual Clues)
Line 69: Line 69:
 
Often indicator lights are available to inform the user that input is being accepted at the particular moment. Lights can be controlled using the <tt>adapi:lightControl</tt> pseudo content.
 
Often indicator lights are available to inform the user that input is being accepted at the particular moment. Lights can be controlled using the <tt>adapi:lightControl</tt> pseudo content.
  
When controlling device's touch button indicators, specify <tt>touchButton</tt> as the parameter to the pseudo content. For IAdea player XDS-1060/1062 which has 6 touch buttons, use <tt>touchButton<i>A</i></tt>, <tt>touchButton<i>B</i></tt>, <tt>touchButton<i>C</i></tt>, <tt>touchButton<i>X</i></tt>, <tt>touchButton<i>Y</i></tt> and <tt>touchButton<i>Z</i></tt> for buttons 1 to 6, respectively.
+
When controlling device's touch button indicators, specify <tt>touchButton</tt> as the parameter to the pseudo content. For IAdea player XDS-1060/1062 which has 6 touch buttons, use <tt>touchButton<i>A</i></tt>, <tt>touchButton<i>B</i></tt>, <tt>touchButton<i>C</i></tt>, <tt>touchButton<i>X</i></tt>, <tt>touchButton<i>Y</i></tt> and <tt>touchButton<i>Z</i></tt> for buttons 1 to 6 respectively.
  
 
When controlling general-purpose output ports, use <tt>GPO<i>n</i></tt> where <i>n</i> matches the number of the output port.
 
When controlling general-purpose output ports, use <tt>GPO<i>n</i></tt> where <i>n</i> matches the number of the output port.

Revision as of 09:07, 20 January 2014

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

Motion Events

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

The following example illustrates that when the content runs, welcome.jpg is first played. When user passed by the motion sensor, the motion media items discount.jpg is played for 5 seconds

<smil>
  <head />
  <body>
    <excl repeatCount="indefinite">
      <priorityClass higher="stop" lower="never">
        <par begin="accesskey(AUDIENCE)" end="audience_pl.endEvent" restart="whenNotActive">
	     <seq xml:id="audience_pl">
                <img src="discount.jpg" dur="5s" fit="fill" />
             </seq>
        </par>
      </priorityClass>
      <priorityClass higher="stop">
        <par begin="0">
          <img src="welcome.jpg" dur="indefinite" fit="fill" />
        </par>
      </priorityClass>
    </excl>
  </body>
</smil>

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 higher="stop" lower="never">
        <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.

When controlling device's touch button indicators, specify touchButton as the parameter to the pseudo content. For IAdea player XDS-1060/1062 which has 6 touch buttons, use touchButtonA, touchButtonB, touchButtonC, touchButtonX, touchButtonY and touchButtonZ for buttons 1 to 6 respectively.

When controlling general-purpose output ports, use GPOn where n matches the number of the output port.

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

The sample above turns the indicator lights on the touch buttons and pin #1 of the GPIO board 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 higher="stop" lower="never">
        <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>