我用很多视图制作动画(..) [UIView commitAnimations]
.现在我想检查"拍摄"的视图是否触及另一个视图.有谁知道如何实现这个?也许if(view.frame.origin.x==anotherview.frame.origin.x){
}
..
我想使用此Google API(仅用于测试):
https://www.google.com/speech-api/v1/recognize?xjerr=1&client=chromium&lang=en-US
我的问题是:我应该如何向此URL发送POST请求?我正在使用:
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *recDir = [paths objectAtIndex:0];
NSURL *url = [NSURL fileURLWithPath:[NSString stringWithFormat:@"%@/recordTest.flac", recDir]];
NSData *myData = [NSData dataWithContentsOfFile:[NSString stringWithFormat:@"%@/recordTest.flac", recDir]];
//NSString *audio = [NSString stringWithContentsOfFile:[NSString stringWithFormat:@"%@/recordTest.flac", recDir]];
NSMutableURLRequest *request = [[NSMutableURLRequest alloc]
initWithURL:[NSURL
URLWithString:@"https://www.google.com/speech-api/v1/recognize?xjerr=1&client=chromium&lang=en-US"]];
[request setHTTPMethod:@"POST"];
//set headers
[request addValue:@"Content-Type" forHTTPHeaderField:@"audio/x-flac; rate=16000"];
[request addValue:@"audio/x-flac; rate=16000" forHTTPHeaderField:@"Content-Type"];
NSString *requestBody = [[NSString alloc] initWithFormat:@"Content=%@", myData];
[request setHTTPBody:[requestBody dataUsingEncoding:NSASCIIStringEncoding]];
[request setValue:[NSString stringWithFormat:@"%d",[myData length]] forHTTPHeaderField:@"Content-length"];
NSHTTPURLResponse* urlResponse = nil;
NSError *error = [[NSError alloc] init]; …
Run Code Online (Sandbox Code Playgroud) 有没有人知道如何使用FFmpeg for iOS在Objective-C中将.mp3转换为.flac?或其他转换解决方案?我想使用谷歌的语音识别API,当然他们只支持.flac音频.