]> 127.0.0.1 Git - bili_danmu/.git/commitdiff
修复flv网络中断后无法播放
authorqydysky <qydysky@foxmail.com>
Sat, 24 Apr 2021 03:10:20 +0000 (11:10 +0800)
committerqydysky <qydysky@foxmail.com>
Sat, 24 Apr 2021 03:10:20 +0000 (11:10 +0800)
README.md
Reply/F.go

index e8790283cf9f554115df50b607a380604b03f071..da8b9877cdb5b6a1dd0e3a91eee263e0cbe962e8 100644 (file)
--- a/README.md
+++ b/README.md
@@ -109,7 +109,9 @@ golang go version go1.15 linux/amd64
     "直播保存位置Web服务":0,
 ```
 
-开启之后,启动会显示服务地址,在局域网内打开网址可以取得所有直播流的串流地址。
+开启之后,启动会显示服务地址,在局域网内打开网址可以取得所有直播流的串流地址
+
+支持跨域,注意:在https网站默认无法加载非本机http服务
 
 - dtmp结尾:当前正在获取的流,播放此链接时进度将保持当前流进度
 - flv/m3u8结尾:保存完毕的直播流,播放此链接时将从头开始播放
@@ -124,6 +126,13 @@ golang go version go1.15 linux/amd64
 I: 2021/04/13 20:07:45 命令行操作 [直播Web服务: http://192.168.31.245:38259]
 ```
 
+测试可用项目:
+
+- [bilibili/flv.js](https://github.com/bilibili/flv.js)
+- [bytedance/xgplayer](https://github.com/bytedance/xgplayer)
+- [video-dev/hls.js](https://github.com/video-dev/hls.js)
+- [mpv](https://mpv.io/)
+
 
 #### 命令行操作
 在准备动作完成(`T: 2021/03/06 16:22:39 命令行操作 [回车查看帮助]`)后,输入回车将显示帮助
index c84201c99d7cb66bfa656f20c8016c379df3ad41..df04a0aa8aa86771eddf69d9a1e060e058506816 100644 (file)
@@ -443,12 +443,16 @@ func Savestreamf(){
                                byteC := make(chan []byte,1024*1024*30)//传来的关键帧间隔buf为3s,避免超出buf,设为30M
 
                                go func(){
-                                       for !p.Checkfile().IsExist(savestream.path + ".flv.dtmp") {
-                                               time.Sleep(time.Second)
-                                       }
-                                       if err := Stream(savestream.path + ".flv.dtmp",&savestream.flv_front,byteC,exit_chan);err != nil {
-                                               flog.L(`T: `,err);
-                                               return
+                                       for !p.Checkfile().IsExist(savestream.path + ".flv.dtmp") {time.Sleep(time.Second)}
+                                       for {
+                                               if err := Stream(savestream.path + ".flv.dtmp",&savestream.flv_front,byteC,exit_chan);err != nil {
+                                                       flog.L(`T: `,err);
+                                                       return
+                                               }
+                                               select {
+                                               case <-exit_chan:return;
+                                               default:;
+                                               }
                                        }
                                }()