Skip to content

feat: include video start & end time in course block - #260

Merged
saraburns1 merged 2 commits into
openedx:mainfrom
saraburns1:videoclip
Oct 9, 2026
Merged

saraburns1 merged 2 commits into
openedx:mainfrom
saraburns1:videoclip

Conversation

@saraburns1

@saraburns1 saraburns1 commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Closes openedx/openedx-aspects#373

Description
In studio, video blocks can be set to play a portion of a video. In Aspects we currently only have the actual start/time of the original video with no information on what slice of video is shown to the user. This means that in the dashboard, a timestamp can show as 10:00.00 when the video shown in the course is only 2 minutes long.

This adds video_start_time and video_end_time to xblock_data_json for video blocks in the course_blocks sink.

Example:

course_overviews

{"course": "DemoX", "run": "2026", "block_type": "video", "detached": 0, "graded": 0,
 "completion_mode": "completable", "video_start_time": 60.0, "video_end_time": 240.0,
 "section": 2, "subsection": 1, "unit": 3, "tags": []}
xapi_events
{
  "verb": { "id": "https://w3id.org/xapi/video/verbs/paused" },
  "object": {
    "id": "https://lms.example.com/xblock/block-v1:Org1+DemoX+2026+type@video+block@a1b2c3d4",
    "definition": { "type": "https://w3id.org/xapi/video/activity-type/video" }
  },
  "result": {
    "extensions": { "https://w3id.org/xapi/video/extensions/time": 210.0 }
  },
  "context": {
    "extensions": { "https://w3id.org/xapi/video/extensions/length": 180.0 }
  }
}

Before:

video_position = 210
video_duration = 180

After:

video_position = 150 (210 − 60, i.e. 2:30 into the clip)
video_duration = 180

Merge checklist:

Commit messages use the correct Conventional Commits type
Documentation updated (not only docstrings) — n/a
Fixup commits are squashed away
Unit tests added/updated
Manual testing instructions provided
Noted any: Concerns, dependencies, migration issues, deadlines, tickets — existing courses need a re-dump (above) to pick up the new fields. No effect on reports until the aspects-dbt PR is merged.

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  src/platform_plugin_aspects/sinks
  course_overview_sink.py
Project Total  

This report was generated by python-coverage-comment-action

@saraburns1
saraburns1 requested a review from bmtcril October 8, 2026 18:00
@saraburns1

Copy link
Copy Markdown
Contributor Author

FYI @felipemontoya - if you want to include this in your dbt changes, we should now subtract video_start_time from video_position to get the correct timestamp for video blocks that are a slice of the original video

@bmtcril

bmtcril commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Seems fine if you can get the tests to cover it. We'll need to put something in release notes that folks will need to re-dump all of their courses to pick up the new data, though.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@saraburns1

Copy link
Copy Markdown
Contributor Author

will include this in the release note:

platform-plugin-aspects now sends each video’s start and end times with the course block data.

Upgrade steps:

  1. tutor local do dbt -c "run --full-refresh -s dim_most_recent_course_blocks"
  2. tutor local do dump_data_to_clickhouse --options "--object course_overviews --force"

Notes:
Only video events received after the upgrade are corrected. To correct older events, full-refresh video_playback_events and the models built on it (-s video_playback_events+). This reprocesses every xAPI event, so plan for it on large instances.
If a course changes a video’s clip times later, events already stored keep the times that applied when they arrived.

@saraburns1
saraburns1 requested review from bmtcril and removed request for bmtcril October 9, 2026 13:54

@bmtcril bmtcril left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 👍

@saraburns1
saraburns1 merged commit 2e97b36 into openedx:main Oct 9, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

In-Context: Unique vs. Repeat Views chart video duration doesn't always match duration of video in course

2 participants