Hanish Sharma
Hanish Sharma

Reputation: 869

Show Timer while playing video using react-native-video

I have a requirement in my project to show timer when the video is playing. I know there are libraries available for this in React Native, but my requirement is to show the Timer below the video player. As the video progresses the time should decrease till the video gets finish. Please help me.

Thanks in advance :)

Upvotes: 1

Views: 2173

Answers (1)

Hanish Sharma
Hanish Sharma

Reputation: 869

Finally, I solved it by myself.

I just used the following approach:

<Video
          resizeMode={'contain'}
          style={{ height: 312 }}
          url={url}
          placeholder={"https://baconmockup.com/300/200/"}
          onProgress={e => this.progress(e)}
          ref={(ref) => { this.video = ref }}
        />

progress(e) {
    console.warn('Time' + parseInt(e.currentTime))
  }

I am using react-native-af-video-player and onProgress solved my purpose which is provided by react-native-video.

Upvotes: 2

Related Questions