Skip to content

feat!: remove multi-speed YouTube fields from VideoBlock [DEPR]#254

Open
farhan wants to merge 4 commits into
mainfrom
farhan/depr-old-youtube-fields
Open

feat!: remove multi-speed YouTube fields from VideoBlock [DEPR]#254
farhan wants to merge 4 commits into
mainfrom
farhan/depr-old-youtube-fields

Conversation

@farhan
Copy link
Copy Markdown
Contributor

@farhan farhan commented May 25, 2026

Closes openedx/openedx-platform#36888

Summary

  • Removes the obsolete youtube_id_0_75, youtube_id_1_25, and youtube_id_1_5 fields from VideoFields — YouTube has supported native speed controls for years, making these redundant
  • Simplifies create_youtube_string() in video_utils.py to only use youtube_id_1_0
  • Simplifies _parse_youtube() to only initialize and return the 1.00 speed key — the 0.75, 1.25, 1.50 entries were dead code after field removal
  • Updates class docstring XML example and all affected tests
  • Fixes test_create_youtube_string_missing to test the meaningful empty-ID case instead of duplicating the happy path

Old XML with multi-speed YouTube attributes (e.g. youtube="0.75:...,1.00:...,1.25:...,1.5:...") will continue to parse without errors — the non-1.0 speeds are silently ignored, and YouTube's native player handles speed control natively.

Test plan

  • Verify xblocks_contrib/video/tests/test_video.py passes
  • Confirm no youtube_id_0_75, youtube_id_1_25, or youtube_id_1_5 references remain in video source files
  • Smoke test a video block with only youtube_id_1_0 set — confirm YouTube speed controls work via the native player

🤖 Generated with Claude Code

YouTube has supported native speed controls for years, making
youtube_id_0_75, youtube_id_1_25, and youtube_id_1_5 obsolete.
Removes these fields and simplifies create_youtube_string() to
only use youtube_id_1_0.

Closes openedx/openedx-platform#36888

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR removes the legacy multi-speed YouTube ID fields from the Video XBlock and updates YouTube serialization to only emit the 1.00 speed entry, aligning with modern YouTube playback behavior while updating affected tests.

Changes:

  • Removed youtube_id_0_75, youtube_id_1_25, and youtube_id_1_5 from VideoFields.
  • Simplified create_youtube_string() to only serialize youtube_id_1_0 as 1.00:<id>.
  • Updated Video XBlock unit tests to reflect the removed fields and new export format.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
xblocks_contrib/video/video_xfields.py Drops the deprecated speed-specific YouTube ID fields from the block schema.
xblocks_contrib/video/video_utils.py Updates YouTube stream string generation to only include the 1.00 speed.
xblocks_contrib/video/tests/test_video.py Adjusts import/export and utility tests for the new single-speed YouTube behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread xblocks_contrib/video/video_xfields.py
Comment thread xblocks_contrib/video/tests/test_video.py Outdated
farhan and others added 2 commits May 25, 2026 15:36
Now that multi-speed fields are removed, _parse_youtube no longer
needs to populate 0.75/1.25/1.50 keys. Simplify to only retain
the 1.00 entry. Also update class docstring and fix the now-redundant
test_create_youtube_string_missing to test the empty ID case.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
When parsing XML like youtube="0.75:abc" (no 1.0 entry), _parse_youtube
was returning {'1.00': ''}, silently losing the video ID. Now falls back
to the first non-empty legacy speed so no ID is dropped on import.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

Comment thread xblocks_contrib/video/video.py Outdated
Comment thread xblocks_contrib/video/video.py
Comment thread xblocks_contrib/video/tests/test_video.py Outdated
The for loop and normalized_speed logic in parse_video_xml existed solely
to fan out youtube_id_* fields for 0.75/1.25/1.50 speeds. Now that
_parse_youtube always returns {'1.00': id}, replace the loop with a direct
assignment to youtube_id_1_0. Also fix the docstring example to use the
canonical 1.00 format, correct the fallback comment to say "lowest speed
entry", and update the test_parse_youtube_invalid docstring to match the
actual return value.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
farhan

This comment was marked as resolved.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

Comment on lines +865 to +866
the source string (legacy OLX with only non-1.0 speeds), the first
non-empty speed ID is used as a fallback so no YouTube ID is lost.
def test_parse_youtube_legacy_fallback(self):
"""
Legacy OLX that only specifies non-1.0 speeds should not silently drop
the YouTube ID — the first non-empty speed should be promoted to 1.00.
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.

[DEPR]: Multi-speed YouTube video links in VideoBlock

2 participants