Ga naar hoofdinhoud
Logo Appt Light

Captions on React Native

Captions should be provided to enable users to understand what is being said in videos. Captions are a text based alternative for media, such as videos. The spoken dialogue and sound effects are displayed on screen as the video plays. Captions mostly benefit people who are deaf, hard of hearing, or deafblind. But captions are also useful to anyone who is temporarily unable to perceive sound, for example inside a library.

Met React Native kun je gebruik ondertiteling in de formaten .vtt.ttml en .srt gebruiken via de React-Native-Video package. We raden aan om gebruik te maken van .vtt omdat dit ondersteund wordt zowel Android en iOS.

import { TextTrackType, Video } from 'react-native-video';

<Video
    textTracks={[
        {
            title: "English CC",
            language: "en",
            type: TextTrackType.VTT,
            uri: "https://appt.org/subtitles/en.vtt"
        },
        {
            title: "Spanish Subtitles",
            language: "es",
            type: TextTrackType.SRT,
            uri: require('https://appt.org/subtitles/es.srt')
        }
    ]}
/>
Bijdragen

Feedback?

Laat 't ons weten!