Joke Collection Website - Public benefit messages - Use of Baidu voice API

Use of Baidu voice API

//Import header file

# import " bdrecognizerviewcontroller . h "

# import " bdrecognizerviewdelegate . h "

# import " bdvoicerecognitionclient . h "

# import " bdvrrawdatacrecognizer . h "

# import " BDVRFileRecognizer.h "

# Import "JSONKit.h"

//JSONKit closes the arc.

-fno-objc-arc

//Add Library

libc++。 tbd,libz. 1.2.5.tbd,? AudioToolbox.framework,? AVFoundation.framework,? CFNetwork.framework,? CoreLocation.framework,? CoreTelephony.framework? SystemConfiguration.framework,GLKit.framework

//comply with the protocol of BDRecognizerViewDelegate.

//Define some attributes

BDRecognizerViewController * bdrv;

BDRecognizerViewParamsObject * bdvp;

UILabel * label; //Please initialize yourself.

UIButton * button; //Please initialize yourself.

/in? Initializing and using API in viewDidLoad

BD theme * me =[BD theme lightred theme];

bdrv =[[BDRecognizerViewController alloc]init with origin:CGPointMake(20, 100)with theme:me];

bdrv.enableFullScreenMode = YES

bdrv.delegate = self

bdvp =[[BDRecognizerViewParamsObject alloc]init];

bdvp . API key = @ " pgk 2 MK 3 azl 2 uz 5y 6 cydqtmdr ";

bdvp . secret key = @ " 62c 14997 cf 54 b 83 c 94 fad 2 f 93 D8 BC 88 b ";

//In the case of clicking the button,

[bdrv startWithParams:bdvp];

//Call the method in the BDRecognizerViewDelegate proxy.

//Return the speech recognition result.

-(void)onEndWithViews:(BDRecognizerViewController *)aBDRecognizerViewController with results:(NSArray *)are results {

//Add the obtained text to the text control.

_ label . text =[[[aResults last object]last object]all keys]last object];

}

//Record data return

-(void)onrecorddata arrived:(ns data *)recordData sample rate:(int)sample rate {

}

//End of recording

-(void) has been recorded {

}