1# Xiu 2**Xiu is a live server written by Rust.** 3 4 5## Functionalities 6 7- [x] rtmp 8 - [x] publish and play (now only simple handshake is supported.) 9 - [x] relay: static push 10 - [x] relay: pull 11- [ ] httpflv 12- [ ] hls 13- ... 14 15## Dev Environment Establish 16 17#### OS Support 18 19- CentOS 7 20- MaxOS 21 22#### Install Rust and Cargo 23 24[Document](https://doc.rust-lang.org/cargo/getting-started/installation.html) 25 26#### Clone Xiu 27 28 git clone https://github.com/harlanc/xiu.git 29 30use master branch 31 32#### Build 33 34 cd ./xiu/application 35 36 cargo build 37 38#### Run 39 40 cd ./xiu/target/debug 41 42 ./application config.toml 43 44#### Push 45 46Use OBS to push a live rtmp stream. 47 48 49#### Play 50 51Use ffplay to play rtmp live stream: 52 53 ffplay -i rtmp://localhost:1935/live/test 54 55#### Relay static push 56 57The configuration file is as follows (now only test on local machine): 58 59The configuration file of Service 1 named config.toml: 60 61 [rtmp] 62 enabled = true 63 port = 1935 64 [[rtmp.push]] 65 enabled = true 66 address = "localhost" 67 port = 1936 68 69The configuration file of Service 2 named config_push.toml: 70 71 [rtmp] 72 enabled = true 73 port = 1936 74 75Run the 2 services: 76 77 ./application config.toml 78 ./application config_push.toml 79 80 81Use 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: 82 83 ffplay -i rtmp://localhost:1935/live/test 84 ffplay -i rtmp://localhost:1936/live/test 85 86 87 88#### Relay pull 89 90The configuration file is as follows (now only test on local machine): 91 92The configuration file of Service 1 named config.toml: 93 94 [rtmp] 95 enabled = true 96 port = 1935 97 98 99The configuration file of Service 2 named config_pull.toml: 100 101 [rtmp] 102 enabled = true 103 port = 1936 104 [rtmp.pull] 105 enabled = false 106 address = "localhost" 107 port = 1935 108 109Run the 2 services: 110 111 ./application config.toml 112 ./application config_pull.toml 113 114Use obs to push live stream to service 1, when you play the stream from serivce 2, it will pull the stream from service 1: 115 116 ffplay -i rtmp://localhost:1935/live/test 117 ffplay -i rtmp://localhost:1936/live/test 118 119 120 121## Change Logs 122 123[2021-05-15] 124 125- Impl : Coding for pull is finished. 126 127 128[2021-05-02] 129 130- Impl : Coding for static push is finished. 131 132 133[2021-04-16] 134 135- Fix: obs publish-> unpublish->publish ,, ffplay cannot play successfully 136 137[2021-04-15] 138 139- Improve: remove build warnings. 140 141[2021-04-14] 142 143- Fix bug: when shutdown ffplayer ,the OBS publisher will be reconnected automatically. 144 145 146[2021-04-11] 147 148- Impl: add flush\_timeout and read\_timeout functinos. 149- Impl: add some log print configuratinos. 150- Fix bug: Chunk header with the save csid is not saved. 151- Impl: add unsubscribe and unpublish logic in server\_session and channels models. 152 153[2021-04-10] 154 155- Improve: change use libraries format. 156 157[2021-04-09] 158 159- Update README. 160 161[2021-04-08] 162 163- Fix: replace oneshot by mpsc channel,may be improved. 164 165## Star History 166 167[link](https://star-history.t9t.io/#harlanc/xiu) 168