add client status
This commit is contained in:
parent
64bb2d145a
commit
42c53daeab
@ -97,6 +97,7 @@ type RTSPClient struct {
|
||||
sequenceNumber int
|
||||
end int
|
||||
offset int
|
||||
status string
|
||||
}
|
||||
|
||||
type RTSPClientOptions struct {
|
||||
@ -280,6 +281,10 @@ func (client *RTSPClient) startStream() {
|
||||
}
|
||||
timer = time.Now()
|
||||
}
|
||||
if client.status == PAUSE {
|
||||
// client.Println("RTSP Client PAUSE")
|
||||
continue
|
||||
}
|
||||
if !fixed {
|
||||
nb, err := io.ReadFull(client.connRW, header)
|
||||
if err != nil || nb != 4 {
|
||||
@ -505,10 +510,12 @@ func (client *RTSPClient) request(method string, customHeaders map[string]string
|
||||
}
|
||||
|
||||
func (client *RTSPClient) Pause() error {
|
||||
client.status = PAUSE
|
||||
return client.request(PAUSE, nil, client.pURL.String(), false, true)
|
||||
}
|
||||
|
||||
func (client *RTSPClient) Play(customHeaders map[string]string) error {
|
||||
client.status = PLAY
|
||||
return client.request(PLAY, customHeaders, client.pURL.String(), false, true)
|
||||
}
|
||||
|
||||
|
@ -2,12 +2,13 @@ package rtspv2
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"math"
|
||||
"time"
|
||||
|
||||
"github.com/deepch/vdk/av"
|
||||
"github.com/deepch/vdk/codec/aacparser"
|
||||
"github.com/deepch/vdk/codec/h264parser"
|
||||
"github.com/deepch/vdk/codec/h265parser"
|
||||
"math"
|
||||
"time"
|
||||
)
|
||||
|
||||
const (
|
||||
|
Loading…
Reference in New Issue
Block a user