as

Settings
Sign out
Notifications
Alexa
亚马逊应用商店
Ring
AWS
文档
Support
Contact Us
My Cases
新手入门
设计和开发
应用发布
参考
支持

PlaybackEventBuilder

PlaybackEventBuilder

用于创建PlaybackEvent对象的构建器。

构造函数

new PlaybackEventBuilder()

new PlaybackEventBuilder(): PlaybackEventBuilder

返回值

PlaybackEventBuilder

方法

buildActiveEvent()

buildActiveEvent(): PlaybackEvent

使用在构建器上为设备上发生的播放事件设置的字段来构建PlaybackEvent对象。如果未设置EventTimestamp,则会将其设置为当前时间。对于VOD内容,需要设置contentId。对于线性/直播内容,需要设置liveStationId或channelDescriptor,同时可额外提供contentId。

抛出

  • InvalidArgumentError 如果未设置必填字段。

返回值

PlaybackEvent

PlaybackEvent 创建的PlaybackEvent对象。


buildOffDeviceEvent()

buildOffDeviceEvent(): PlaybackEvent

使用在构建器上为设备外发生的播放事件设置的字段来构建PlaybackEvent对象。对于VOD内容,需要设置contentId。对于线性/直播内容,需要设置liveStationId或channelDescriptor,同时可额外提供contentId。

抛出

  • InvalidArgumentError 如果未设置必填字段。

返回值

PlaybackEvent

PlaybackEvent 创建的PlaybackEvent对象。


channelDescriptor()

channelDescriptor(channelDescriptor: IChannelDescriptor): PlaybackEventBuilder

设置当前播放内容使用的线性频道的频道描述符。频道描述符在应用程序包所有频道之中,唯一地标识频道,该频道描述符应与用于直播TV集成的频道描述符相匹配。

仅当内容作为直播TV线性频道的一部分播放时,并且该频道已使用Kepler EPG Provider API集成时,才需要此字段。

参数

channelDescriptor

IChannelDescriptor

当前播放内容使用的频道的唯一标识描述符。

返回值

PlaybackEventBuilder

PlaybackEventBuilder 当前的PlaybackEventBuilder对象。


contentId()

contentId(contentId: IContentId): PlaybackEventBuilder

设置正在播放的内容的ID,该ID可在所选目录中解析。

此字段对于VOD内容为必填项,对于线性/直播内容可选填。

参数

contentId

IContentId

可在所选目录中解析的ID。

返回值

PlaybackEventBuilder

PlaybackEventBuilder 当前的PlaybackEventBuilder对象。


creditsPositionMs()

creditsPositionMs(creditsPositionMs: number): PlaybackEventBuilder

设置内容中片尾的位置,从0开始偏移。用于确定观看完成度。

参数

creditsPositionMs

number

片尾位置(以毫秒为单位)。

抛出

  • InvalidArgumentError 如果位置小于0。

返回值

PlaybackEventBuilder

PlaybackEventBuilder 当前的PlaybackEventBuilder对象。


durationMs()

durationMs(durationMs: number): PlaybackEventBuilder

设置内容的持续时间。

参数

durationMs

number

以毫秒为单位的内容持续时间。

抛出

  • InvalidArgumentError 如果位置小于0。

返回值

PlaybackEventBuilder

PlaybackEventBuilder 当前的PlaybackEventBuilder对象。


eventTimestamp()

eventTimestamp(eventTimestamp: Date): PlaybackEventBuilder

设置播放事件发生的日期。这是未在同一设备上发生的播放事件的必填字段。如果未设置此字段,buildOffDeviceEvent() 将失败。

参数

eventTimestamp

Date

播放事件发生的日期。

返回值

PlaybackEventBuilder

PlaybackEventBuilder 当前的PlaybackEventBuilder对象。


liveStationId()

liveStationId(liveStationId: IContentId): PlaybackEventBuilder

设置正在播放内容的线性电台的ID。仅当内容作为直播TV线性频道的一部分播放时,才需要此字段。1.3.0

参数

liveStationId

IContentId

正在播放内容的线性电台的ID。

返回值

PlaybackEventBuilder

PlaybackEventBuilder 当前的PlaybackEventBuilder对象。


playbackEvent()

playbackEvent(playbackEvent: IPlaybackEvent): PlaybackEventBuilder

使用现有playbackEvent的值初始化PlaybackEventBuilder

参数

playbackEvent

IPlaybackEvent

播放事件,其值将用于初始化构建器。

返回值

PlaybackEventBuilder

PlaybackEventBuilder 当前的PlaybackEventBuilder对象。


playbackPositionMs()

playbackPositionMs(playbackPositionMs: number): PlaybackEventBuilder

设置客户在播放中的当前位置,从0开始计算偏移量。这是必填字段。如果未设置此字段,buildActiveEvent()buildOffDeviceEvent() 将失败。

参数

playbackPositionMs

number

当前位置(以毫秒为单位)。

抛出

  • InvalidArgumentError 如果playbackPositionMs小于0。

返回值

PlaybackEventBuilder

PlaybackEventBuilder 当前的PlaybackEventBuilder对象。


playbackState()

playbackState(playbackState: PlaybackState): PlaybackEventBuilder

针对该内容,设置客户的当前观看状态。这是必填字段。如果未设置此字段,buildActiveEvent()buildOffDeviceEvent() 将失败。

参数

playbackState

PlaybackState

当前观看状态。

返回值

PlaybackEventBuilder

PlaybackEventBuilder 当前的PlaybackEventBuilder对象。


profileId()

profileId(profileId: IProfileId): PlaybackEventBuilder

设置正在观看内容的用户的关联profileId

参数

profileId

IProfileId

用户关联的profileId

返回值

PlaybackEventBuilder

PlaybackEventBuilder 当前的PlaybackEventBuilder对象。


Last updated: 2026年8月2日