From 338a816778150fac5e36a701cc96416cde2efb31 Mon Sep 17 00:00:00 2001 From: qydysky <32743305+qydysky@users.noreply.github.com> Date: Sun, 16 Oct 2022 04:30:59 +0800 Subject: [PATCH] fix --- websocket/Recoder.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/websocket/Recoder.go b/websocket/Recoder.go index 9779916..ad50c2d 100644 --- a/websocket/Recoder.go +++ b/websocket/Recoder.go @@ -100,13 +100,13 @@ func Play(filePath string, perReadSize int, maxReadSize int) (s *Server, close f if data, err := f.ReadUntil('\n', perReadSize, maxReadSize); err != nil { panic(err) } else if len(data) != 0 { - datas := bytes.Split(data, []byte(",")) - d, _ := strconv.ParseFloat(string(datas[0]), 64) + tIndex := bytes.Index(data, []byte{','}) + danmuIndex := tIndex + bytes.Index(data[tIndex+2:], []byte{','}) + 3 s.Interface().Push_tag(`send`, Uinterface{ Id: 0, //send to all - Data: datas[2], + Data: data[danmuIndex:], }) - if d > cu { + if d, _ := strconv.ParseFloat(string(data[:tIndex]), 64); d > cu { break } } else { -- 2.39.2