Docs home

Video Played Tracking

Saves how much of a video a learner has watched in the current playback session. Call it regularly while a learner watches a video so their watch time and resume position are kept.

POST/students/material/{id}/secondsplayed
Video Played Tracking
curl --request POST \
  --url 'https://<your-api-host>/nuSource/api/v1/students/material/{id}/secondsplayed' \
  --header 'APIKEY: <your-api-key>' \
  --header 'ORGID: <your-org-id>' \
  --form 'JSONString={"class_id":"182884","unique_session_id":"91139236-622957-1783069869","seconds_played":2,"last_watched_second":73,"resource_type":4}'
{
  "code": 200,
  "message": "Success"
}

Access: Learners. Institute admins can also call it.

Request body: form-data with one field, JSONString, containing this JSON:

BodyJSONString
unique_session_idstringrequired
One ID per playback session, for example {user_id}-{material_id}-{unix_time}. Reuse it for every update in the same session. Missing: "Invalid unique session id."
class_idintegerrequired
Batch (class) ID the video is watched in.
seconds_playedintegerrequired
Total seconds watched in this session so far (not since the last call).
last_watched_secondintegerrequired
Position in the video, in seconds, to resume from.
resource_typeintegerrequired
4 for a teaching material.

Path: the numeric ID is the teaching material ID.

Response200application/json
codeinteger
Example: 200
messagestring
"Success"
Example: Success

Notes: Updates are saved at most about every 35 seconds, or sooner when watched time grew by 45 seconds or more; calls in between return "Success" without saving. Each session is stored once and overwritten by later calls. Rate limit: 30 requests per 1 minute; going over locks you out for 30 minutes.

Updated yesterday

Ask AI