as

Settings
Sign out
Notifications
Alexa
Amazon Appstore
AWS
Documentation
Support
Contact Us
My Cases
Get Started
Design and Develop
Publish
Reference
Support

PlaybackEventBuilder

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.

Returns

PlaybackEvent

The PlaybackEvent object created.

Throws

InvalidArgumentError if required fields are not set.


buildOffDeviceEvent()

buildOffDeviceEvent(): PlaybackEvent

Builds a PlaybackEvent object with the fields set on the builder for a playback event that occured off-device.

Returns

PlaybackEvent

The PlaybackEvent object created.

Throws

InvalidArgumentError if required fields are not set.


channelDescriptor()

channelDescriptor(channelDescriptor): 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.

Parameters

channelDescriptor

IChannelDescriptor

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

Returns

PlaybackEventBuilder

The current PlaybackEventBuilder object.


contentId()

contentId(contentId): PlaybackEventBuilder

Sets the ID, resolvable in the Amazon catalog, of the content being played This is a required field. buildActiveEvent() and buildOffDeviceEvent() will fail if this field is not set.

Parameters

contentId

IContentId

ID resolvable in the Amazon catalog.

Returns

PlaybackEventBuilder

The current PlaybackEventBuilder object.


creditsPositionMs()

creditsPositionMs(creditsPositionMs): 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.

Returns

PlaybackEventBuilder

The current PlaybackEventBuilder object.

Throws

InvalidArgumentError if the position is less than 0.


durationMs()

durationMs(durationMs): PlaybackEventBuilder

Sets the duration of the content.

Parameters

durationMs

number

Duration of the content in milliseconds.

Returns

PlaybackEventBuilder

The current PlaybackEventBuilder object.

Throws

InvalidArgumentError if the position is less than 0.


eventTimestamp()

eventTimestamp(eventTimestamp): 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

The current PlaybackEventBuilder object.


playbackEvent()

playbackEvent(playbackEvent): 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

The current PlaybackEventBuilder object.


playbackPositionMs()

playbackPositionMs(playbackPositionMs): 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.

Returns

PlaybackEventBuilder

The current PlaybackEventBuilder object.

Throws

InvalidArgumentError if the playbackPositionMs is less than 0.


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

The current PlaybackEventBuilder object.


profileId()

profileId(profileId): PlaybackEventBuilder

Sets the associated profileId of the user who is watching the content.

Parameters

profileId

IProfileId

The associated profileId of the user.

Returns

PlaybackEventBuilder

The current PlaybackEventBuilder object.


Last updated: Sep 30, 2025