How to analyse a long video asynchronously

Ask the question with an idempotency_key, so a scheduler that runs twice pays once. A long video is read in sections side by side rather than in one pass, so the first answer takes a minute or two and every question after it, carrying the session_id, comes back in about a second.

Last updated

The call

Copy this as it stands. “How do I survey a two-hour recording from a backend job?” is the question it answers.

Ask an agenttext
Survey this two hour recording and list what happens in each part, with the seconds:
https://www.youtube.com/watch?v=…
cURLbash
SESSION=$(curl -sX POST https://api.tryplayhead.com/v1/watch_video \
  -H "Authorization: Bearer $PLAYHEAD_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url": "…", "idempotency_key": "weekly-report-42"}' | jq -r .session_id)

# Every question after the first one carries the session and is short.
curl -sX POST https://api.tryplayhead.com/v1/watch_video \
  -H "Authorization: Bearer $PLAYHEAD_API_KEY" \
  -H "Content-Type: application/json" \
  -d "{\"session_id\": \"$SESSION\", \"question\": \"who speaks, and when\"}" | jq -r .answer

Watch out for

Everything the API can refuse, and what to send instead, is on the errors page.