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.1 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.1.

Applicability

Note

Adobe has plans to stop updating and distributing the Flash Player at the end of 2020, and encourages authors interested in creating accessible web content to use HTML.

This technique relates to Success Criterion 1.4.2: Audio Control (Sufficient).

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

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.

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.

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).

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