0.1.1 • Published 4 years ago

react-native-interactive-transcripts v0.1.1

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

react-native-interactive-transcripts

Interactive Transcripts support in the react native. Supports (WEBVTT) , as of now (Work in progress)

Installation

npm install react-native-interactive-transcripts

Input Props

ProptypeDescription
currentDurationnumber (required)Pass in the current duration of the Video
urlString (required)Url of the VTT file
textStylestyleObject (optional)Style for the Text in transcript
textContainerStylestyleObject (optional)Style for the Text Container
contentContainerStylestyleObject (optional)Style for the Content(list)
activeTranscriptColorstring (optional)active Transcript color
inactiveTranscriptColorstring (optional)inactive Transcript color

Callback

callBackreturnDescription
seekToTranscriptDurationnumberUsing this is callback value, seek your player to the particular transcript duration

Usage

You can use the Transcripts with any player,example below is using - react-native-video

import InteractiveTranscripts from "react-native-interactive-transcripts";

// ...

<View style={styles.container}>
      <Video
        ref={(ref) => {
          player = ref; // player ref
        }}
        style={{ width: '100%', height: '30%', backgroundColor: 'skyblue' }}
        source={{
          uri:
            'https://html5multimedia.com/code/media/elephants-dream-medium.mp4',
        }} // Can be a URL or a local file.
        onProgress={progressCallback}
      />
      <InteractiveTranscripts
        currentDuration={duration}
        url={
          'https://html5multimedia.com/code/ch8/elephants-dream-subtitles-en.vtt'
        }
        seekToTranscriptDuration={(time) => { 
          player.seek(time); // seek to the clicked transcrpit start duration .
        }}
      />
    </View>
>

##Demo

Alt DEMO

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT