Add stream currentTime to Stream class

PhoneBot

New Member
I use the command below for getting RTMP stream start time.
ffprobe -i rtmp://127.0.0.1:80/internal/FIRST -rtmp_buffer 0 -rtmp_live live -v quiet -print_format json -show_format
And I am using 'currentTime' property from the video tag to calculate a video delay.
https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/currentTime
However, I can not find 'currentTime' property for IOS as I use WSPlayer, but I guess the current time is somewhere in the video.
So I hope someone can show me the way to get it. Thanks.
 

Max

Administrator
Staff member
Good day.
The browser sets the currentTime property based on timestamps in video, relative to video playback beginning. This is intended primarily for navigation purposes.
So please clarify what kind of delay you trying to calculate on frontend?
 

PhoneBot

New Member
Hello Max,
We are trying to synchronize messages from the server with video. So we dynamically calculate the video delay by the next algorithm:
- Use ffprobe to read start_time property from a core server(the client should be on the same server as core).
- We send it to our backend and store it with a timestamp of the request.
- Frontend requested this data from our backend and from a video tag you can subtract these two value and get your delay.
Of course, you need to think about time synchronization.
And we use this approach pretty well with another WebSocket implementation, but for IOS we can only use Flashphoner. We found AudioContext into WSPlayer, but it currentTime property starts from 0.
So I hope you can take the original value from RTMP and set it into a video tag.
Thanks.
 

Max

Administrator
Staff member
Good day.
WebRTC is supported since iOS Safari 11, so currentTime tag should be available on iOS devices which can be upgraded to actual iOS versions.
WSPlayer is a solution for older iOS versions which move to end of support gradually, so WSPlayer tweaking is advisable if you have a lot of customers with old iOS devices.
 
Top