Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add WebRtc PlayUrls on Static Model #82

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions qvs/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const (
DomainLiveRTMP string = "liveRtmp"
DomainLiveHLS string = "liveHls"
DomainLiveHDL string = "liveHdl"
DomainLiveRTC string = "liveWebrtc"
)

type Stream struct {
Expand Down Expand Up @@ -40,7 +41,7 @@ type Stream struct {
}

/*
创建流API
创建流API
*/
func (manager *Manager) AddStream(nsId string, stream *Stream) (*Stream, error) {

Expand All @@ -53,7 +54,7 @@ func (manager *Manager) AddStream(nsId string, stream *Stream) (*Stream, error)
}

/*
查询流API
查询流API
*/
func (manager *Manager) QueryStream(nsId string, streamId string) (*Stream, error) {

Expand All @@ -66,7 +67,7 @@ func (manager *Manager) QueryStream(nsId string, streamId string) (*Stream, erro
}

/*
更新流API
更新流API
*/
func (manager *Manager) UpdateStream(nsId string, streamId string, ops []PatchOperation) (*Stream, error) {

Expand All @@ -80,15 +81,15 @@ func (manager *Manager) UpdateStream(nsId string, streamId string, ops []PatchOp
}

/*
删除流API
删除流API
*/
func (manager *Manager) DeleteStream(nsId string, streamId string) error {

return manager.client.Call(context.Background(), nil, "DELETE", manager.url("/namespaces/%s/streams/%s", nsId, streamId), nil)
}

/*
查询流列表API
查询流列表API
*/
func (manager *Manager) ListStream(nsId string, offset, line int, prefix, sortBy string, qType int) ([]Stream, int64, error) {

Expand Down Expand Up @@ -127,13 +128,14 @@ type RouteRet struct {
}

type RoutePlayUrls struct {
Rtmp string `json:"rtmp"` // rtmp播放地址
Flv string `json:"flv"` // flv播放地址
Hls string `json:"hls"` // hls播放地址
Rtmp string `json:"rtmp"` // rtmp播放地址
Flv string `json:"flv"` // flv播放地址
Hls string `json:"hls"` // hls播放地址
WebRTC string `json:"webrtc"` //webrtc播放地址
}

/*
动态获取流地址API:推拉流IP地址计算最合适的设备端推拉流地址
动态获取流地址API:推拉流IP地址计算最合适的设备端推拉流地址
*/
func (manager *Manager) DynamicPublishPlayURL(nsId string, streamId string, route *DynamicLiveRoute) (*RouteRet, error) {

Expand All @@ -146,7 +148,7 @@ func (manager *Manager) DynamicPublishPlayURL(nsId string, streamId string, rout
}

/*
静态获取流地址API:根据domain生成推拉流地址
静态获取流地址API:根据domain生成推拉流地址
*/
func (manager *Manager) StaticPublishPlayURL(nsId, streamId string, route *StaticLiveRoute) (string, error) {

Expand All @@ -164,6 +166,8 @@ func (manager *Manager) StaticPublishPlayURL(nsId, streamId string, route *Stati
return ret.PlayUrls.Hls, nil
case DomainLiveHDL:
return ret.PlayUrls.Flv, nil
case DomainLiveRTC:
return ret.PlayUrls.WebRTC, nil
}
return "", nil
}
Expand Down