Skip to content

Commit

Permalink
update library for xiu
Browse files Browse the repository at this point in the history
  • Loading branch information
harlanc committed Aug 18, 2021
1 parent b0c0323 commit faeb49d
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 17 deletions.
84 changes: 70 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,29 +32,76 @@ use master branch
#### Build

cd ./xiu/application/xiu

cargo build

#### Run

cd ./xiu/target/debug
./xiu config.toml

## Configurations

##### RTMP
[rtmp]
enabled = true
port = 1935

# pull streams from other server node.
[rtmp.pull]
enabled = false
address = "192.168.0.1"
port = 1935

# push streams to other server node.
[[rtmp.push]]
enabled = true
address = "localhost"
port = 1936
[[rtmp.push]]
enabled = true
address = "192.168.0.3"
port = 1935

./application config.toml
##### HTTPFLV

[httpflv]
# true or false to enable or disable the feature
enabled = true
# listening port
port = 8081

##### HLS
[hls]
# true or false to enable or disable the feature
enabled = true
# listening port
port = 8080

##### Log

[log]
level = "info"


#### Push


## Scenarios

##### Push

Use OBS to push a live rtmp stream.


#### Play
##### Play

Use ffplay to play rtmp live stream:
Use ffplay to play rtmp/httpflv/hls live stream:

ffplay -i rtmp://localhost:1935/live/test
ffplay -i http://localhost:8081/live/test.flv
ffplay -i http://localhost:8080/live/test/test.m3u8

#### Relay static push
##### Relay static push

The configuration file is as follows (now only test on local machine):
The configuration files are as follows (now only test on local machine):

The configuration file of Service 1 named config.toml:

Expand All @@ -74,8 +121,8 @@ The configuration file of Service 2 named config_push.toml:

Run the 2 services:

./application config.toml
./application config_push.toml
./xiu config.toml
./xiu config_push.toml


Use Obs to push live stream to service 1, then the stream can be pushed to service 2 automatically, you can play the same live stream from both the two services:
Expand All @@ -85,9 +132,9 @@ Use Obs to push live stream to service 1, then the stream can be pushed to servi



#### Relay pull
##### Relay static pull

The configuration file is as follows (now only test on local machine):
The configuration file are as follows (now only test on local machine):

The configuration file of Service 1 named config.toml:

Expand All @@ -108,8 +155,8 @@ The configuration file of Service 2 named config_pull.toml:

Run the 2 services:

./application config.toml
./application config_pull.toml
./xiu config.toml
./xiu config_pull.toml

Use obs to push live stream to service 1, when you play the stream from serivce 2, it will pull the stream from service 1:

Expand All @@ -118,3 +165,12 @@ Use obs to push live stream to service 1, when you play the stream from serivce
## Star History

[link](https://star-history.t9t.io/#harlanc/xiu)

## Thanks

- [media_server](https://github.com/ireader/media-server.git)

## Others

You can open issues if have any problems. Star and pull requests are welcomed.

10 changes: 7 additions & 3 deletions application/xiu/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,13 @@ flexi_logger = "0.18"
chrono = "0.4"
failure = "0.1.1"

rtmp = "0.0.6"#{path = "../../protocol/rtmp/"}#"0.0.4"
httpflv = "0.0.1"#{path = "../../protocol/httpflv/"}
hls = "0.0.1"#{path = "../../protocol/hls/"}
rtmp = "0.0.7"#{path = "../../protocol/rtmp/"}#"0.0.4"
httpflv = "0.0.2"#{path = "../../protocol/httpflv/"}
hls = "0.0.2"#{path = "../../protocol/hls/"}

# rtmp = {path = "../../protocol/rtmp/"}#"0.0.4"
# httpflv = {path = "../../protocol/httpflv/"}
# hls = {path = "../../protocol/hls/"}

[features]
default = ["std"]
Expand Down
3 changes: 3 additions & 0 deletions application/xiu/src/config/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@
[rtmp]
enabled = true
port = 1935
# pull streams from other server node.
[rtmp.pull]
enabled = false
address = "192.168.0.1"
port = 1935
port = 1935
# push streams to other server node.
[[rtmp.push]]
enabled = true
address = "localhost"
Expand Down

0 comments on commit faeb49d

Please sign in to comment.