Skip to main content
WCAG 1.2.4 icon

Success Criterion 1.2.4 - Level AA

Captions (Live)

Ensure real-time captions are 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

Live captions - Android

On Android, we recommend using a library such as Media3, also known as ExoPlayer, to support live captions. Media3 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 Camera & Media dev center. You can use DefaultTrackSelector in combination with DefaultHttpDataSource.Factory to show subtitles.

val trackSelector = DefaultTrackSelector(baseContext).apply {
setParameters(buildUponParameters().setPreferredTextLanguage("nl"))
}
val player = ExoPlayer.Builder(context)
.setTrackSelector(trackSelector)
.build()
val dataSourceFactory = DefaultHttpDataSource.Factory()
.setUserAgent(Util.getUserAgent(context, "Appt"))
.setAllowCrossProtocolRedirects(true)

val mediaUri = Uri.parse("https://appt.org/live-video")
val mediaSource = HlsMediaSource.Factory(dataSourceFactory)
.createMediaSource(MediaItem.fromUri(mediaUri))

player.setMediaSource(mediaSource)
player.prepare()
player.playWhenReady = true

Resources