subtitle doesn't show in react-native-video

60 views Asked by At

i try to use react-native-video to play video with subtitle but unfortunately subtitle dosen't show

import React, {useEffect, useState, useRef} from 'react';
import {ScrollView, View, SafeAreaView, Text, Button} from 'react-native';
import Video, {TextTrackType} from 'react-native-video';
import {useWindowDimensions} from 'react-native';

export default function Player({navigation}) {
const videoRef = useRef(null);

return (
<SafeAreaView\>
<Video
textTracks={[
{
title: 'English 1',
index: 0,
language: 'en',
type: TextTrackType.VTT,
uri: 'https://bitdash-a.akamaihd.net/content/sintel/subtitles/subtitles_en.vtt',
},
{
title: 'English 2',
index: 1,
language: 'en',
type: TextTrackType.VTT,
uri: 'https://brenopolanski.github.io/html5-video-webvtt-example/MIB2-subtitles-pt-BR.vtt',
},
]}
source={{
uri: 'https://www.w3schools.com/html/mov_bbb.mp4',
}}
ref={videoRef}
repeat={true}
resizeMode="contain"
controls={true}
captionsVisible={true}
selectedTextTrack={{
type: 'index',
value: 0,
}}
\>
</SafeAreaView\>
);
}

i try to use react-native-video to play video with subtitle but unfortunately subtitle dosen't show

0

There are 0 answers