Fail to start 2 streams on WebRTC server

jasonkc

Member
I cant seem to start 2 streams (with different ID) to my webRTC server, seeing below msg:

08:12:22,762 INFO RestClient - API-ASYNC-pool-13-thread-10 content -> {"nodeId":"sIFbMhoItuX9mpopO997PN8yf5wg3mTx@13.229.135.78","appKey":"flashStreamingApp","sessionId":"/127.0.0.1:48324/127.0.0.1:1935","mediaSessionId":"1000000000000031/127.0.0.1:48324/127.0.0.1:1935","name":"100000000000003","published":false,"hasVideo":true,"hasAudio":true,"status":"FAILED","audioCodec":"PCMA","videoCodec":"H264","info":"Stopped by publisher stop","record":false,"width":240,"height":320,"bitrate":0,"minBitrate":0,"maxBitrate":0,"quality":0,"parentMediaSessionId":"615ad490-ec55-11eb-b667-ab0f5d89140a","history":false,"gop":0,"fps":0,"audioBitrate":0,"codecImpl":"","transport":"UDP","cvoExtension":true,"createDate":1627113700328,"mediaType":"play","audioState":{"muted":false},"videoState":{"muted":false},"mediaProvider":"Flash"}
08:12:22,762 INFO RestClient - API-ASYNC-pool-13-thread-10 RECEIVED REST OBJECT <==
URL:http://localhost:8081/apps/EchoApp/StreamStatusEvent
OBJECT:
{
"nodeId" : "sIFbMhoItuX9mpopO997PN8yf5wg3mTx@13.229.135.78",
"appKey" : "flashStreamingApp",
"sessionId" : "/127.0.0.1:48324/127.0.0.1:1935",
"mediaSessionId" : "1000000000000031/127.0.0.1:48324/127.0.0.1:1935",
"name" : "100000000000003",
"published" : false,
 

jasonkc

Member
More error msg:

12:04:14,014 INFO RestClient - API-ASYNC-pool-13-thread-3 content -> {"nodeId":"sIFbMhoItuX9mpopO997PN8yf5wg3mTx@13.229.135.78","appKey":"defaultApp","sessionId":"/60.51.58.97:57608/172.31.44.43:8443-29d9ebb4-51b2-4d69-b2a1-8d699dc89ba3","mediaSessionId":"4292c370-ec77-11eb-bc59-25f737bd88b9","name":"dc78","published":true,"hasVideo":true,"hasAudio":true,"status":"FAILED","audioCodec":"opus","videoCodec":"H264","info":"Failed by RTMP writer error","record":false,"width":0,"height":0,"bitrate":0,"minBitrate":0,"maxBitrate":0,"quality":0,"rtmpUrl":"rtmp://localhost:1935/live","history":false,"gop":0,"fps":0,"audioBitrate":0,"codecImpl":"","transport":"UDP","cvoExtension":false,"createDate":1627128253737,"mediaType":"publish","audioState":{"muted":false},"videoState":{"muted":false},"mediaProvider":"WebRTC","origin":"https://flashphoner-lbnew.jomliv.com:8888"}
12:04:14,014 INFO RestClient - API-ASYNC-pool-13-thread-3 RECEIVED REST OBJECT <==
URL:http://localhost:8081/apps/EchoApp/StreamStatusEvent


Single stream works fine though!
 

Max

Administrator
Staff member
Good day.
Please describe in details how do you publish stream to server: from browser via WebRTC, from ffmpeg, OBS or another encoder via RTMP, from third party server by RTMP URL etc.
Also collect a report as described here and send using this form.
 

jasonkc

Member
yes, i have a script to republish edited RTMP streams to FB and server itself (created another RTMP stream) via ffmeg....that works well for 1 stream.

I have even tried turning off my script, meaning no RTMP streaming forwarding....but even with that I could not start 2 streams concurrently.
 

Max

Administrator
Staff member
You are using the option
Code:
rtmp_transponder_full_url=true
So you must use exact RTMP URL in WebRTC as RTMP case:
Code:
    session.createStream({
        name: "1000003",
        display: localVideo,
        ...
        rtmpUrl: "rtmp://localhost:1935/live/rtmp_1000003"
        ...
    }).publish();
 

Max

Administrator
Staff member
In you're streaming to FB/Youtube/etc, rtmp_transponder_full_url=true is the recommended setting.
So you have to set a fully qualified RTMP URL including an unique stream name per server.
 

jasonkc

Member
the issue does not seem to be on forwarded destinations....even after i disabled my forwarding script, I still could not start 2 RTMP streams in parallel from 2 different browsers to WebRTC server.
 

Max

Administrator
Staff member
We successfully published two WebRTC streams with republiushing as RTMP to localhost in two different browser windows simultaneoudly
1627286624321.png

Please note how RTMP URL field is filled.
Please also check the code you use for RTMP republishing: we noted the stream rtmp://localhost:1935/live is pulishing to your server. As we wrote above, seems like you did not set stream name while republishing a stream.
1627286821736.png

The RTMP URL must contain an unique stream name, or it cannot be published with "Failed by RTMP writer error".
 

jasonkc

Member
if you looked into the log file (server flashphoner log), i did specify 2 different RTMP stream name when I started 2 streams in parallel - dc78 & 100000000000003/100000000000008), but yet the 2nd stream failed.

In below portion of the JS code, rtmpStreamPrefix is actually added into the URL:

var rtmpStreamPrefix = "rtmp_";
var url = host + "/" + rtmpStreamPrefix + field("streamName");
player.setURLtoFlash(url);

Why do I still need to specify it in RTMP URL field in WebRTC Republishing page?
 

jasonkc

Member
function startStreaming(session) {
var streamName = urlParams.get('user_id');
var rtmpUrl = "rtmp://localhost:1935/live";
session.createStream({
name: streamName,
display: localVideo,
cacheLocalResources: true,
receiveVideo: false,
receiveAudio: false,


Do I need to also append 'rtmp_' to above name parameter (preceeding streamName with rtmp_)?
 

jasonkc

Member
anyway, I just tried with yr suggested method to add 'rtmp_' in front the of stream name, yet I could not start 2 streams in parallel.
 

Max

Administrator
Staff member
Please change to
Code:
var rtmpUrl = "rtmp://localhost:1935/live/" + "rtmp_" + streamName;
Also, try to publish in WebRTC as RTMP example as we shown above.
 

jasonkc

Member
I changed to following:

function startStreaming(session) {
var streamName = urlParams.get('user_id');
var rtmpUrl = "rtmp://localhost:1935/live/" + "rtmp_" + streamName;
session.createStream({
name: streamName,
display: localVideo,
cacheLocalResources: true,
receiveVideo: false,
receiveAudio: false,
transport: "UDP",

But still i could not start 2 streams without adding "rtmp_" in RTMP URL parameter.
 
Top