Ga naar hoofdinhoud
Logo Appt Light

Audio description on Flutter

Videos should include audio description when important visual details are shown which you cannot hear. Audio description is an additional sound track which describes these important visual details. This allows people who are blind or have difficulty processing visual information to understand the content.

With Flutter, you can use better_player to let users select different audio tracks.

The code example belows shows a basic implementation of changing audio tracks.

BetterPlayerController controller = BetterPlayerController(
    const BetterPlayerConfiguration(
      controlsConfiguration: BetterPlayerControlsConfiguration(
        enableAudioTracks: true,
      ),
    ),
    betterPlayerDataSource: BetterPlayerDataSource.file(
      'assets/appt.mp4',
      useAsmsSubtitles: true,
    ),
  );

void changeAudioTrack(int track) {
  if (controller.betterPlayerAsmsAudioTracks?[track] != null) {
    controller.setAudioTrack(controller.betterPlayerAsmsAudioTracks![track]);
  }
}

@override
Widget build(BuildContext context) {
  return BetterPlayer(controller: controller);
}
Bijdragen

Feedback?

Laat 't ons weten!