sprite

package module
v1.3.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 5, 2021 License: BSD-2-Clause Imports: 14 Imported by: 0

README

vod-module-sprite

Build Status

Library for generating sprites from nginx-vod-module thumbnails. It leverages nginx-vod-module's thumbnail generation capabilities and stitches thumbs together to generate a vertical sprite.

Example

Check the example folder for an example of sprite generation integrated with NYTimes' nginx-vod-module-docker sample config.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GenSpriteOptions

type GenSpriteOptions struct {
	Context     context.Context
	VideoURL    string
	Start       time.Duration
	End         time.Duration
	Interval    time.Duration
	Columns     uint
	Width       uint
	Height      uint
	JPEGQuality int

	// Whether to keep the original aspect ratio on each item sprite item.
	//
	// When set to true, the library will not stretch the items, wrapping
	// each thumbnail with vertical bars. This setting is only used when
	// both Width and Height are specified.
	//
	// When both width and height are specified and KeepAspectRatio is set
	// to true, the plugin will use the height as the reference, meaning
	// that it can only add vertical bars, not horizontal bars.
	KeepAspectRatio bool

	// ContinueOnError indicate whether the generator should continue to
	// generate the whole sprite if one or more of the thumbnails fail to
	// get generated by the vod-module.
	ContinueOnError bool
	// contains filtered or unexported fields
}

GenSpriteOptions is the set of options that control the sprite generation for a video rendition.

type Generator

type Generator struct {
	Translator VideoURLTranslator
	MaxWorkers uint
	// contains filtered or unexported fields
}

Generator generates sprites for videos using the video-packager.

func (*Generator) GenSprite

func (g *Generator) GenSprite(opts GenSpriteOptions) ([]byte, error)

GenSprite generates the sprite for the given video, using the specified options.

type VideoPackagerError added in v1.1.0

type VideoPackagerError struct {
	StatusCode   int
	ResponseBody []byte
}

VideoPackagerError represents an error reported by the video packager.

func (*VideoPackagerError) Error added in v1.1.0

func (err *VideoPackagerError) Error() string

Error returns the string representation of VideoPackagerError.

type VideoURLTranslator

type VideoURLTranslator func(string) (string, error)

VideoURLTranslator is a function that translates a video URL into a nginx-vod-module thumb prefix URL.

A thumb prefix URL is a URL that doesn't include the suffix `thumb-{timecode}-w{width}-h{height}`.

The Generator will use this function to derive the final URL of the thumbnail asset.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL