@@ -21,14 +21,14 @@ class Client extends RTC {
21
21
// ref: https://web.sdk.qcloud.com/trtc/webrtc/doc/zh-cn/Client.html#startPublishCDNStream
22
22
23
23
// example 1:“全局自动旁路”模式下,修改当前用户音视频流在腾讯云 CDN 对应的 StreamId
24
- // handleStartPublishCDNStream() {
24
+ // async handleStartPublishCDNStream() {
25
25
// if (!this.streamID) {
26
26
// Toast.error('please input streamID');
27
27
// return;
28
28
// }
29
29
// const options = { streamId: this.streamID };
30
30
// try {
31
- // this.client.startPublishCDNStream(options);
31
+ // await this.client.startPublishCDNStream(options);
32
32
// Toast.success('start publishCDNStream success', 2000);
33
33
// } catch (error) {
34
34
// console.error('start publishCDNStream error', error);
@@ -37,9 +37,9 @@ class Client extends RTC {
37
37
// }
38
38
39
39
// example 2:“指定流旁路”模式下,以默认 streamId: ${sdkAppId}_${roomId}_${userId}_main 发布当前用户音视频流到腾讯云 CDN
40
- // handleStartPublishCDNStream() {
40
+ // async handleStartPublishCDNStream() {
41
41
// try {
42
- // this.client.startPublishCDNStream();
42
+ // await this.client.startPublishCDNStream();
43
43
// Toast.success('start publishCDNStream success', 2000);
44
44
// } catch (error) {
45
45
// console.error('start publishCDNStream error', error);
@@ -48,13 +48,13 @@ class Client extends RTC {
48
48
// }
49
49
50
50
// example 3:“指定流旁路”模式下,以指定 streamId 发布当前用户音视频流到腾讯云 CDN
51
- // handleStartPublishCDNStream() {
51
+ // async handleStartPublishCDNStream() {
52
52
// if (!this.streamID) {
53
53
// Toast.error('please input streamID');
54
54
// }
55
55
// const options = { streamId: this.streamID };
56
56
// try {
57
- // this.client.startPublishCDNStream(options);
57
+ // await this.client.startPublishCDNStream(options);
58
58
// Toast.success('start publishCDNStream success', 2000);
59
59
// } catch (error) {
60
60
// console.error('start publishCDNStream error', error);
@@ -63,7 +63,7 @@ class Client extends RTC {
63
63
// }
64
64
65
65
// example 4: 将当前用户音视频流发布到指定的 CDN 地址
66
- // handleStartPublishCDNStream() {
66
+ // async handleStartPublishCDNStream() {
67
67
// if (!this.appID || !this.bizID || !this.publishCDNUrl) {
68
68
// Toast.error('please input appID, bizID, publishCDNUrl');
69
69
// }
@@ -73,7 +73,7 @@ class Client extends RTC {
73
73
// url: this.publishCDNUrl,
74
74
// };
75
75
// try {
76
- // this.client.startPublishCDNStream(options);
76
+ // await this.client.startPublishCDNStream(options);
77
77
// Toast.success('start publishCDNStream success', 2000);
78
78
// } catch (error) {
79
79
// console.error('start publishCDNStream error', error);
@@ -82,7 +82,7 @@ class Client extends RTC {
82
82
// }
83
83
84
84
// example 5: 修改当前用户音视频流在腾讯云 CDN 对应的 StreamId,并且发布当前用户音视频流到指定的 CDN 地址
85
- handleStartPublishCDNStream ( ) {
85
+ async handleStartPublishCDNStream ( ) {
86
86
if ( ! this . streamID || ! this . appID || ! this . bizID || ! this . publishCDNUrl ) {
87
87
Toast . error ( 'please input streamID, appID, bizID, publishCDNUrl' ) ;
88
88
return ;
@@ -94,7 +94,7 @@ class Client extends RTC {
94
94
url : this . publishCDNUrl ,
95
95
} ;
96
96
try {
97
- this . client . startPublishCDNStream ( options ) ;
97
+ await this . client . startPublishCDNStream ( options ) ;
98
98
Toast . success ( 'start publishCDNStream success' , 2000 ) ;
99
99
} catch ( error ) {
100
100
console . error ( 'start publishCDNStream error' , error ) ;
@@ -104,9 +104,9 @@ class Client extends RTC {
104
104
105
105
106
106
// ref: https://web.sdk.qcloud.com/trtc/webrtc/doc/zh-cn/Client.html#stopPublishCDNStream
107
- handleStopPublishCDNStream ( ) {
107
+ async handleStopPublishCDNStream ( ) {
108
108
try {
109
- this . client . stopPublishCDNStream ( ) ;
109
+ await this . client . stopPublishCDNStream ( ) ;
110
110
Toast . success ( 'start publishCDNStream success' , 2000 ) ;
111
111
} catch ( error ) {
112
112
console . error ( 'start publishCDNStream error' , error ) ;
0 commit comments