这是一个完全综合的 SDK,它让您能够访问 VoiceIt 的 API 2.0,其中包括内置用户界面和活动度检测的语音 + 面部验证和识别。
目录
UI预览
以下GIF显示了声音验证、面部验证(带有活体检测)和视频验证(未开启活体检测)的UI界面。
入门指南
在 VoiceIt.io 注册一个免费的开发者账号,并在设置页面查看您的API密钥和令牌(如下所示)。您还可以在 api.voiceit.io 上查看HTTP文档。
安装
通过CocoaPods可以获取VoiceIt2-IosSDK。要安装它,只需将以下行添加到Podfile中
pod "VoiceIt2-IosSDK"
然后在终端运行 pod install
pod install
此外,请按照以下示例将以下权限键添加到您的 info.plist 文件中
- NSCameraUsageDescription - 需要面部生物识别
- NSMicrophoneUsageDescription - 需要声音生物识别
本地安装
要在本地项目运行SDK,请克隆此存储库,并在Podfile中指定路径。例如
pod "VoiceIt2-IosSDK", :path => './VoiceIt2-IosSDK'
需求
部署目标(iOS 版本)
请确保您的项目的最低部署目标为 iOS 11。
计费
为了使用 en-US 或其他内容语言,您需要有资金的开发者账户。要在您的账户中充值,请登录至:[https://voiceit.io/login](https://voiceit.io/login) 并导航至:[https://voiceit.io/billing](https://voiceit.io/billing) 进行充值。
Voicprint 语句
请通过导航至:[https://voiceit.io/phraseManagement](https://voiceit.io/phraseManagement) 来审查您的 Voicprint 语句,以了解需要传递给 voicePrintPhrase 参数的内容。
字符串和提示
SDK 中封装视图所使用的所有字符串,以及提供给用户的提示,都可以通过编辑位于
Pods/VoiceIt2-IosSDK/Resources/Prompts.strings
的 Prompts.strings 文件中的字符串进行修改。
API 调用
初始化
Swift
首先在Swift文件中导入VoiceIt2IosSDK,然后在ViewController中初始化SDK引用,将ViewController引用作为第一个参数传入,然后传入API凭证,最后传入一个样式字典(kThemeColor可以是任何十六进制颜色代码,而kIconStyle可以是“default”或“monochrome”)。
import VoiceIt2IosSDK
class ViewController: UIViewController {
var myVoiceIt:VoiceItAPITwo?
override func viewDidLoad() {
super.viewDidLoad()
/* Reference to ViewController , API Credentials and styles dictionary*/
let styles = NSMutableDictionary(dictionary: ["kThemeColor":"#FBC132","kIconStyle":"default"])
self.myVoiceIt = VoiceItAPITwo(self, apiKey: "API_KEY_HERE", apiToken: "API_TOKEN_HERE", styles: styles)
}
}
Objective-C
首先将VoiceItAPITwo.h导入到Objective-C文件中,然后在ViewController中初始化SDK引用,将ViewController引用作为第一个参数传入。
#import "ViewController.h"
#import "VoiceItAPITwo.h"
@interface ViewController ()
@property VoiceItAPITwo * myVoiceIt;
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
/* Reference to ViewController , API Credentials and styles dictionary*/
NSMutableDictionary * styles = [[NSMutableDictionary alloc] init];
[styles setObject:@"#FBC132" forKey:@"kThemeColor"];
[styles setObject:@"default" forKey:@"kIconStyle"];
self.myVoiceIt = [[VoiceItAPITwo alloc] init:self apiKey:@"API_KEY_HERE" apiToken:@"API_TOKEN_HERE" styles: styles];
}
封装方法
封装语音注册
为给定userId(以'usr_'开头)和内容语言(如'en-US'、'es-ES'等)以及给定的短语(例如“我的面容和声音可以识别我”)创建三个语音注册。注意:调用此方法后立即显示注册视图控制器,它完全负责三个注册,包括UI,并提供相关的回调,以确定用户是否取消了注册或成功完成注册。
Swift
myVoiceIt?.encapsulatedVoiceEnrollUser("USER_ID_HERE", contentLanguage: "CONTENT_LANGUAGE_HERE", voicePrintPhrase: "my face and voice identify me", userEnrollmentsCancelled: {
print("User Enrollment Cancelled")
}, userEnrollmentsPassed: {
print("User Enrollments Passed")
})
Objective-C
[self.myVoiceIt encapsulatedVoiceEnrollUser:@"USER_ID_HERE" contentLanguage:@"CONTENT_LANGUAGE_HERE" voicePrintPhrase:@"my face and voice identify me" userEnrollmentsCancelled:^{
NSLog(@"User Enrollments Cancelled");
} userEnrollmentsPassed:^{
NSLog(@"User Enrollments Passed");
}];
封装面部注册
为指定userId(以'usr_'开头)的用户创建面部注册。注意:调用此方法时立即显示注册视图控制器,该控制器完全负责注册用户的面部,包括UI,并提供了相关的回调,指示用户是否取消了注册或成功完成了注册。
Swift
myVoiceIt?.encapsulatedFaceEnrollUser("USER_ID_HERE", userEnrollmentsCancelled: {
print("User Enrollment Cancelled")
}, userEnrollmentsPassed: {
print("User Enrollments Passed")
})
Objective-C
[self.myVoiceIt encapsulatedFaceEnrollUser:@"USER_ID_HERE" userEnrollmentsCancelled:^{
NSLog(@"User Enrollments Cancelled");
} userEnrollmentsPassed:^{
NSLog(@"User Enrollments Passed");
}];
封装视频注册
为指定userId(以'usr_'开头)的用户创建三个视频注册和指定语言(如'en-US'、'es-ES'等)以及给定的短语(如“我的面孔和声音就是我”)。注意:调用此方法时立即显示注册视图控制器,该控制器完全负责这三个注册,包括UI,并提供了相关的回调,指示用户是否取消了注册或成功完成了注册。
Swift
myVoiceIt?.encapsulatedVideoEnrollUser("USER_ID_HERE", contentLanguage: "CONTENT_LANGUAGE_HERE", voicePrintPhrase: "my face and voice identify me", userEnrollmentsCancelled: {
print("User Enrollment Cancelled")
}, userEnrollmentsPassed: {
print("User Enrollments Passed")
})
Objective-C
[self.myVoiceIt encapsulatedVideoEnrollUser:@"USER_ID_HERE" contentLanguage:@"CONTENT_LANGUAGE_HERE" voicePrintPhrase:@"my face and voice identify me" userEnrollmentsCancelled:^{
NSLog(@"User Enrollments Cancelled");
} userEnrollmentsPassed:^{
NSLog(@"User Enrollments Passed");
}];
封装语音验证
使用给定的userId(以'usr_'开头)进行用户验证。注意:立即调用此方法时,将显示一个视图控制器,用于记录和验证用户的语音,并提供有关验证成功与否以及关联的语音置信度的相关回调。
Swift
myVoiceIt?.encapsulatedVoiceVerification("USER_ID_HERE", contentLanguage: "CONTENT_LANGUAGE_HERE", voicePrintPhrase: "my face and voice identify me", userVerificationCancelled: {
print("User Cancelled Verification");
}, userVerificationSuccessful: {(voiceConfidence, jsonResponse) in
print("User Verication Successful, voiceConfidence : \(voiceConfidence)")
}, userVerificationFailed: { (voiceConfidence, jsonResponse) in
print("User Verication Failed, voiceConfidence : \(voiceConfidence)")
})
Objective-C
[self.myVoiceIt encapsulatedVoiceVerification:@"USER_ID_HERE" contentLanguage:@"CONTENT_LANGUAGE_HERE" voicePrintPhrase:@"my face and voice identify me" userVerificationCancelled:^{
NSLog(@"User Cancelled Verification");
} userVerificationSuccessful:^(float voiceConfidence, NSString * jsonResponse){
NSLog(@"User Verication Successful, voiceConfidence : %g",voiceConfidence);
} userVerificationFailed:^(float faceConfidence, float voiceConfidence, NSString * jsonResponse){
NSLog(@"User Verication Failed, voiceConfidence : %g",voiceConfidence);
}];
封装人脸验证
使用给定的userId(以'usr_'开头)和参数启用或禁用人脸活力检测进行用户验证。注意:立即调用此方法时,将显示一个包含相机预览的视图控制器,用于验证用户的脸,并提供有关验证成功与否以及关联的脸部置信度的相关回调。
Swift
myVoiceIt?.encapsulatedFaceVerification("USER_ID_HERE", doLivenessDetection:true, doAudioPrompts:true, userVerificationCancelled: {
print("User Cancelled Verification");
}, userVerificationSuccessful: {(faceConfidence, jsonResponse) in
print("User Verication Successful faceConfidence : \(faceConfidence)")
}, userVerificationFailed: { (faceConfidence, jsonResponse) in
print("User Verication Failed, faceConfidence : \(faceConfidence)")
})
Objective-C
[self.myVoiceIt encapsulatedFaceVerification:@"USER_ID_HERE" doLivenessDetection:YES doAudioPrompts:YES userVerificationCancelled:^{
NSLog(@"User Cancelled Verification");
} userVerificationSuccessful:^(float faceConfidence, NSString * jsonResponse){
NSLog(@"User Verication Successful faceConfidence : %g", faceConfidence);
} userVerificationFailed:^(float faceConfidence, NSString * jsonResponse){
NSLog(@"User Verication Failed, faceConfidence : %g",faceConfidence);
}];
封装视频验证
使用给定的userId(以'usr_'开头)、contentLanguage('en-US'、'es-ES'等)以及一个参数来启用或禁用实时检测来验证用户。注意:调用此方法后立即显示一个带有相机预览的视图控制器来验证用户,并为验证是否成功以及关联的语音和面部置信度提供相关回调。
Swift
myVoiceIt?.encapsulatedVideoVerification("USER_ID_HERE", contentLanguage: "CONTENT_LANGUAGE_HERE", voicePrintPhrase: "my face and voice identify me", doLivenessDetection:true, doAudioPrompts:true, userVerificationCancelled: {
print("User Cancelled Verification");
}, userVerificationSuccessful: {(faceConfidence, voiceConfidence, jsonResponse) in
print("User Verication Successful, voiceConfidence : \(voiceConfidence), faceConfidence : \(faceConfidence)")
}, userVerificationFailed: { (faceConfidence, voiceConfidence, jsonResponse) in
print("User Verication Failed, voiceConfidence : \(voiceConfidence), faceConfidence : \(faceConfidence)")
})
Objective-C
[self.myVoiceIt encapsulatedVideoVerification:@"USER_ID_HERE" contentLanguage:@"CONTENT_LANGUAGE_HERE" voicePrintPhrase:@"my face and voice identify me" doLivenessDetection:YES doAudioPrompts:YES userVerificationCancelled:^{
NSLog(@"User Cancelled Verification");
} userVerificationSuccessful:^(float faceConfidence, float voiceConfidence, NSString * jsonResponse){
NSLog(@"User Verication Successful, voiceConfidence : %g , faceConfidence : %g",voiceConfidence, faceConfidence);
} userVerificationFailed:^(float faceConfidence, float voiceConfidence, NSString * jsonResponse){
NSLog(@"User Verication Failed, voiceConfidence : %g , faceConfidence : %g",voiceConfidence, faceConfidence);
}];
封装语音识别
使用给定的groupId(以'grp_'开头)识别组中的用户。注意:调用此方法后立即显示一个视图控制器,记录并识别用户的语音,并为识别是否成功以及关联的语音置信度提供相关回调。
Swift
myVoiceIt?.encapsulatedVoiceIdentification("GROUP_ID_HERE", contentLanguage: "CONTENT_LANGUAGE_HERE", voicePrintPhrase: "my face and voice identify me", userIdentificationCancelled: {
print("User Cancelled Identification");
}, userIdentificationSuccessful: {(voiceConfidence, foundUserId, jsonResponse) in
print("User Identification Successful, userId : \(foundUserId) voiceConfidence : \(voiceConfidence)")
}, userIdentificationFailed: { (voiceConfidence, jsonResponse) in
print("User Identification Failed, voiceConfidence is \(voiceConfidence)")
})
Objective-C
[self.myVoiceIt encapsulatedVoiceIdentification:@"GROUP_ID_HERE" contentLanguage:@"CONTENT_LANGUAGE_HERE" voicePrintPhrase:@"my face and voice identify me" userIdentificationCancelled:^{
NSLog(@"User Cancelled Identification");
} userIdentificationSuccessful:^(float voiceConfidence, NSString * foundUserId, NSString * jsonResponse){
NSLog(@"User Identification Successful, userId: %@ voiceConfidence : %g",foundUserId, voiceConfidence);
} userIdentificationFailed:^(float faceConfidence, float voiceConfidence, NSString * jsonResponse){
NSLog(@"User Identification Failed, voiceConfidence : %g",voiceConfidence);
}];
封装人脸识别
使用给定的groupId(以'grp_'开头)和参数来启用或禁用活体检测来在用户组中识别用户。注意:立即调用此方法时,它将显示一个带有相机预览的视图控制器,以识别用户的面部并提供关于识别是否成功以及相关面部置信度的相关回调。
Swift
myVoiceIt?.encapsulatedFaceIdentification("GROUP_ID_HERE", doLivenessDetection:true, doAudioPrompts:true, userIdentificationCancelled: {
print("User Cancelled Identification");
}, userIdentificationSuccessful: {(faceConfidence, foundUserId, jsonResponse) in
print("User Identification Successful userId : \(foundUserId) faceConfidence : \(faceConfidence)")
}, userIdentificationFailed: { (faceConfidence, jsonResponse) in
print("User Identification Failed, faceConfidence is \(faceConfidence)")
})
Objective-C
[self.myVoiceIt encapsulatedFaceIdentification:@"GROUP_ID_HERE" doLivenessDetection:YES doAudioPrompts:YES userIdentificationCancelled:^{
NSLog(@"User Cancelled Identification");
} userIdentificationSuccessful:^(float faceConfidence, NSString * foundUserId, NSString * jsonResponse){
NSLog(@"User Identification Successful userId: %@ faceConfidence : %g", foundUserId, faceConfidence);
} userIdentificationFailed:^(float faceConfidence, NSString * jsonResponse){
NSLog(@"User Identification Failed, faceConfidence : %g",faceConfidence);
}];
封装视频识别
使用给定的groupId(以'grp_'开头)、内容语言(如'en-US'、'es-ES'等)和参数来启用或禁用活体检测来在用户组中识别用户。注意:立即调用此方法时,它将显示一个带有相机预览的视图控制器,以识别用户并提供了有关识别是否成功以及相关语音和面部置信度的相关回调。
Swift
myVoiceIt?.encapsulatedVideoIdentification("GROUP_ID_HERE", contentLanguage: "CONTENT_LANGUAGE_HERE", voicePrintPhrase: "my face and voice identify me", doLivenessDetection:true, doAudioPrompts:true, userIdentificationCancelled: {
print("User Cancelled Identification");
}, userIdentificationSuccessful: {(faceConfidence, voiceConfidence, foundUserId, jsonResponse) in
print("User Identification Successful, voiceConfidence is \(voiceConfidence), faceConfidence is \(faceConfidence)")
}, userIdentificationFailed: { (faceConfidence, voiceConfidence, jsonResponse) in
print("User Identification Failed, voiceConfidence is \(voiceConfidence), faceConfidence is \(faceConfidence)")
})
[self.myVoiceIt encapsulatedVideoIdentification:@"GROUP_ID_HERE" contentLanguage:@"CONTENT_LANGUAGE_HERE" voicePrintPhrase:@"my face and voice identify me" doLivenessDetection:YES doAudioPrompts:YES userIdentificationCancelled:^{
NSLog(@"User Cancelled Identification");
} userIdentificationSuccessful:^(float faceConfidence, float voiceConfidence, NSString * foundUserId, NSString * jsonResponse){
NSLog(@"User Identification Successful, userId: %@, voiceConfidence : %g , faceConfidence : %g", foundUserId, voiceConfidence, faceConfidence);
} userIdentificationFailed:^(float faceConfidence ,float voiceConfidence, NSString * jsonResponse){
NSLog(@"User Identification Failed, voiceConfidence : %g , faceConfidence : %g",voiceConfidence, faceConfidence);
}];
用户API调用
获取所有用户
获取与apiKey相关的所有用户
myVoiceIt?.getAllUsers({
jsonResponse in
print("JSON RESPONSE: \(jsonResponse!)")
})
[self.myVoiceIt getAllUsers:^(NSString * jsonResponse){
NSLog(@"JSONResponse: %@", jsonResponse);
}];
创建用户
创建新用户
myVoiceIt?.createUser({
jsonResponse in
print("JSON RESPONSE: \(jsonResponse!)")
})
[self.myVoiceIt createUser:^(NSString * jsonResponse){
NSLog(@"JSONResponse: %@", jsonResponse);
}];
检查特定用户是否存在
检查是否存在特定用户(userId以'usr_'开头)
myVoiceIt?.checkUserExists("USER_ID_HERE", callback: {
jsonResponse in
print("JSON RESPONSE: \(jsonResponse!)")
})
[self.myVoiceIt checkUserExists:@"USER_ID_HERE" callback:^(NSString * jsonResponse){
NSLog(@"JSONResponse: %@", jsonResponse);
}];
获取用户所属的组列表
获取给定userId(以'usr_'开头)的用户所属的组列表
myVoiceIt?.getGroupsForUser("USER_ID_HERE", callback: {
jsonResponse in
print("JSON RESPONSE: \(jsonResponse!)")
})
[self.myVoiceIt getGroupsForUser:@"USER_ID_HERE" callback:^(NSString * jsonResponse){
NSLog(@"JSONResponse: %@", jsonResponse);
}];
删除特定用户
删除具有给定userId(以'usr_'开头)的用户
Swift
myVoiceIt?.deleteUser("USER_ID_HERE", callback: {
jsonResponse in
print("JSON RESPONSE: \(jsonResponse!)")
})
Objective-C
[self.myVoiceIt deleteUser:@"USER_ID_HERE" callback:^(NSString * jsonResponse){
NSLog(@"JSONResponse: %@", jsonResponse);
}];
分组API调用
获取所有组
获取与apiKey关联的所有组
Swift
myVoiceIt?.getAllGroups({
jsonResponse in
print("JSON RESPONSE: \(jsonResponse!)")
})
Objective-C
[self.myVoiceIt getAllGroups:^(NSString * jsonResponse){
NSLog(@"JSONResponse: %@", jsonResponse);
}];
获取特定组
返回对应groupId(以'grp_'开头)的组信息
Swift
myVoiceIt?.getGroup("GROUP_ID_HERE", callback: {
jsonResponse in
print("JSON RESPONSE: \(jsonResponse!)")
})
Objective-C
[self.myVoiceIt getGroup:@"GROUP_ID_HERE" callback:^(NSString * jsonResponse){
NSLog(@"JSONResponse: %@", jsonResponse);
}];
检查组是否存在
检查给定groupId(以'grp_'开头)的组是否存在
Swift
myVoiceIt?.groupExists("GROUP_ID_HERE", callback: {
jsonResponse in
print("JSON RESPONSE: \(jsonResponse!)")
})
Objective-C
[self.myVoiceIt groupExists:@"GROUP_ID_HERE" callback:^(NSString * jsonResponse){
NSLog(@"JSONResponse: %@", jsonResponse);
}];
创建组
使用给定描述创建一个新组
Swift
myVoiceIt?.createGroup("A Sample Group Description", callback: {
jsonResponse in
})
Objective-C
[self.myVoiceIt createGroup:@"A Sample Group Description" callback:^(NSString * jsonResponse){
NSLog(@"JSONResponse: %@", jsonResponse);
}];
添加用户到组
将给定userId(以'usr_'开头)的用户添加到给定groupId(以'grp_'开头)的组中
Swift
myVoiceIt?.addUser(toGroup: "GROUP_ID_HERE", userId: "USER_ID_HERE", callback: {
jsonResponse in
print("JSON RESPONSE: \(jsonResponse!)")
})
Objective-C
[self.myVoiceIt addUserToGroup:@"GROUP_ID_HERE" userId:@"USER_ID_HERE" callback:^(NSString * jsonResponse){
NSLog(@"JSONResponse: %@", jsonResponse);
}];
从组中删除用户
从给定groupId(以'grp_'开头)的组中删除给定userId(以'usr_'开头)的用户
Swift
myVoiceIt?.removeUser(fromGroup: "GROUP_ID_HERE", userId: "USER_ID_HERE", callback: {
jsonResponse in
print("JSON RESPONSE: \(jsonResponse!)")
})
Objective-C
[self.myVoiceIt removeUserFromGroup:@"GROUP_ID_HERE" userId:@"USER_ID_HERE" callback:^(NSString * jsonResponse){
NSLog(@"JSONResponse: %@", jsonResponse);
}];
删除组
通过groupId(以'grp_'开头)删除组,注意:此调用不会删除任何用户,只是简单地删除组并将用户从组中解关联。
Swift
myVoiceIt?.deleteGroup("GROUP_ID_HERE", callback: {
jsonResponse in
print("JSON RESPONSE: \(jsonResponse!)")
})
Objective-C
[self.myVoiceIt deleteGroup:@"GROUP_ID_HERE" callback:^(NSString * jsonResponse){
NSLog(@"JSONResponse: %@", jsonResponse);
}];
注册API调用
获取所有语音注册
获取给定userId(以'usr_'开头)用户的全部语音注册。
Swift
myVoiceIt?.getAllVoiceEnrollments("USER_ID_HERE", callback: {
jsonResponse in
print("JSON RESPONSE: \(jsonResponse!)")
})
Objective-C
[self.myVoiceIt getAllVoiceEnrollments:@"USER_ID_HERE" callback:^(NSString * jsonResponse){
NSLog(@"JSONResponse: %@", jsonResponse);
}];
获取所有人脸注册
获取给定userId(以'usr_'开头)的用户所有人脸注册
Swift
myVoiceIt?.getAllFaceEnrollments("USER_ID_HERE", callback: {
jsonResponse in
print("JSON RESPONSE: \(jsonResponse!)")
})
Objective-C
[self.myVoiceIt getAllFaceEnrollments:@"USER_ID_HERE" callback:^(NSString * jsonResponse){
NSLog(@"JSONResponse: %@", jsonResponse);
}];
获取所有视频注册
获取给定userId(以'usr_'开头)的用户所有视频注册
Swift
myVoiceIt?.getAllVideoEnrollments("USER_ID_HERE", callback: {
jsonResponse in
print("JSON RESPONSE: \(jsonResponse!)")
})
Objective-C
[self.myVoiceIt getAllVideoEnrollments:@"USER_ID_HERE" callback:^(NSString * jsonResponse){
NSLog(@"JSONResponse: %@", jsonResponse);
}];
创建语音预订
为给定userId(以'usr_'开头)、内容语言('en-US'、'es-ES'等)、开发者账户中批准的短语和音频文件创建用户的语音预订。
Swift
myVoiceIt?.createVoiceEnrollment("USER_ID_HERE", contentLanguage: "CONTENT_LANGUAGE_HERE", audioPath: "FILE_PATH_TO_VOICE_ENROLLMENT_HERE", phrase: "VOICEPRINT_PHRASE_HERE", callback: {
jsonResponse in
print("JSON RESPONSE: \(jsonResponse!)")
})
Objective-C
[self.myVoiceIt createVoiceEnrollment:@"USER_ID_HERE" contentLanguage: @"CONTENT_LANGUAGE_HERE" audioPath: @"FILE_PATH_TO_VOICE_ENROLLMENT_HERE" phrase: @"VOICEPRINT_PHRASE_HERE" callback:^(NSString * jsonResponse){
NSLog(@"JSONResponse: %@", jsonResponse);
} ];
为给定userId(以'usr_'开头)和视频文件创建用户的面部预订。
创建用户的面部预订。
Swift
myVoiceIt?.createFaceEnrollment("USER_ID_HERE", videoPath: "FILE_PATH_TO_FACE_ENROLLMENT_HERE", callback: {
jsonResponse in
print("JSON RESPONSE: \(jsonResponse!)")
})
Objective-C
[self.myVoiceIt createFaceEnrollment:@"USER_ID_HERE" videoPath: @"FILE_PATH_TO_FACE_ENROLLMENT_HERE" callback:^(NSString * jsonResponse){
NSLog(@"JSONResponse: %@", jsonResponse);
} ];
创建视频注册
为指定userId(以'usr_'开头)的用户创建视频注册,内容语言(如'en-US'、'es-ES'等),从开发者账户批准的短语和视频文件。
Swift
myVoiceIt?.createVideoEnrollment("USER_ID_HERE", contentLanguage: "CONTENT_LANGUAGE_HERE", videoPath: "FILE_PATH_TO_VIDEO_ENROLLMENT_HERE", phrase: "VOICEPRINT_PHRASE_HERE", callback: {
jsonResponse in
print("JSON RESPONSE: \(jsonResponse!)")
})
Objective-C
[self.myVoiceIt createVideoEnrollment:@"USER_ID_HERE" contentLanguage: @"CONTENT_LANGUAGE_HERE" videoPath: @"FILE_PATH_TO_VIDEO_ENROLLMENT_HERE" phrase: @"VOICEPRINT_PHRASE_HERE" callback:^(NSString * jsonResponse){
NSLog(@"JSONResponse: %@", jsonResponse);
} ];
删除所有注册
删除指定userId(以'usr_'开头)的用户的全部注册。
Swift
myVoiceIt?.deleteAllEnrollments("USER_ID_HERE", callback: {
jsonResponse in
print("JSON RESPONSE: \(jsonResponse!)")
})
Objective-C
[self.myVoiceIt deleteAllEnrollments:@"USER_ID_HERE" callback:^(NSString * jsonResponse){
NSLog(@"JSONResponse: %@", jsonResponse);
}];
API验证调用
语音验证
使用指定的userId(以'usr_'开头),内容语言(如'en-US'、'es-ES'等),开发者账户中的批准短语和音频文件验证用户的语音。
Swift
myVoiceIt?.voiceVerification("USER_ID_HERE", contentLanguage: "CONTENT_LANGUAGE_HERE", audioPath: "FILE_PATH_TO_VOICE_FOR_VERIFICATION_HERE", phrase: "VOICEPRINT_PHRASE_HERE", callback: {
jsonResponse in
print("JSON RESPONSE: \(jsonResponse!)")
})
Objective-C
[self.myVoiceIt voiceVerification:@"USER_ID_HERE" contentLanguage:@"CONTENT_LANGUAGE_HERE" audioPath: @"FILE_PATH_TO_VOICE_FOR_VERIFICATION_HERE" phrase: @"VOICEPRINT_PHRASE_HERE" callback:^(NSString * jsonResponse){
NSLog(@"JSONResponse: %@", jsonResponse);
} ];
人脸验证
使用指定的userId(以'usr_'开头)和视频文件验证用户的脸。
Swift
myVoiceIt?.faceVerification("USER_ID_HERE", videoPath: "FILE_PATH_TO_VIDEO_FOR_FACE_VERIFICATION_HERE", callback: {
jsonResponse in
print("JSON RESPONSE: \(jsonResponse!)")
})
Objective-C
[self.myVoiceIt faceVerification:@"USER_ID_HERE" videoPath: @"FILE_PATH_TO_VIDEO_FOR_FACE_VERIFICATION_HERE" callback:^(NSString * jsonResponse){
NSLog(@"JSONResponse: %@", jsonResponse);
} ];
视频验证
使用指定的userId(以'usr_'开头),内容语言(如'en-US'、'es-ES'等),开发者账户中的批准短语和视频文件验证用户的脸和语音。
Swift
myVoiceIt?.videoVerification("USER_ID_HERE", contentLanguage: "CONTENT_LANGUAGE_HERE", videoPath: "FILE_PATH_TO_VIDEO_FOR_VERIFICATION_HERE", phrase: "VOICEPRINT_PHRASE_HERE", callback: {
jsonResponse in
print("JSON RESPONSE: \(jsonResponse!)")
})
Objective-C
[self.myVoiceIt videoVerification:@"USER_ID_HERE" contentLanguage:@"CONTENT_LANGUAGE_HERE" videoPath: @"FILE_PATH_TO_VIDEO_FOR_VERIFICATION_HERE" phrase: @"VOICEPRINT_PHRASE_HERE" callback:^(NSString * jsonResponse){
NSLog(@"JSONResponse: %@", jsonResponse);
} ];
身份识别 API 调用
语音识别
通过给定的 groupId(以 'grp_' 开头)和 contentLanguage(例如 'en-US'、'es-ES' 等)、开发者账户中批准的短语和 audioFile 识别群组内的用户语音。
Swift
myVoiceIt?.voiceIdentification("GROUP_ID_HERE", contentLanguage: "CONTENT_LANGUAGE_HERE", audioPath: "FILE_PATH_TO_VOICE_FOR_IDENTIFICATION_HERE", phrase: "VOICEPRINT_PHRASE_HERE", callback: {
jsonResponse in
print("JSON RESPONSE: \(jsonResponse!)")
})
Objective-C
[self.myVoiceIt voiceIdentification:@"GROUP_ID_HERE" contentLanguage:@"CONTENT_LANGUAGE_HERE" audioPath: @"FILE_PATH_TO_VOICE_FOR_IDENTIFICATION_HERE"
phrase: @"VOICEPRINT_PHRASE_HERE" callback:^(NSString * jsonResponse){
NSLog(@"JSONResponse: %@", jsonResponse);
} ];
面部识别
通过给定的 groupId(以 'grp_' 开头)和 videoFile 识别群组内的用户面部。
Swift
myVoiceIt?.faceIdentification("GROUP_ID_HERE", videoPath: "FILE_PATH_TO_VIDEO_FOR_IDENTIFICATION_HERE",
jsonResponse in
print("JSON RESPONSE: \(jsonResponse!)")
})
Objective-C
[self.myVoiceIt faceIdentification:@"GROUP_ID_HERE" videoPath: @"FILE_PATH_TO_VIDEO_FOR_IDENTIFICATION_HERE" callback:^(NSString * jsonResponse){
NSLog(@"JSONResponse: %@", jsonResponse);
} ];
视频识别
使用开发者账户的批准短语、groupId(以'grp_'开头)和contentLanguage(如'zh-CN'、'es-ES'等),以及videoFile,在群组内部识别用户的语音和面部。
Swift
myVoiceIt?.videoIdentification("GROUP_ID_HERE", contentLanguage: "CONTENT_LANGUAGE_HERE", videoPath: "FILE_PATH_TO_VIDEO_FOR_IDENTIFICATION_HERE", phrase: "VOICEPRINT_PHRASE_HERE", callback: {
jsonResponse in
print("JSON RESPONSE: \(jsonResponse!)")
})
Objective-C
[self.myVoiceIt videoIdentification:@"GROUP_ID_HERE" contentLanguage:@"CONTENT_LANGUAGE_HERE" videoPath: @"FILE_PATH_TO_VIDEO_FOR_IDENTIFICATION_HERE" phrase: @"VOICEPRINT_PHRASE_HERE" callback:^(NSString * jsonResponse){
NSLog(@"JSONResponse: %@", jsonResponse);
} ];
作者
VoiceIt Technologies, [email protected]
许可协议
VoiceIt2-IosSDK在MIT许可下可用。有关更多信息,请参阅LICENSE文件。