vinyl-amzn extends vinyl with Amazon-specific business logic and track
types.
For general usage, playback control, events, and configuration, see the base Vinyl Usage Guide.
The vinyl-amzn package provides a VinylAmznPlayer, which extends
VinylPlayer with Amazon track types: asin (catalog), coid (purchased), and
sample (sample playback).
To install, use the npm package vended by CodeArtifact or NPMPM.
brazil-build install @amzn/vinyl-amzn
TypeScript note: Vinyl type declarations work with TS 3.7 or greater, with 5.4 or higher preferred.
Peru: https://prod.peruse.builder-tools.aws.dev/package/npm/@amzn/vinyl-amzn
Brazil: https://npmpm.corp.amazon.com/pkg/@amzn/vinyl-amzn
For either Brazil or Peru:
brazil-build install @amzn/vinyl-amzn@latest --save
If the latest isn't seen by Brazil, try the following steps:
brazil ws sync --mdbrazil-wire-ctl restart && brazil-wire-ctl register-workspaceTo create a new player, call createVinylAmznPlayer with desired configuration.
Advanced options will be described later, for now only consider the required
media value. This must be a media element, either an HTMLAudioElement or
HTMLVideoElement. Audio elements do not need to be on the DOM unless the
element's default controls are used.
import { createVinylAmznPlayer } from '@amzn/vinyl-amzn'
createVinylAmznPlayer({ media: new Audio() })
Extended Track Types:
Standard track types (dash, src, srcObject) are also supported - see base usage guide.
Amazon tracks require DMLS configuration and support additional options:
import { createVinylAmznPlayer, type Territory } from '@amzn/vinyl-amzn'
const player = createVinylAmznPlayer({ media: new Audio() })
// Configure DMLS (required for asin, coid, sample tracks)
player.configure({
dmls: { ... }, // See vinyl demo for DMLS configuration
})
// Load Amazon tracks
player.load(
{
type: 'asin',
uri: 'asin://B0B5HKZZ98',
},
{
type: 'coid',
uri: 'coid://d9e4e337-97ba-41a9-9f31-84a8bf99f1dc',
}
)
Amazon tracks can bypass DMLS for media URLs while still using DMLS for licensing:
player.load({
type: 'asin',
uri: 'asin://B0B5HKZZ98',
dash: {
url: 'https://example.com/manifest.mpd',
cdnType: 'cf-11223344',
},
hls: {
url: 'https://example.com/manifest.m3u8',
cdnType: 'cf-11223344',
clientCertificate: 'aabbcc', // base64 encoded
},
})