最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

react player - ReactPlayer HLS Live Stream: How to Display the Correct Playing Clock Time? - Stack Overflow

programmeradmin5浏览0评论

I'm using ReactPlayer to play a live HLS video stream, and i want to display the current playing clock time. How do i do so?

What I've Tried:

I attempted to calculate the playing clock time using requestVideoFrameCallback combined with getCurrentTime() and getDuration() from ReactPlayer:

const currentPlayingClockTime = Date.now() - (duration - currentTime) * 1000

However, this approach is unreliable. The displayed time is inconsistent, sometimes running too fast and other times jumping back a few seconds.

Background:

  • The video source is an Ethernet camera streaming via RTSP.
  • I use MediaMTX to convert RTSP to HLS for playback in ReactPlayer.
发布评论

评论列表(0)

  1. 暂无评论