@@ -41,6 +41,7 @@ import { useUserViewMode } from "util/hooks";
41
41
import { isNumeric } from "util/stringUtils" ;
42
42
import { NameConfig , withExposingConfigs } from "../../generators/withExposing" ;
43
43
44
+ import axios from "axios" ;
44
45
import AgoraRTC , {
45
46
ICameraVideoTrack ,
46
47
IMicrophoneAudioTrack ,
@@ -109,6 +110,15 @@ let userId: UID | null | undefined;
109
110
let rtmChannelResponse : RtmChannel ;
110
111
let rtmClient : RtmClient ;
111
112
113
+ const generateToken = async (
114
+ appId : any ,
115
+ certificate : any ,
116
+ channelName : any
117
+ ) => {
118
+ const agoraTokenUrl = `https://api.agora.io/v1/token?channelName=test&uid=${ userId } &appID=${ appId } &appCertificate=${ certificate } ` ;
119
+ await axios . post ( agoraTokenUrl ) ;
120
+ } ;
121
+
112
122
const turnOnCamera = async ( flag ?: boolean ) => {
113
123
if ( videoTrack ) {
114
124
return videoTrack . setEnabled ( flag ! ) ;
@@ -164,7 +174,18 @@ const leaveChannel = async () => {
164
174
165
175
const hostChanged = ( users : any ) => { } ;
166
176
167
- const publishVideo = async ( appId : any , channel : any , height : any ) => {
177
+ const publishVideo = async (
178
+ appId : string ,
179
+ channel : any ,
180
+ height : any ,
181
+ certifiCateKey : string
182
+ ) => {
183
+ // console.log(
184
+ // "generateToken",
185
+ // await generateToken(appId, certifiCateKey, channel)
186
+ // );
187
+
188
+ // return;
168
189
await turnOnCamera ( true ) ;
169
190
await client . join ( appId , channel , null , userId ) ;
170
191
await client . publish ( videoTrack ) ;
@@ -254,6 +275,7 @@ export const meetingControllerChildren = {
254
275
usersScreenShared : stateComp < JSONValue > ( [ ] ) ,
255
276
localUser : jsonObjectExposingStateControl ( "" ) ,
256
277
meetingName : stringExposingStateControl ( "meetingName" ) ,
278
+ certifiCateKey : stringExposingStateControl ( "" ) ,
257
279
messages : stateComp < JSONValue > ( [ ] ) ,
258
280
} ;
259
281
let MTComp = ( function ( ) {
@@ -414,6 +436,10 @@ let MTComp = (function () {
414
436
< >
415
437
< Section name = { sectionNames . basic } >
416
438
{ children . appId . propertyView ( { label : trans ( "meeting.appid" ) } ) }
439
+ { children . certifiCateKey . propertyView ( {
440
+ label : trans ( "meeting.certifiCateKey" ) ,
441
+ } ) }
442
+
417
443
{ children . meetingName . propertyView ( {
418
444
label : trans ( "meeting.meetingName" ) ,
419
445
} ) }
@@ -532,7 +558,8 @@ MTComp = withMethodExposing(MTComp, [
532
558
comp . children . meetingName . getView ( ) . value == ""
533
559
? "_meetingId"
534
560
: comp . children . meetingName . getView ( ) . value ,
535
- comp . children
561
+ comp . children ,
562
+ comp . children . certifiCateKey . getView ( ) . value
536
563
) ;
537
564
} ,
538
565
} ,
0 commit comments