# Guiji RTC (1.0) iOS-SDK usage documentation

new: 2021-10-30 revised: 2022-04-08

# 1. material preparation

GJDigitalSDK.framework、WebRTC.framework

# development environment

Development Tools: Xcode

# III. Citing sdk (see GJDigitalSDKDemo (opens new window))

  1. Drag and drop the GJDigitalSDK.framework and webrtc files to the project's resource directory: image.png
  2. Add camera permissions and recording permissions to info.plist files . image.png

# the module uses a sample code


Detailed GJDigitalSDKDemo, key code example:

    //One iceserver gets multiple iceserver configurations (relay or cluster), so it is placed in the array
    
    NSMutableArray * stunlist=[[NSMutableArray alloc] init];
    DigitalSever * digitalSever=[[DigitalSever alloc] init];
    digitalSever.urlStrings=@[@"stun:47.114.110.197:23478"];
    digitalSever.username=@"";
    digitalSever.credential=@"";
    [stunlist addObject:digitalSever];
    
    [DigitalConfig shareConfig].serverIP = @"vshow.guiji.ai";// The signaling control server address
    [DigitalConfig shareConfig].servePort = 5222;// Signaling controls the server port
    [DigitalConfig shareConfig].robotCode = @"1526099699893932032";/// The robot number is used to select the object to which to dock
    [DigitalConfig shareConfig].robotMode = @"bot";//Client-driven
    [DigitalConfig shareConfig].iceList = [stunlist copy];///// stun address,ice server
    [DigitalConfig shareConfig].userJID = @"iray-proxy-duix@guiji.ai";/// The other side of the conversation id,default iray-proxy@guiji.ai
    [DigitalConfig shareConfig].isShowLocalVideo = YES;//Whether to display local video view
    [DigitalConfig shareConfig].isShowLocalAudio = YES;/// Whether to play local voice(default YES)
    [DigitalConfig shareConfig].isOpenCamera = YES;//Whether to turn on the camera
    [DigitalConfig shareConfig].usingFrontCamera = YES;//Whether to use the front camera
    [DigitalConfig shareConfig].openAsr = @"true";/// openAsr(Not required)true:Turn on Recognition,false:Do not turn on recognition
    [DigitalConfig shareConfig].groupId = @"duix-oversea";/// Internal use dhrtcpc,client us duix-public, default dhrtcdev
    [DigitalConfig shareConfig].isAsr = NO;// One sentence recognition(Audio and video are not used):no,Long link recognition:yes,
    [DigitalConfig shareConfig].uuid = [NSString stringWithFormat:@"%@", [[DigitalConfig shareConfig] uuidString]];///// Each new session generates a unique number that cannot be repeated

    //load the view and agency
    [DigitalManager manager].remote_view=self.view;//Remote video
    [DigitalManager manager].delegate=self;//angency
    [[DigitalManager manager] toStart];//start to communicat
    [DigitalManager manager].local_view=self.localView;//local video

# SDK KEY INTERFACES

/*

  • Start initializing communication and whether to turn on the local camera / -(void)toStart; /

  • End communication / -(void)to Stop; /

  • the client controls the on and off of asr recognition

  • isOpen yes: open, no: close */

  • (void)changeAsrEvent:(BOOL)isOpenAsr; /* * Turn on the local camera */

  • (void)toOpenCamera; /* *Turn off the local camera / -(void)to StopCamera; / * Send speaking content to the central control *robotMode=@"bot" mode sends answer event *robotMode=@"" client mode sends Command event */

  • (void)sendContent:(NSString )content; / * Send text to the central control (drive mode robotMode is empty). */

  • (void)commandEvent:(NSString )content; / * Conversation mode with answer event * @param content voice address or text content * @param isAudio is voice (yes:speech, no:text). */

  • (void)answerCommandEvent:(NSString *)content isAudio:(BOOL)isAudio;

//YES Turn off mute ,NO Mute -(void)setMute:(BOOL)isEnabled;

/* *Interrupt digital person broadcasting */

  • (void)toBreakDigital;

/* *Agree custom events with the server */

  • (void)toCustomDic:(NSDictionary*)dic;

# SDK PROXY

@protocol DigitalViewDelegate @optional /* *Error Message Return Code */

  • (void)onError:(NSInteger)error_code; /* * Session established successfully */
  • (void)onChatCreate; /* * Remote video communication completed */
  • (void)onRTCReomteSuccess; /* *Notify the client after the center control obtains the render-side information *@param ID id *@param name name */
  • (void)onRender:(NSString *) ID name:(NSString )name; / * The central control gets the subtitles and the words and the words instructions to the client after the playback operation * @param dic subtitles and the words instructions */
  • (void)onCommand:(NSDictionary )dic; / * The current midrange callback event *@param msg event name */
  • (void)onCustomMsg:(NSString *)msg; /**webrtc connection status callback *@param state RTCIceConnectionState */
  • (void)didIceConnectionChange:(RTCIceConnectionState)state; /* * Notify the client that the client is busy after the center control cannot get the rendering side information */
  • (void)onBusy; /* * The center control ends the call and sends a bye event */
  • (void)onByeBye; /* * Whether the digital person was successfully loaded */
  • (void)onVideoShow:(BOOL)isSuccess :(float)progress; /* * Get a video stream of a local video */
  • (void)capture:(RTCVideoCapturer *)capture didCaptureVideoFrame:(RTCVideoFrame *)frame;

@end