HeyWatch 2.0.0

HeyWatch 2.0.0

测试已测试
语言语言 Obj-CObjective C
许可证 MIT
发布最后发布2015年1月

Bruno Celeste 维护。



HeyWatch 2.0.0

  • 作者:
  • Bruno Celeste

使用 HeyWatch 编码视频的 Objective-C 客户端库

安装

运行 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 许可下发布。