运行 pod install
以安装依赖项。
使用 API 请求生成器 生成与您的特定工作流程匹配的配置文件。
例如,`heywatch.conf`
var s3 = s3://accesskey:secretkey@mybucket
set source = http://yoursite.com/media/video.mp4
set webhook = http://mysite.com/webhook/heywatch
-> mp4 = $s3/videos/video.mp4
-> webm = $s3/videos/video.webm
-> jpg_300x = $s3/previews/thumbs_#num#.jpg, number=3
以下是将配置文件提交的 Objective-C 代码
#import "HeyWatch.h"
NSString *apiKey = @"api-key";
// Reading the config from the heywatch.conf file
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"heywatch" ofType:@"conf"];
NSError *error;
NSString *config = [NSString stringWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:&error];
if(error) {
NSLog(@"Error reading config file: %@", error.localizedDescription);
return;
}
[HeyWatch submit:config withApiKey:apiKey complete:^(id job, NSError *error) {
if([[job objectForKey:@"status"] isEqualToString:@"ok"]) {
NSLog(@"ID: %@", [job objectForKey:@"id"]);
} else {
NSLog(@"Error (%@): %@", [job objectForKey:@"error_code"], [job objectForKey:@"message"]);
}
}];
在 MIT 许可下发布。