WebRTC stream name overwrite

sulphur

Member
Hi,

Firt of all i'm new to flasphoner I previously used a lot of other media servers but now i think FP will be new prefered choice :)

I'm trying to build a homogenous strategy for protecting my broadcasters. I Use WebRTC and RTMP/OBS. I succeed to create a "Twitch like" experience where stram_name is used to authenticate the broadcaster so that I can start a broadcast by using the "restPolicy":"OVERWRITE" like here: https://docs.flashphoner.com/display/WCS5EN/Type+2+-+the+direct+invoke and renaming the stream name that is shown to end-users. So that they can't hijack the original stram name and start a broadcast as a broadcaster. this Works for my OBS with RTMP setup. However, I can't manage to make it work with WebRTC.

In WebRTC I receive the "StreamStatusEvent" with "status" => "PUBLISHING and the new stream name that I've renamed. However, on the client-side, the player doesn't play the video with a new name on my backend I receive a webhook with "status" => "PLAYING", but width => 0 and height 0. So in browser but I have no video and then eventually I receive another event with "info" => "Failed by RTP activity" and "status" => "FAILED" but correct "width" => 426, and "height" => 240. Maybe in WebRTC stream name is important and can't be changed? So my question is is it possible to make stream rename work with WebRTC? If not I will generate new stream name for each webrtc broadcast.
 

Max

Administrator
Staff member
Hello

Stream name replacement should work. We will check on our system.

Though it is not good practice. We would recommend to use unique stream name or at least use md5(stream name) if you want to hide real stream name.

Another way to hide stream name is re-publishing. You can clone stream to localhost and set a new stream name for this stream.

Code:
/pull/push

The side effect if you clone stream you have two streams with double resource usage instead of one.
 

sulphur

Member
Hello,

Thank you for your answer. I'm not sure if I understand correctly you're saying that having a unique stream name isn't good? Can you tell me why?
 

Max

Administrator
Staff member
Hello!
We checked the change of the stream name using the REST hook.
Unfortunately, the problem was confirmed. We raised the ticket WCS-2974 to fix it.

Sorry for the misunderstanding.
We recommend, if possible, not to use name substitution, but to publish the stream immediately with a unique name, for example, encrypted in md5
 

sulphur

Member
Ok, great :) that's what i thought but i wanted to be sure :) WebRTC is tricky sometimes that's way i wanted to be sure. I will use the unique stream for my webrtc side. As for RTMP either I will stick with stream name replacement or i will just add some custom/query params and make the authentication on "publishStream". Thank you for your help
 

Max

Administrator
Staff member
In the attached archive, a working script for the backend to replace the stream name.

The rest_client_config.json file specifies the policy for the "publishStream" method, overwrite the "name" field
1605256482486.png
 

Attachments

Top