Tracks per-profile video playback position and completion status across the platform. Registered as the JS service videoManager, it is used by video players to record how far a profile has watched a video and to resume playback from that point later. Position updates are queued in memory and written to the database asynchronously by a background daemon thread, so a burst of position updates from a player does not block the request that reported them. Only the most recently queued update for a given profile and video is kept, so intermediate positions can be dropped if updates arrive faster than they are persisted.

Group: Managers

Implements: StartableService


Properties

PropertyReturnsDescription
lastExceptionThrowableThe most recent error raised by the background thread that persists queued video position updates, if any.
localQueueSizeintNumber of queued video position updates that have not yet been persisted by the background updater thread.

Methods

getLocalQueueSize()

Returns: int

Number of queued video position updates that have not yet been persisted by the background updater thread.

getLastException()

Returns: Throwable

The most recent error raised by the background thread that persists queued video position updates, if any.

updateVideoPosition(Profile curUser, String videoHash, String videoName, int currentSec, int percPlayed)

Returns: void

Records a profile's current playback position for a video. The update is enqueued for asynchronous persistence by the background updater thread rather than being written immediately, so this call is cheap and returns without doing any database work. Does nothing if curUser is null.

ParameterDescription
curUserthe profile whose playback position is being recorded, ignored if null
videoHashthe content hash identifying the video
videoNamethe display name of the video, stored for reference
currentSecthe current playback position, in seconds
percPlayedthe percentage of the video played so far, from 0 to 100

findVideoStatus(Profile curUser, String videoHash)

Returns: VideoPlayStatus

Looks up the persisted playback status for a profile and video. Reads directly from the database rather than the in-memory queue, so a very recently queued but not yet persisted update may not be reflected.

ParameterDescription
curUserthe profile whose playback status is being looked up
videoHashthe content hash identifying the video

findByProfile(Profile curUser)

Returns: List<VideoPlayStatus>

Finds every playback status recorded for a profile, across all videos and all time.

ParameterDescription
curUserthe profile to find playback status records for

findByProfile(Profile curUser, Date from, Date to)

Returns: List<VideoPlayStatus>

Finds the playback status records recorded for a profile, optionally restricted to a date range.

ParameterDescription
curUserthe profile to find playback status records for
fromthe earliest creation date to include (exclusive), or null for no lower bound
tothe latest creation date to include (inclusive), or null for no upper bound
To get full access to the Kademi Hub existing customers can login here, or new customers can register here.