Joke Collection Website - Public benefit messages - Use of Baidu voice API
Use of Baidu voice API
# 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 {
}
- Related articles
- Why can't the heroband bracelet receive short messages?
- What harm does it do for the elderly to watch mobile phones for a long time?
- What's the difference between being hacked and turning it off?
- Iqiyi business executives respond to rumors of resignation: fake news
- I got another harassing call today. The number is 1479822 1025. I checked. It's from Songyuan, Jilin.
- /kloc-You cannot create online banking under the age of 0/6. Is it ok to bind the SMS prompt of your mobile phone number?
- How does Apple stop spam calls?
- The balance of etc account is insufficient, and the deduction is unsuccessful.
- I wish you a happy Mid-Autumn Festival during the epidemic.
- How to send a message to inform relatives and friends after the death of a loved one?