Skip to content

Commit 5789b90

Browse files
authored
Merge pull request #35 from seymourtang/doc-cloudrecording
feat:Add QueryRtmpPublish api for web recording
2 parents 68040eb + f7ab614 commit 5789b90

File tree

3 files changed

+57
-1
lines changed

3 files changed

+57
-1
lines changed

examples/cloudrecording/webrecording/service.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ func (s *Scenario) RunWebRecorderAndRtmpPublish(storageConfig *cloudRecordingAPI
222222

223223
// query
224224
for i := 0; i < 3; i++ {
225-
queryResp, err := s.CloudRecordingClient.WebRecording().Query(ctx, resourceId, sid)
225+
queryResp, err := s.CloudRecordingClient.WebRecording().QueryRtmpPublish(ctx, resourceId, sid)
226226
if err != nil {
227227
log.Println(err)
228228
return

services/cloudrecording/resp/webrecording.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,25 @@ type QueryWebRecordingSuccessResp struct {
2323
// Server response, see QueryWebRecordingServerResponse for details
2424
ServerResponse *api.QueryWebRecordingServerResponse
2525
}
26+
27+
// @brief Response returned by the web recording QueryRtmpPublish API.
28+
//
29+
// @since v0.8.0
30+
type QueryRtmpPublishResp struct {
31+
// Response returned by the cloud recording API, see Response for details
32+
api.Response
33+
// Success response, see QueryRtmpPublishSuccessResp for details
34+
SuccessResponse QueryRtmpPublishSuccessResp
35+
}
36+
37+
// @brief Successful response returned by the web recording QueryRtmpPublish API.
38+
//
39+
// @since v0.8.0
40+
type QueryRtmpPublishSuccessResp struct {
41+
// Unique identifier of the resource
42+
ResourceId string
43+
// Unique identifier of the recording session
44+
Sid string
45+
// Server response, see QueryRtmpPublishServerResponse for details
46+
ServerResponse *api.QueryRtmpPublishServerResponse
47+
}

services/cloudrecording/scenario/webrecording.go

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,40 @@ func (w *WebRecording) Query(ctx context.Context, resourceID string, sid string)
135135
return &webResp, nil
136136
}
137137

138+
// @brief Query the status of pushing web page recording to the CDN.
139+
//
140+
// @since v0.8.0
141+
//
142+
// @param ctx Context to control the request lifecycle.
143+
//
144+
// @param resourceID The resource ID.
145+
//
146+
// @param sid The recording ID, identifying a recording cycle.
147+
//
148+
// @return Returns the response *QueryRtmpPublishResp. See resp.QueryRtmpPublishResp for details.
149+
//
150+
// @return Returns an error object. If the request fails, the error object is not nil and contains error information.
151+
func (w *WebRecording) QueryRtmpPublish(ctx context.Context, resourceID string, sid string) (*resp.QueryRtmpPublishResp, error) {
152+
respData, err := w.queryAPI.Do(ctx, resourceID, sid, api.WebMode)
153+
if err != nil {
154+
return nil, err
155+
}
156+
157+
var webResp resp.QueryRtmpPublishResp
158+
159+
webResp.Response = respData.Response
160+
if respData.IsSuccess() {
161+
successResp := respData.SuccessResponse
162+
webResp.SuccessResponse = resp.QueryRtmpPublishSuccessResp{
163+
ResourceId: successResp.ResourceId,
164+
Sid: successResp.Sid,
165+
ServerResponse: successResp.GetRtmpPublishServiceServerResponse(),
166+
}
167+
}
168+
169+
return &webResp, nil
170+
}
171+
138172
// @brief Update web recording configuration.
139173
//
140174
// @since v0.8.0

0 commit comments

Comments
 (0)