'I would like to make a live stream system by using SRS project. However, I am facing with a problem

I would like to make a live stream system by using SRS project. However, I am facing with a problem.

I send a live stream start request from React project and live stream is being broadcasted on SRS by converted to FLV format. But my Player component wants to play the broadcast and I get an error in that process because it takes a while until the broadcast is fully deployed.

As stream;

I send "start the broadcast" command to the camera device I use, and I get "successfull" message and the device opens up the stream in 3-4 seconds. Because I get the "successfull" respond, my player component wants to play the video in the FLV format but I get error because the broadcast is not deployed yet.

ReactJS player error click here

To make another example apart from this, I tried in the VLC Player and I still faced the same problem. The error that VLC player gave: click here

This situation only happens when I use SRS project. I used "Node Media Server" as a different project and in this case, it gives me a broadcast even if it is empty and I get no errors. VLC Player's example is like this: click here

My SRS start command: docker run --rm -it -p 1935:1935 -p 1985:1985 -p 8080:8080 ossrs/srs ./objs/srs -c conf/srs.conf

Config file I use for SRS: conf/srs.conf. Sample config file: click here

Additional sources

ReacJS Video Player: https://www.npmjs.com/package/react-player

React Native Video Player: https://www.npmjs.com/package/react-native-vlc-media-player

SRS: https://github.com/ossrs/srs

Do you have any ideas or suggestions?



Solution 1:[1]

It's caused by your URL, please publish by OBS:

  • Server: rtmp://your_server_ip/live
  • StreamKey: livestream

Then play the FLV by http://your_server_ip:8080/live/livestream.flv which should work.

Of course, you could change the app live to jimi or whatever you want, and livestream to another one.

Remark: Please try the example URL first, to make sure you understand the URL, then change it.

If you want to publish to multiple levels of app, change the config of OBS like this:

  • Server: rtmp://your_server_ip/live/subapp
  • StreamKey: livestream

Keep in mind that SRS always supports stream name without /, just like a filename without /, while app is similar to directory which might contains /.

But highly recommend to keep app and stream without /, so the SRS URL is formerly like this:

rtmp://ip/app/stream?query
http://ip/app/stream.flv?query
http://ip/app/stream.m3u8?query
webrtc://ip/app/stream?query

Yep, you could pass query string like HTTP URL.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1