File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ < script src ="https://cdn.bootcdn.net/ajax/libs/flv.js/1.5.0/flv.min.js "> </ script >
2+ < video id ="videoElement "> </ video >
3+ < script >
4+ window . onload = function ( ) {
5+ if ( flvjs . isSupported ( ) ) {
6+ var videoElement = document . getElementById ( 'videoElement' ) ;
7+ videoElement . controls = true
8+ videoElement . muted = true
9+ videoElement . width = "640"
10+ videoElement . height = "480"
11+ videoElement . autoplay = true
12+
13+ var flvPlayer = flvjs . createPlayer ( {
14+ type : 'flv' ,
15+ url : 'http://localhost:8080/liziqiu'
16+ } ) ;
17+ flvPlayer . attachMediaElement ( videoElement ) ;
18+ flvPlayer . load ( ) ;
19+ }
20+ }
21+ </ script >
Original file line number Diff line number Diff line change @@ -39,6 +39,7 @@ async fn accept(mut stream: TcpStream) -> anyhow::Result<()> {
3939 Connection: close\r \n \
4040 Transfer-Encoding: chunked\r \n \
4141 Cache-Control: no-cache\r \n \
42+ Access-Control-Allow-Origin: *\r \n \
4243 \r \n \
4344 ";
4445 stream. write_all ( header. as_bytes ( ) ) . await ?;
Original file line number Diff line number Diff line change @@ -83,6 +83,7 @@ impl AsRef<[u8]> for FlvTag {
8383}
8484
8585/// 后台保存FLV文件
86+ #[ allow( unused) ]
8687pub fn save_flv_background ( stream_name : & str , peer_addr : String ) {
8788 if let Some ( eventbus) = eventbus_map ( ) . get ( stream_name) {
8889 let flv_rx = eventbus. register_receiver ( ) ;
You can’t perform that action at this time.
0 commit comments