Stream from Zoom

jasonkc

Member
I learn that Zoom allows user to stream to custom platform, wonder if i could configure it stream to my webrtc server, if so, how?
 

Attachments

jasonkc

Member
Don't I need to create a session with a designated stream ID in Webrtc server before I could stream to it?

I believe I would hv to modify the following code to start the stream, but wonder how do i update it to just start a stream, but not taking local VIDEO as source:

function publishBtnClick() {
if (validateForm()) {
$(this).prop('disabled', true);
if (Browser.isSafariWebRTC()) {
Flashphoner.playFirstVideo(localVideo, true, PRELOADER_URL).then(function() {
start();
});
return;
}
start();
}
}

function start() {
//check if we already have session
if (Flashphoner.getSessions().length > 0) {
startStreaming(Flashphoner.getSessions()[0]);
} else {
//create session
var url = field('url');
console.log("Create new session with url " + url);
Flashphoner.createSession({urlServer: url}).on(SESSION_STATUS.ESTABLISHED, function(session){
//session connected, start streaming
startStreaming(session);
}).on(SESSION_STATUS.DISCONNECTED, function(){
setStatus(SESSION_STATUS.DISCONNECTED);
$('#url').prop('disabled', false);
onStopped();
}).on(SESSION_STATUS.FAILED, function(){
setStatus(SESSION_STATUS.FAILED);
$('#url').prop('disabled', false);
onStopped();
});
}
}

function startStreaming(session) {
var streamName = field("streamName");
var rtmpUrl = field("rtmpUrl");
session.createStream({
name: streamName,
display: localVideo,
cacheLocalResources: true,
receiveVideo: false,
receiveAudio: false,
rtmpUrl: rtmpUrl
}).on(STREAM_STATUS.PUBLISHING, function(publishStream){
setStatus(STREAM_STATUS.PUBLISHING);
onStarted(publishStream);
sendDataToPlayer();
}).on(STREAM_STATUS.UNPUBLISHED, function(){
setStatus(STREAM_STATUS.UNPUBLISHED);
//enable start button
onStopped();
}).on(STREAM_STATUS.FAILED, function(){
setStatus(STREAM_STATUS.FAILED);
//enable start button
onStopped();

}).publish();
}
 
Last edited:

Max

Administrator
Staff member
Don't I need to create a session with a designated stream ID in Webrtc server before I could stream to it?
You should establish websocket session before publishing a stream because websocket is used for SDP excahnge to establish a WebRTC connection
I believe I would hv to modify the following code to start the stream, but wonder how do i update it to just start a stream, but not taking local VIDEO as source:
A browser uses local HTML5 video tag to capture video from web camera. So you can't do without local video as source in case of WebRTC streaming.
But you can also capture a stream on server from RTSP, RTMP or VOD source.
 

jasonkc

Member
I use the following command to start the RTMP pull:

/usr/bin/curl -X POST "http://127.0.0.1:8081/rest-api/pull/rtmp/pull" -H "Content-Type:application/json" -d '{"uri":"rtmp://127.0.0.1/live/10003","localStreamName":"test","record":"false"}'


Whats the command to find the session and terminate it? I have tried the following, but no luck:

/usr/bin/curl -X POST "http://127.0.0.1:8081/rest-api/pull/rtmp/find_all"
/usr/bin/curl -X POST "http://127.0.0.1:8081/rest-api/pull/find_all"

/usr/bin/curl -X POST "http://127.0.0.1:8081/rest-api/pull/rtmp/terminate" -H "Content-Type:application/json" -d '{"uri":"rtmp://127.0.0.1/live/10003"}'
/usr/bin/curl -X POST "http://127.0.0.1:8081/rest-api/pull/terminate" -H "Content-Type:application/json" -d '{"uri":"rtmp://127.0.0.1/live/10003"}'

I have tried on port 9091 too....still does not work.
 

Max

Administrator
Staff member
i) Create a rtmp session in webrtc server with a stream name
ii) stream from Zoom to above RTMP session using the same stream name
You don't need to create RTMP session before publishing RTMP to WCS. Just use such URL
Code:
rtmp://wcs:1935/live/test
and stream test will be published to WCS. Please read details here.
 

Max

Administrator
Staff member
Is there a way to kill by stream name?
1. Find stream by name
Code:
POST /rest-api/stream/find HTTP/1.1
Host: localhost:8081
Content-Type: application/json
 
{
    "name":"stream1",
    "published":true
}
2. Get sessionId from response
Code:
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: application/json;charset=UTF-8
Date: Tue, 26 Mar 2021 11:05:16 GMT
 
[
  {
    "appKey": "defaultApp",
    "sessionId": "/115.111.306.217:51450/188.40.244.249:1935",
    "mediaSessionId": "86108970-8de5-11eb-afa9-0d709beccf93",
    "name": "test",
    "published": true,
    ...
  }
]
3. Kill connection by sessionId
Code:
POST /rest-api/connection/terminate HTTP/1.1
Host: localhost:8081
Content-Type: application/json
 
{
    "sessionId":"/115.111.306.217:51450/188.40.244.249:1935"
}
 
Top