Skip to content

How to Integrate with the Video Transcoding API?

Flávio Ribeiro edited this page Dec 14, 2016 · 6 revisions

This document aims to guide the steps to integrate a transcoding provider with the Video Transcoding API.

TranscodingProvider Interface

type TranscodingProvider interface {
	Transcode(*db.Job) (*JobStatus, error)
	JobStatus(*db.Job) (*JobStatus, error)
	CancelJob(id string) error
	CreatePreset(db.Preset) (string, error)
	DeletePreset(presetID string) error
	GetPreset(presetID string) (interface{}, error)

	// Healthcheck should return nil if the provider is currently available
	// for transcoding videos, otherwise it should return an error
	// explaining what's going on.
	Healthcheck() error

	// Capabilities describes the capabilities of the provider.
	Capabilities() Capabilities
}

Job Struct

type Job struct {
	ID              string `redis-hash:"jobID" json:"jobId"`
	ProviderName    string `redis-hash:"providerName" json:"providerName"`
	ProviderJobID   string `redis-hash:"providerJobID" json:"providerJobId"`
	StreamingParams StreamingParams `redis-hash:"streamingparams,expand" json:"streamingParams,omitempty"`
	CreationTime    time.Time `redis-hash:"creationTime" json:"creationTime"`
	SourceMedia     string `redis-hash:"source" json:"source"`
	Outputs         []TranscodeOutput `redis-hash:"-" json:"outputs"`
}

JobStatus Struct

type JobStatus struct {
	ProviderJobID  string                 `json:"providerJobId,omitempty"`
	Status         Status                 `json:"status,omitempty"`
	ProviderName   string                 `json:"providerName,omitempty"`
	StatusMessage  string                 `json:"statusMessage,omitempty"`
	Progress       float64                `json:"progress"`
	ProviderStatus map[string]interface{} `json:"providerStatus,omitempty"`
	Output         JobOutput              `json:"output"`
	SourceInfo     SourceInfo             `json:"sourceInfo,omitempty"`
}
Clone this wiki locally