The VeriShow SDK aims to provide text and video chat functionality to native iOSapps.
Overview
The SDK contains two separated modules:
- VeriShow Audio/Video (A/V) SDK Module – This provides Audio/Video functionality within the VeriShow session (can be also be completely independent from the session).
- VeriShow Session SDK Module – This module provides text chat feature within the VeriShow session.
The combination of the two modules provides full text and video chat capabilities to an iOS native application.
This document describes how to integrate the two modules inside a native application.
Prerequisites
Hardware & Software Requirements
- Phone – iPhone 4s and above.
- iOS – any iOS version.
- Network – Network 3G and above (WiFi recommended where possible).
- Architecture – 32 bit and 64 bit supported and Armv7 and above.
Required iOS Linked Frameworks (from the native iOS Framework)
- libicucore.tbd
- AVFoundation.framework
- CoreMedia.framework
- AudioToolBox.framework
- VideoToolbox.framework
- SystemConfiguration.framework
- MobileCoreServices.framework
- OpenGLES.framework
- GLKit.framework
Required custom Linked Frameworks for Audio/Video
- libWebRTC.a
- libVerishowAudioVideoFramework.a
Required custom Linked Frameworks for chat
- Pods.framework
- JSQSystemSoundPlayer.framework
- JSQMessegesViewController.framework
- Socket_IO_Client_Swift.framework
The custom frameworks can be downloaded from:
The Chat Framework
Adding the Chat Framework
Please follow the steps below in order to add the chat functionality in the application:
- Add the custom frameworks related for chat (described above).
- Add the “VerishowSocketIO.h” and “VerishowAudioVideo.h” to the root of the application.
- Disable bit-code by setting ” ENABLE_BITCODE “ to false.
- Add user-defined settings “STRIP_BITCODE_FROM_COPIED_FILES” to NO
- Add “NSAppTransportSecurity” to application-Info.plist:
Initializing the Chat Framework (Creating a visit):
- When the application is loaded, add the following code. Please ensure to change the aac parameter with the provided account activation code (contact your VeriShow account manager to obtain that)
self.vsSocket=[[VerishowSessionSocketIO alloc] init ]; UIWindow *window = [UIApplication sharedApplication].keyWindow; UIViewController *rootViewController = window.rootViewController; [self.vsSocket initVerishow:@"https://platform.verishow.com" aac:@"1244723128644" applictionContainer:rootViewController.view]; [self.vsSocket startVisit];
- When agent’s availability status changes, a notification event is fired:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(agentAvailable:) name:@"VerishowSession.agentAvailable" object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(agentUnAvailable:) name:@"VerishowSession.agentUnAvailable" object:nil];
When an agent is available, a visitor can engage the agent by clicking on the live help button.
When an agent is not available an alert can be shown that no agents are available at the present.
Making the call
When agent is available (see above) and the visitor clicks the live help button, a call can be established by adding the following:
[self.vsSocket createVerishowConnection]; [self.vsSocket makeTheCall];
Audio / Video Chat Framework
Adding Audio/Video functionality
When there is a need to add video chat capabilities to an existing text chat, the audio video object should be initialized when the chat starts. When the chat starts a notification event is fired, which holds the room number information for initializing the audio/video object as follows:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(verishowSessionStarted:) name:@"VerishowSession.chatStarted" object:nil]; -(void)verishowSessionStarted:(NSNotification*)notification{ NSString* roomNumber=[notification userInfo][@"1"]; [self startVerishowAudioVideo:roomNumber]; } -(void)startVerishowAudioVideo:(NSString*)roomNmuber{ NSLog(@"started startVerishowAudioVideo,roomNmuber = %@",roomNmuber); self.localVideoContainer=[[UIView alloc] initWithFrame:CGRectMake(0, 0, 140, 190)]; self.remoteVideoContainer=[[UIView alloc] initWithFrame:CGRectMake(0, 0, 360, 240)]; BOOL autoStartAv=NO;//wXh NSString* signallingServerURL=@"rtc.verishow.com"; BOOL useDefaultAVControls=YES; if(self.verishowAv==nil) { self.verishowAv=[[VerishowAudioVideo alloc] initilizeVerishowVideo]; } // Once createConnection is called a permission request for audio video will popup to the user. self.verishowAv createConnection:autoStartAv roomName:roomNmuber signalingServerUrl:signallingServerURL localVideoView:self.localVideoContainer remoteVideoView:self.remoteVideoContainer AVContainerView:self.view useDefaultAvControlButtons:useDefaultAVControls]; }
Notification Events
Audio/Video Notification events
Notification Name | Indicates that |
VerishowAudioVideo.agentConnectedEvent | The agent started audio/video |
VerishowAudioVideo.disconnectedFirewall | There is a an audio/video server connection error due to firewall restrictions. |
VerishowAudioVideo.connectionLost | A connection was established but got lost. |
VerishowAudioVideo.agentStoppedAudioVideo | The agent has stopped his/her audio/video. |
VerishowAudioVideo.cannotCaptureAudioVideoDevice | The audio video device was inaccessible. |
Text Chat Notification events
Notification Name | Indicates that |
VerishowSession.agentAvailable | The agent is available to take calls |
VerishowSession.agentUnAvailable | The agent is unavailable to take calls |
VerishowSession.chatStarted | The text chat started |
Sample Application
The sample application holds a simple example on how to add a “live help button” and make a call to an agent.
When testing, please make sure to update the AAC to the one provided by your VeriShow account manager.
Sample application can be downloaded from:
Support
For assistance with the above SDK, please contact your account manager or email [email protected]