summaryrefslogtreecommitdiff
path: root/bilibili/streaming.go
diff options
context:
space:
mode:
Diffstat (limited to 'bilibili/streaming.go')
-rw-r--r--bilibili/streaming.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/bilibili/streaming.go b/bilibili/streaming.go
index e8a6911..64dc26d 100644
--- a/bilibili/streaming.go
+++ b/bilibili/streaming.go
@@ -5,8 +5,8 @@ import (
"context"
"errors"
"fmt"
- "io"
"net/http"
+ "os"
"strings"
)
@@ -15,7 +15,9 @@ func (b Bilibili) CopyLiveStream(
ctx context.Context,
roomId common.RoomId,
stream StreamingUrlInfo,
- out io.Writer,
+ out *os.File,
+ buffer []byte,
+ readChunkSize int,
) (err error) {
url := stream.URL
if !strings.HasPrefix(url, "https://") &&
@@ -60,7 +62,7 @@ func (b Bilibili) CopyLiveStream(
defer cancelGuardian()
// blocking copy
- n, err := common.Copy(ctx, out, resp.Body)
+ n, err := common.CopyToFileWithBuffer(ctx, out, resp.Body, buffer, readChunkSize, false)
if err != nil && !errors.Is(err, context.Canceled) {
// real error happens