Amazon Developer

as

Settings
Sign out
Notifications
Alexa
Amazon Appstore
Ring
AWS
Documentation
Support
Contact Us
My Cases
Get Started
Design and Develop
Publish
Reference
Support
Skip to main content
Builder to create a PlaybackEvent object.

Constructors

new PlaybackEventBuilder()

new PlaybackEventBuilder(): PlaybackEventBuilder

Returns

PlaybackEventBuilder

Methods

buildActiveEvent()

buildActiveEvent(): PlaybackEvent Builds a PlaybackEvent object with the fields set on the builder for a playback event that occured on-device. If EventTimestamp is not set, it will be set as the current time. For VOD content, contentId needs to be set. For linear/live content, either liveStationId or channelDescriptor needs to be set while contentId can be provided additionally.

Throws

  • InvalidArgumentError if required fields are not set.

Returns

PlaybackEvent PlaybackEvent The PlaybackEvent object created.

buildOffDeviceEvent()

buildOffDeviceEvent(): PlaybackEvent Builds a PlaybackEvent object with the fields set on the builder for a playback event that occured off-device. For VOD content, contentId needs to be set. For linear/live content, either liveStationId or channelDescriptor needs to be set while contentId can be provided additionally.

Throws

  • InvalidArgumentError if required fields are not set.

Returns

PlaybackEvent PlaybackEvent The PlaybackEvent object created.

channelDescriptor()

channelDescriptor(channelDescriptor: IChannelDescriptor): PlaybackEventBuilder Sets the channel descriptor of the linear channel the content is playing on. The channel descriptor uniquely identifies the channel across all channels within the application package, This channel descriptor should match the one used for Live TV integration. This field is required only if the content is being played as part of a Live TV linear channel that has been integrated using the Kepler EPG Provider API.

Parameters

channelDescriptor
IChannelDescriptor The uniquely identifying descriptor of the channel the content is playing on.

Returns

PlaybackEventBuilder PlaybackEventBuilder The current PlaybackEventBuilder object.

contentId()

contentId(contentId: IContentId): PlaybackEventBuilder Sets the ID, resolvable in selected catalog, of the content being played. This field is required for VOD content and optional for linear/live content.

Parameters

contentId
IContentId ID resolvable in selected catalog.

Returns

PlaybackEventBuilder PlaybackEventBuilder The current PlaybackEventBuilder object.

creditsPositionMs()

creditsPositionMs(creditsPositionMs: number): PlaybackEventBuilder Sets the position of the credits in the content, offset from 0. Used for determining viewing completeness.

Parameters

creditsPositionMs
number Credits position in milliseconds.

Throws

  • InvalidArgumentError if the position is less than 0.

Returns

PlaybackEventBuilder PlaybackEventBuilder The current PlaybackEventBuilder object.

durationMs()

durationMs(durationMs: number): PlaybackEventBuilder Sets the duration of the content.

Parameters

durationMs
number Duration of the content in milliseconds.

Throws

  • InvalidArgumentError if the position is less than 0.

Returns

PlaybackEventBuilder PlaybackEventBuilder The current PlaybackEventBuilder object.

eventTimestamp()

eventTimestamp(eventTimestamp: Date): PlaybackEventBuilder Sets the date when the playback event occurred. This is is a required field for playback events which did not occur on the same device. buildOffDeviceEvent() will fail if this field is not set.

Parameters

eventTimestamp
Date Date event occured.

Returns

PlaybackEventBuilder PlaybackEventBuilder The current PlaybackEventBuilder object.

liveStationId()

liveStationId(liveStationId: IContentId): PlaybackEventBuilder Sets the ID of the linear station the content is playing on. This field is required only if the content is being played as part of a Live TV linear channel. 1.3.0

Parameters

liveStationId
IContentId The ID of the linear station the content is playing on.

Returns

PlaybackEventBuilder PlaybackEventBuilder The current PlaybackEventBuilder object.

playbackEvent()

playbackEvent(playbackEvent: IPlaybackEvent): PlaybackEventBuilder Initializes the PlaybackEventBuilder with values of existing playbackEvent.

Parameters

playbackEvent
IPlaybackEvent The playback event whose values will be used to initialize the builder.

Returns

PlaybackEventBuilder PlaybackEventBuilder The current PlaybackEventBuilder object.

playbackPositionMs()

playbackPositionMs(playbackPositionMs: number): PlaybackEventBuilder Sets the customer’s current position in playback, offset from 0. This is a required field. buildActiveEvent() and buildOffDeviceEvent() will fail if this field is not set.

Parameters

playbackPositionMs
number Current position in milliseconds.

Throws

  • InvalidArgumentError if the playbackPositionMs is less than 0.

Returns

PlaybackEventBuilder PlaybackEventBuilder The current PlaybackEventBuilder object.

playbackState()

playbackState(playbackState: PlaybackState): PlaybackEventBuilder Sets the customer’s current viewing state of the content. This is a required field. buildActiveEvent() and buildOffDeviceEvent() will fail if this field is not set.

Parameters

playbackState
PlaybackState Current viewing state.

Returns

PlaybackEventBuilder PlaybackEventBuilder The current PlaybackEventBuilder object.

profileId()

profileId(profileId: IProfileId): PlaybackEventBuilder Sets the associated profileId of the user who is watching the content.

Parameters

profileId
IProfileId The associated profileId of the user.

Returns

PlaybackEventBuilder PlaybackEventBuilder The current PlaybackEventBuilder object.
Last modified on August 2, 2026