Video

Notify user is watching a video

POST
https://peertube2.cpy.re/api/v1/videos/{id}/views

Call this endpoint regularly (every 5-10 seconds for example) to notify the server the user is watching the video. After a while, PeerTube will increase video's viewers counter. If the user is authenticated, PeerTube will also store the current player time.

Body

application/json
currentTimeinteger<seconds>required

timestamp within the video, in seconds

Example
5
viewEventstringseek

Event since last viewing call:

  • seek - If the user seeked the video
sessionIdstring

Optional param to represent the current viewer session. Used by the backend to properly count one view per session per video. PeerTube admin can configure the server to not trust this sessionId parameter but use the request IP address instead to identify a viewer.

clientstring

Client software used to watch the video. For example "Firefox", "PeerTube Approval Android", etc.

deviceVideoStatsUserAgentDevice

Device used to watch the video. For example "desktop", "mobile", "smarttv", etc.

Show child attributes
VideoStatsUserAgentDeviceconsoleembeddedmobilesmarttvtabletwearablexrdesktop
operatingSystemstring

Operating system used to watch the video. For example "Windows", "Ubuntu", etc.

Parameters

idid | UUIDv4 | shortUUIDrequiredpath

The object id, uuid or short uuid

Response

204No Content

successful operation