@@ -41,6 +41,7 @@ import { useUserViewMode } from "util/hooks";
4141import { isNumeric } from "util/stringUtils" ;
4242import { NameConfig , withExposingConfigs } from "../../generators/withExposing" ;
4343
44+ import axios from "axios" ;
4445import AgoraRTC , {
4546 ICameraVideoTrack ,
4647 IMicrophoneAudioTrack ,
@@ -109,6 +110,15 @@ let userId: UID | null | undefined;
109110let rtmChannelResponse : RtmChannel ;
110111let rtmClient : RtmClient ;
111112
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+
112122const turnOnCamera = async ( flag ?: boolean ) => {
113123 if ( videoTrack ) {
114124 return videoTrack . setEnabled ( flag ! ) ;
@@ -164,7 +174,18 @@ const leaveChannel = async () => {
164174
165175const hostChanged = ( users : any ) => { } ;
166176
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;
168189 await turnOnCamera ( true ) ;
169190 await client . join ( appId , channel , null , userId ) ;
170191 await client . publish ( videoTrack ) ;
@@ -254,6 +275,7 @@ export const meetingControllerChildren = {
254275 usersScreenShared : stateComp < JSONValue > ( [ ] ) ,
255276 localUser : jsonObjectExposingStateControl ( "" ) ,
256277 meetingName : stringExposingStateControl ( "meetingName" ) ,
278+ certifiCateKey : stringExposingStateControl ( "" ) ,
257279 messages : stateComp < JSONValue > ( [ ] ) ,
258280} ;
259281let MTComp = ( function ( ) {
@@ -414,6 +436,10 @@ let MTComp = (function () {
414436 < >
415437 < Section name = { sectionNames . basic } >
416438 { children . appId . propertyView ( { label : trans ( "meeting.appid" ) } ) }
439+ { children . certifiCateKey . propertyView ( {
440+ label : trans ( "meeting.certifiCateKey" ) ,
441+ } ) }
442+
417443 { children . meetingName . propertyView ( {
418444 label : trans ( "meeting.meetingName" ) ,
419445 } ) }
@@ -532,7 +558,8 @@ MTComp = withMethodExposing(MTComp, [
532558 comp . children . meetingName . getView ( ) . value == ""
533559 ? "_meetingId"
534560 : comp . children . meetingName . getView ( ) . value ,
535- comp . children
561+ comp . children ,
562+ comp . children . certifiCateKey . getView ( ) . value
536563 ) ;
537564 } ,
538565 } ,
0 commit comments