Camera and Screen Share

Max

Administrator
Staff member
Hello.
You can use WebSDK functions Stream.switchToScreen() and Stream.switchToCam() to switch between camera and screen sharing as described here.
Note that it works only in Chrome and Firefox browsers. Also extension is necessary to capture screen in Chrome browser.
 

Max

Administrator
Staff member
Hello.
It will be easier to modify Screen Sharing example or Media Devices example. You should just add one input field for RTMP stream URL, then add this parameter to createStream function call (in Media Devices for example):
Code:
    publishStream = session.createStream({
        name: streamName,
        display: localVideo,
        cacheLocalResources: true,
        constraints: constraints,
        mediaConnectionConstraints: mediaConnectionConstraints,
        sdpHook: rewriteSdp,
        rtmpUrl: $("#rtmpUrlInput")
       ...
where rtmpUrlInput is input field id.
 

Yee Hong Liong

New Member
It still does not work. I have field url, rtmpUrl and StreamName to work with the webrtc-to-rtmp-republishing.js. When I use with the manager.js it does not start when the publishBtn is triggered.
 

Max

Administrator
Staff member
Hello.
When I use with the manager.js it does not start when the publishBtn is triggered
Please clarify what exactly happens when you have modified the example:
1. If streaming does not start, check browser console for errors. Also check if original example works.
2. If streaming starts, but RTMP stream does not, check if your RTMP URL is correct. For example, enter rtmp://localhost:1935/live, in this case RTMP stream will be published to the same server, and it can be played as rtmp_<stream name> with default settings (if WebRTC stream name is 123, RTMP stream name will be rtmp_123).
 

Max

Administrator
Staff member
Please provide us an example code with minimal modification that reproduces the problem. We will check.
 

Max

Administrator
Staff member
Hello.
If you are streaming to Facebook, you should disable (comment) the parameter in WCS_HOME/conf/flashphoner.properties file
Code:
rtmp_transponder_stream_name_prefix=rtmp_
or, if there is no this parameter in file, set it to empty
Code:
rtmp_transponder_stream_name_prefix=
Also, you should set stream name exactly as Facebook requires. Read the doc here. It explains how to republish stteam to Facebook using REST API, but the requirements concern JavaScript republishsing too.
As alternative to JavaScript, you can do exactly as doc describes:
1. Publish screen sharing stream
2. Republish it to FB using REST API.
 
Top