const ( HostAmazonAPI = "https://api.amazon.com" HostATVPS = "https://atv-ps.amazon.com" )
const DeviceID = "deviceID"
var Devices = []Device{ { Manufacturer: "Hisense", Model: "HE55A7000EUWTS", SecurityLevel: 3000, DeviceTypeID: "A3REWRVYBYPKUM", }, { Manufacturer: "Hisense", Model: "HU50A6100UW", SecurityLevel: 3000, DeviceTypeID: "AAJ692ZPT1X85", }, { Manufacturer: "Hisense", Model: "HU32E5600FHWV", SecurityLevel: 3000, DeviceTypeID: "A2RGJ95OVLR12U", }, { Manufacturer: "EXPRESS LUCK TECHNOLOGY LIMITED", Model: "LE-*", SecurityLevel: 3000, DeviceTypeID: "A3NM0WFSU3DLT5", }, }
the wrong DTID will fail the license request. if you change the DTID you need to relog. also if you get a failed license request try provision again. this might be UHD also > amazon-device -dtid A3GTP8TAF8V3YG manufacturer name: Hisense TV model number: HU43K3110FW
func GetPlayReadyLicense(actorToken *ActorToken, metadata *PlaybackExperienceMetadata, licenseChallenge []byte, deviceTypeID string) ([]byte, error)
GetPlayReadyLicense fetches the PlayReady DRM license for the given title.
func GetWidevineLicense(actorToken *ActorToken, metadata *PlaybackExperienceMetadata, licenseChallenge []byte, deviceTypeID string) ([]byte, error)
GetWidevineLicense requests a Widevine DRM license from the Amazon endpoint.
ActorToken represents an actor-specific access token.
type ActorToken struct { Token string `json:"token"` }
func GetActorToken(tokens *TokenPair, profile *Profile, deviceTypeID string) (*ActorToken, error)
GetActorToken exchanges the account refresh token and actor ID for an actor-specific access token.
func (*ActorToken) CachePath() string
CodePair represents the public and private codes used for device linking.
type CodePair struct { PublicCode string `json:"public_code"` PrivateCode string `json:"private_code"` }
func CreateCodePair(deviceTypeID string) (*CodePair, error)
CreateCodePair requests a public and private code pair for device linking.
func (*CodePair) CachePath() string
func (c *CodePair) String() string
Device represents the metadata for a supported hardware device.
type Device struct { Manufacturer string Model string SecurityLevel int DeviceTypeID string }
PlaybackExperienceMetadata contains the envelope and related data needed for playback requests.
type PlaybackExperienceMetadata struct { PlaybackEnvelope string `json:"playbackEnvelope"` ExpiryTime int64 `json:"expiryTime"` CorrelationId string `json:"correlationId"` }
func (*PlaybackExperienceMetadata) CachePath() string
PlaybackUrls is the parent holding the intra-title playlists.
type PlaybackUrls struct { IntraTitlePlaylist []struct { Type string `json:"type"` Urls []struct { Url string `json:"url"` Cdn string `json:"cdn"` // Used to identify Akamai vs Cloudfront } `json:"urls"` } `json:"intraTitlePlaylist"` }
func (p *PlaybackUrls) Clean() (*url.URL, error)
Clean extracts the Akamai MPD URL from the main playlist and sanitizes its path. Returns an error if the Main playlist or Akamai CDN is not found.
Profile represents an Amazon actor profile.
type Profile struct { ProfileID string `json:"profileId"` IsDefaultProfile bool `json:"isDefaultProfile"` }
func GetPrimaryProfile(tokens *TokenPair, deviceTypeID string) (*Profile, error)
GetPrimaryProfile uses the account access token to fetch available profiles and returns the primary profile.
Resource represents the "resource" object returned from the detailsPageATF endpoint.
type Resource struct { Actions []struct { Metadata struct { PlaybackExperienceMetadata PlaybackExperienceMetadata `json:"playbackExperienceMetadata"` } `json:"metadata"` } `json:"actions"` ApplyHdr bool `json:"applyHdr"` ApplyUhd bool `json:"applyUhd"` EntitlementMessaging struct { EntitlementMessageSlotDetail struct { Message string `json:"message"` } `json:"ENTITLEMENT_MESSAGE_SLOT_DETAIL"` } `json:"entitlementMessaging"` }
func GetItemDetails(token *ActorToken, titleId, deviceTypeID string) (*Resource, error)
GetItemDetails uses the actor access token to get metadata for a specific title. It explicitly passes UI schema flags to ensure the server returns the PlaybackEnvelope.
func (r *Resource) GetPlaybackExperienceMetadata() (*PlaybackExperienceMetadata, error)
GetPlaybackExperienceMetadata searches the Actions array and returns the first valid PlaybackExperienceMetadata.
func (r *Resource) String() string
TokenPair represents the access and refresh tokens returned upon successful registration
type TokenPair struct { AccessToken string `json:"access_token"` RefreshToken string `json:"refresh_token"` }
func PollRegister(codes *CodePair, deviceTypeID string) (*TokenPair, error)
PollRegister attempts to register the device. This should typically be called in a loop until it returns success (after the user links the device on the web).
func (*TokenPair) CachePath() string
func (t *TokenPair) Refresh() error
Refresh exchanges the existing refresh token for a new access token using the /auth/token endpoint, mutating the TokenPair in-place.
VodPlaybackParams holds the configuration for fetching playback resources.
type VodPlaybackParams struct { ActorToken *ActorToken TitleId string PlaybackExperienceMetadata *PlaybackExperienceMetadata DeviceTypeID string VideoCodec string // e.g., "H264" or "H265" DRMType string // e.g., "Widevine" or "PlayReady" BitrateAdaptation string // e.g., "CBR" or "CVBR" DynamicRangeFormat string // e.g., "None", "DolbyVision", or "HDR10" MaxVideoResolution string // e.g., "576p" or "2160p" }
func (p *VodPlaybackParams) Fetch() (*PlaybackUrls, error)
Fetch requests the final MPD resources for playback from Amazon's API.