Add delay to player

Azhar Ali

Member
Hi,
We stream single room using chatrooms. It's audio only.
We want to give out free version to our users but with one min delay. Is that possible?
So some users gets audio live and some gets with a min delay

Thanks for the help
 

Max

Administrator
Staff member
Good day.
You can not add any delay to realtime stream unless channel bandwith is too bad.
But you can for example stop playing the stream for free users after some time and display some banner. This should be done on client browser side.
Another way is to record live stream with 1 minute rotation
Code:
record_rotation=60
then copy recording files with hook script to WCS_HOME/media folder and play those recordings as VOD to free users. Again, you should do some work on frontend to play recordings continuously, one by one.
 

Azhar Ali

Member
Hi Max,

Would there any proper solution to allow a delay setting for some users? Its quite an important requirement for us and if this can be added in the roadmap that would be great.

Your suggested recording solution seems, it might work for some but just doesn't seem robust enough to rely on it especially with autoplay policy of browsers blocking.

Anything else you can think of to delay stream to set of users by 3-4 of seconds?
Anything around connect them to different node which can have a delay?
 

Azhar Ali

Member
Hi Max,

We tried switching to TCP and it didn't make much difference. Latency was still sub-second.

Could something like this work:
- We stream over WebRTC and also to WCS rtmp URL (same server)
- then can we force the player to play using webrtc but using the source stream from RTMP.
- Would that add few seconds delay?
- Would the above can work if we host another WCS server and stream to RTMP of that server and than based on user subscription play from one or the other?

Not sure if thats possible?

We have developed our own player using the Web SDK so can't use embed player.
 

Max

Administrator
Staff member
Good day.
- then can we force the player to play using webrtc but using the source stream from RTMP.
- Would that add few seconds delay?
Yes, if you publish RTMP stream and play it as WebRTC, it should add some delay.
- Would the above can work if we host another WCS server and stream to RTMP of that server and than based on user subscription play from one or the other?
Yes, it should work.
 

Azhar Ali

Member
Code:
session.createStream({
        name: streamId,
        display: document.getElementById('media-publisher'),
        record: false,
        constraints: constraints,
        rtmpUrl: YTRTMPURL
    })....
How do you force to play rtmp stream? In the above code, we just pass the streamName and if the server is the same, would it not play webrtc to webrtc? Its the same server which is publishing via WebRTC to WebRTC + RTMP but in some cases we want to do WebRTC - > WebRTC and for purpose of delay play WebRTC - > RTMP.

Or is that only possible with another WCS server?
 

Max

Administrator
Staff member
We stream over WebRTC and also to WCS rtmp URL (same server)
If it means that the WebRTC stream is republished as RTMP, then there are two different streams with different names. So, which stream will be played would depend on the name specified for playback.
 

Azhar Ali

Member
Hi Max,

I checked the flashphoner.properties and its setup as
Code:
rtmp_transponder_stream_name_prefix =rtmp_
rtmp_transponder_full_url=true
Testing demo.flashphoner.com
Using the WebRTc as RTMp example, streamed with the streamName xyz
Tried to play the stream as rtmp_xyz using the player example.
Works fine.

Testing on server
Using the WebRTc as RTMp example, streamed with the streamName xyz
Tried to play the stream as rtmp_xyz using the player example.
Stream does not play.
Tried to play again using full url as the stream Name rtmp://wcs-server:1935/live/xyz
Works fine.


So my question is, any reason why its different on how it works on demo and our server?
Should I not expect some delay playing rtmp using webrtc? In all the examples where it worked, there was no delay.

We running out of options to add the delay to our free service and would greatly appreciate some input


Have you got any plans to support playoutDelayHint
 

Max

Administrator
Staff member
So my question is, any reason why its different on how it works on demo and our server?
On demo.flashphoner.com, the default settings are used:
Code:
rtmp_transponder_stream_name_prefix =rtmp_
rtmp_transponder_full_url=false
When you enable rtmp_transponder_full_url=true, the stream name is taken from publishing URL as is. That's the difference.
Should I not expect some delay playing rtmp using webrtc? In all the examples where it worked, there was no delay.
If you're streaming audio only (that's your case, right?), you can try to publish RTMP stream from OBS Studio or another streaming application that can add delay to audio.
So publisher should use 2 different microphones, OBS or another RTMP streamer to publish RTMP with delay and browser to publish WebRTC without delay. In this case, additional WebRTC as RTMP republishing is not needed.
 
Top