Techniques for WCAG 2.0

Skip to Content (Press Enter)

-

FLASH34: Turning off sounds that play automatically when an assistive technology is detected

Important Information about Techniques

See Understanding Techniques for WCAG Success Criteria for important information about the usage of these informative techniques and how they relate to the normative WCAG 2.0 success criteria. The Applicability section explains the scope of the technique, and the presence of techniques for a specific technology does not imply that the technology can be used in all situations to create content that meets WCAG 2.0.

Applicability

This technique relates to:

User Agent and Assistive Technology Support Notes

See User Agent Support Notes for FLASH34. Also see Flash Technology Notes.

Description

The intent of this technique is to prevent sounds from playing when the Flash movie loads. This is useful for those who utilize assistive technologies (such as screen readers, screen magnifiers, switch mechanisms, etc.) and those who may not (such as those with cognitive, learning and language disabilities). By default, the sound will be played automatically. When a screen reader such as JAWS is detected however, the sound will have to be started manually.

To perform screen reader detection, Flash provides the flash.accessibility.Accessibility.active property. If this property is set to true, it means that the Flash player has detected running assistive technology. Based on this flag, the Flash developer can choose to run different functionality.

Note 1: The Flash Player requires some time to detect active assistive technology and set the Accessibility.active property. To get accurate results, do not check for this property immediately on the first frame of the movie. Instead, perform the check 5 frames in or based on a timed event.

Note 2: Not every screen reader will be detected using this mechanism. In general, the property will be set to true when any MSAA client is running.

Note 3: Other assistive technology tools, including screen magnifiers, or tools not used as assistive technologies may also utilize MSAA in ways that result in Accessibility.active being set to true.

Examples

Example 1: A SoundHandler class

A class called SoundHandler is created which automatically starts playing an MP3 file only when Accessibility.active is set to false. Note that this example also checks the flash.system.Capabilities.hasAccessibility property. This property does not check whether a screen reader is running, but instead indicates whether the Flash Player is running in an environment that supports MSAA (which basically means the Windows operating system).

Example Code:

package wcagSamples {
  import flash.accessibility.Accessibility;
  import flash.display.Sprite;
  import flash.net.URLRequest;
  import flash.media.Sound;
  import flash.media.SoundChannel;
  import flash.system.Capabilities;
  import fl.controls.Button;
  import fl.accessibility.ButtonAccImpl;
  import fl.controls.Label;
  import flash.events.MouseEvent;
  
  public class SoundHandler extends Sprite {
    private var snd: Sound = new Sound();
    private var button: Button = new Button();
    private var req: URLRequest = new URLRequest(
      "http://av.adobe.com/podcast/csbu_dev_podcast_epi_2.mp3");
    private var channel: SoundChannel = new SoundChannel();
    private var statusLbl: Label = new Label();
    public function SoundHandler() {
      snd.load(req);
      ButtonAccImpl.enableAccessibility();
      button.x = 10;
      button.y = 10;
      statusLbl.autoSize = "left";
      statusLbl.x = 10;
      statusLbl.y = 40;
      addChild(statusLbl);
      button.addEventListener(MouseEvent.CLICK, clickHandler);
      this.addChild(button);
      if (! Capabilities.hasAccessibility || ! Accessibility.active) {
        channel = snd.play();
        button.label = "Stop Sound";
        statusLbl.text = "No Assistive technology detected. \
          Sound will play automatically";
      } else {
        button.label = "Start Sound";
        statusLbl.text = "Assistive technology detected. \
          Sound will not play automatically";
      }
    }
    private function clickHandler(e: MouseEvent): void {
      if (button.label == "Stop Sound") {
        button.label = "Start Sound";
        channel.stop();
      } else {
        channel = snd.play();
        button.label = "Stop Sound";
      }
    }
  }
}

This technique can be viewed in the working version of A SoundHandler class. The source of A SoundHandler class is available.

Resources

Resources are for information purposes only, no endorsement implied.

Tests

Procedure

  1. Start a screen reader that supports MSAA.

  2. Open a page containing a Flash movie that starts playing audio automatically when a screen reader is not running

  3. Confirm that the audio is stopped.

Expected Results

  1. #3 is true

If this is a sufficient technique for a success criterion, failing this test procedure does not necessarily mean that the success criterion has not been satisfied in some other way, only that this technique has not been successfully implemented and can not be used to claim conformance.