Skip to main content
Logo Appt Light

Success Criterion 1.2.4 - Level AA

Captions (Live)

Real-time captions must be available for all live videos with audio. This allows people who need subtitles to directly access the spoken information.

Impact

  • People who are deaf or hard of hearing want to be able to understand what is being said during live videos.

Check

Are real-time captions available for live videos?”

This can be tested visually, no assistive technologies are needed.

Solution

The challenge with live captions is both organizational and technical. A captioner must be present who can provide real-time captions for the video by using appropriate software.

Add live captions

On Android, we recommend using a library such as ExoPlayer to support live captions. ExoPlayer is developed by Google and is an open-source alternative to Android's MediaPlayer for audio and video playback. Many code examples can be found in the ExoPlayer documentation. You can use DefaultTrackSelector in combination with DefaultHttpDataSourceFactory to show subtitles.

val trackSelector = DefaultTrackSelector(baseContext)
trackSelector.setParameters(
    trackSelector.buildUponParameters().setPreferredTextLanguage("nl")
)
val exoPlayer = SimpleExoPlayer.Builder(baseContext)
                    .setTrackSelector(trackSelector)
                    .build()
val dataSourceFactory: DataSource.Factory = DefaultHttpDataSourceFactory(
    Util.getUserAgent(baseContext, "Appt"),
    null,
    DefaultHttpDataSource.DEFAULT_CONNECT_TIMEOUT_MILLIS,
    1800000,
    true
)
val mediaUri = Uri.parse("https://appt.org/live-video")
val mediaSource = HlsMediaSource.Factory(dataSourceFactory).createMediaSource(mediaUri)
exoPlayer.prepare(mediaSource)

Resources

Feedback?

Let us know!