8xFF / atm0s-media-server

Decentralized, Global-Scale Media Server written in Rust (WebRTC/Whip/Whep/Rtmp/Sip)
https://8xff.github.io/media-docs/
MIT License
212 stars 17 forks source link

How to get started? #114

Open Yosef0987 opened 8 months ago

Yosef0987 commented 8 months ago

Can you update the readme so it will be easier for people who are interested in this project to run the demo? just following the readme sfu server can not be started

giangndm commented 8 months ago

Sure, I am working on global-gateway so I will update README after that finished. In short, you can try the media-server in cluster mode in local machine like bellow:

Start a inner-gateway (which used to route connect request to best node)

RUST_LOG=info cargo run --package atm0s-media-server -- --node-id 1 --http-port 3000 gateway

Start first media-server with Webrtc protocol

RUST_LOG=info cargo run --package atm0s-media-server -- --node-id 2 --http-port 3001 --seeds /p2p/1/ip4/127.0.0.1/udp/50001 webrtc

Start second media-server with Webrtc protocol

RUST_LOG=info cargo run --package atm0s-media-server -- --node-id 3 --http-port 3002 --seeds /p2p/1/ip4/127.0.0.1/udp/50001 webrtc

Wait 2 media-server utils it print out (around 10 seconds): '[WebrtcMediaServer] ping gateway success'. In each seconds, each node also print out routing table look like:

2023-12-14T02:28:47.861441Z  INFO atm0s_sdn_layers_spread_router::router: [Router 1] dump begin
2023-12-14T02:28:47.861515Z  INFO atm0s_sdn_layers_spread_router::table: [Table 1/3/0] slots: []
2023-12-14T02:28:47.861581Z  INFO atm0s_sdn_layers_spread_router::table: [Table 1/2/0] slots: []
2023-12-14T02:28:47.861648Z  INFO atm0s_sdn_layers_spread_router::table: [Table 1/1/0] slots: []
2023-12-14T02:28:47.861716Z  INFO atm0s_sdn_layers_spread_router::table: [Table 1/0/1] slots: [1,2]
2023-12-14T02:28:47.861749Z  INFO atm0s_sdn_layers_spread_router::router: [Router 1] dump end

Now you can access sample page in url: http://localhost:3000/samples/webrtc/ in there we have 2 page: Whip broadcast and Whep viewer.

Note that, inner-gateway will select node based on usage so it will route to same media-server instance util it reach high usage. For testing media-exchange between system you can access to each media-server instance sample page like:

First media-server: http://localhost:3001/samples/ Second media-server: http://localhost:3002/samples/

Screen Shot 2023-12-14 at 09 44 18

Each node also expose a metric dashboard here:

image

Yosef0987 commented 8 months ago

How great this project is your instructions make it so easy to get them run as what you showed and everything goes very well

Yosef0987 commented 8 months ago

From the features in the readme I found that desktop sdk is not in the list. But I learned that desktop is in great need for some users or developers. So will you give it consideration like https://github.com/livekit/rust-sdks what they are doing?

Yosef0987 commented 8 months ago

Do you have any plan so people who want to contribute to this project they will know what to do and how to get started?

giangndm commented 8 months ago

@Yosef0987 Actually I already have and old private Rust-SDK which used webrtc-rs so it take time to make it public. I have plan implement Rust-SDK with str0m instead for benchmarking and server/desktop integration.

We are only in-depended small-team with limited resource so I am very happy if anyone can join with us. In current state I don't have effort to write a details dev-guide but feel free to ask any question I will answer as soon as possible. May be that answers can be collect to be a dev-guide in future.

Ps: I just updated expired discord link in README

Yosef0987 commented 8 months ago

You guys have done great job. It is so nice your team open the source code to the public. I will be very glad to see where I can contribute to it or give any feedback.

giangndm commented 4 months ago

@Yosef0987 Sorry I missed your reply, we are actively refactor for making it more clean architecture. I will be very glad too with your help.