Skip to content
Go interface for Zencoder API
Go
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
.travis.yml
AUTHORS
BUILD_DEPENDENCIES
CONTRIBUTING.md
LICENSE
README.md
accounts.go
accounts_test.go
inputs.go
inputs_test.go
jobs.go
jobs_test.go
outputs.go
outputs_test.go
reports.go
reports_test.go
settings.go Improved coverage over 90% Nov 21, 2013
zencoder.go
zencoder_test.go

README.md

zencoder

Build Status Coverage Status

Go integration for Zencoder API video transcoding service.

Requirements

  • Go 1.1 or higher
  • A Zencoder account/API key (get one at app.zencoder.com)

Documentation

Godoc documentation is available at http://godoc.org/github.com/brandscreen/zencoder.

Installation

$ go get github.com/brandscreen/zencoder

Usage

Import Zencoder

Ensure you have imported the zencoder package at the top of your source file.

import "github.com/brandscreen/zencoder"

Create a connection to Zencoder

All Zencoder methods are on the Zencoder struct. Create a new one bound to your API key using zencoder.NewZencoder.

// make sure you replace [YOUR API KEY HERE] with your API key
zc := zencoder.NewZencoder("[YOUR API KEY HERE]")

Jobs

Create a Job

settings := &zencoder.EncodingSettings{
    Input: "s3://zencodertesting/test.mov",
    Test:  true,
}
job, err := zc.CreateJob(settings)

List Jobs

jobs, err := zc.ListJobs()

Get Job Details

details, err := zc.GetJobDetails(12345)

Job Progress

progress, err := zc.GetJobProgress(12345)

Resubmit a Job

err := zc.ResubmitJob(12345)

Cancel a Job

err := zc.CancelJob(12345)

Finish a Live Job

err := zc.FinishLiveJob(12345)

Inputs

Get Input Details

details, err := zc.GetInputDetails(12345)

Input Progress

progress, err := zc.GetInputProgress(12345)

Outputs

Get Output Details

details, err := zc.GetOutputDetails(12345)

Output Progress

progress, err := zc.GetOutputProgress(12345)

Accounts

Get Account Details

account, err := zc.GetAccount()

Set Integration Mode

err := zc.SetIntegrationMode()

Set Live Mode

err := zc.SetLiveMode()

Reports

ReportSettings

All reporting interfaces take either nil or a ReportSettings object.

Using nil denotes to use default settings. In this case, assume settings in the examples below is defined as:

var settings *zencoder.ReportSettings = nil

A ReportSettings object can either be constructed manually as in:

var start, end time.Date
settings := &zencoder.ReportSettings{
    From:     &start,
    To:       &end,
    Grouping: "key",
}

Or, you can use a Fluent-style interface to build a ReportSettings object, as in:

var start, end time.Date
settings := zencoder.ReportFrom(start).To(time).Grouping("key")

Get VOD Usage

usage, err := zc.GetVodUsage(settings)

Get Live Usage

usage, err := zc.GetLiveUsage(settings)

Get Total Usage

usage, err := zc.GetUsage(settings)

Encoding Settings

See Zencoder API documentation for all encoding settings available in zencoder.EncodingSettings. All settings are currently supported, with the main difference being the casing of the options to fit with Go naming conventions.

Contributing

Please see CONTRIBUTING.md. If you have a bugfix or new feature that you would like to contribute, please find or open an issue about it first.

License

Licensed under the MIT License.

You can’t perform that action at this time.