Skip to content

feat: Video editor supports transcripts [FC-0076] - #36058

Merged
ChrisChV merged 42 commits into
openedx:masterfrom
open-craft:chris/FAL-3989-video-transcripts
Feb 21, 2025
Merged

feat: Video editor supports transcripts [FC-0076]#36058
ChrisChV merged 42 commits into
openedx:masterfrom
open-craft:chris/FAL-3989-video-transcripts

Conversation

@ChrisChV

@ChrisChV ChrisChV commented Dec 25, 2024

Copy link
Copy Markdown
Contributor

Description

  • Add error handler on save video to avoid creating sjson
  • Support transcripts without edx_video_id in definition_to_xml
  • When copying a video from a library to a course: Create a new edx_video_id
  • Save transcripts as static assets in a video in a library when adding a new transcript.
  • Delete transcripts as static assets in a video in a library when deleting transcripts.
  • Support download transcript in a video in a library.
  • Support replace transcript in a video in a library.
  • Support updating transcripts in video in a library.
  • Refactor the code of downloading YouTube transcripts to enable this feature in libraries.
  • Support copy from a library to a course and a course to a library.
  • Which edX user roles will this change impact? "Course Author"

Supporting information

Testing instructions

Follow the testing instructions at: openedx/frontend-app-authoring#1596

Deadline

No rush

Other information

* Add error handler on save video to avoid create sjson
* Support transcripts without edx_video_id in definition_to_xml
@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Dec 25, 2024
@openedx-webhooks

openedx-webhooks commented Dec 25, 2024

Copy link
Copy Markdown

Thanks for the pull request, @ChrisChV!

This repository is currently maintained by @openedx/wg-maintenance-edx-platform.

Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review.

🔘 Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.
🔘 Provide context

To help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads
🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.

Details
Where can I find more information?

If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:

When can I expect my changes to be merged?

Our goal is to get community contributions seen and reviewed as efficiently as possible.

However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

@ChrisChV
ChrisChV marked this pull request as draft December 25, 2024 21:16
@ChrisChV ChrisChV changed the title feat: Video editor supports transcripts feat: Video editor supports transcripts [FC-0076] Dec 25, 2024
@mphilbrick211 mphilbrick211 added the FC Relates to an Axim Funded Contribution project label Dec 27, 2024

@pomegranited pomegranited 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.

Hi @ChrisChV , this is working well for the most part, good job dealing with the old transcript code!

But I found a bug with the upstream/downstream syncing, and left a few nits/change requests too.

Comment thread cms/djangoapps/contentstore/helpers.py Outdated
Comment thread cms/djangoapps/contentstore/views/tests/test_transcripts.py
edx_video_id = create_external_video(display_name='external video')

if isinstance(video_component.usage_key, UsageKeyV2):
return edx_video_id

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.

I don't understand why we're returning early here.. Could you add a comment to clarify?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated e4f7c72

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.

Makes sense. But I wonder, should we still be calling create_external_video and returning an edx_video_id at all, if it's not going to be saved into the video block? Doesn't that create some stranded video data in VAL?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Comment thread cms/djangoapps/contentstore/views/transcripts_ajax.py Outdated
Comment thread cms/djangoapps/contentstore/views/transcripts_ajax.py Outdated
Comment thread openedx/core/djangoapps/content_libraries/api.py Outdated
Comment thread xmodule/video_block/transcripts_utils.py Outdated
Comment thread xmodule/video_block/video_handlers.py Outdated
Comment thread xmodule/video_block/video_handlers.py Outdated
@@ -10,6 +10,7 @@
import re

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.

I'm seeing a bug when I sync a LibraryBlock video with transcripts from an upstream video.

Steps to reproduce:

  1. Create a library video with transcripts (here, I imported them from the example youtube video).
  2. Publish the library video.
  3. Copy it to the clipboard.
  4. Paste into a course.
    Note that the transcripts are displaying fine here.
  5. Re-edit the library video, and replace a transcript. (Here, I replaced the English one, I don't know if replacing others causes the same issue).
  6. Return to the course LibraryBlock, and refresh to see the "updates available" button. Click it.
    Note that the upstream video preview shows its transcripts fine, but the downstream (course) video preview doesn't show its transcripts anymore.
  7. Accept changes.
    Note that the course video no longer shows its transcripts, but if you edit it, you can see they're still there.
Syncing.upstream.video.breaks.transcripts.mp4

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think this is related to openedx/modular-learning#246

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.

@ChrisChV That could very well be.. however I don't think it's resolved by @DanielVZ96 's #36173, but it's also possible that I didn't merge conflicts accurately. cf my merged branch.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@pomegranited To be safe, I will wait until #36173 is ready to fix this bug.

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.

No worries @ChrisChV , thank you for keeping an eye on this issue.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@bradenmacdonald @pomegranited I fixed this on 0745f09. I need to add tests, but you can test the fix

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.

Hi @ChrisChV -- your fix is an improvement, but now I'm seeing a slightly different bug in the "updates available" preview.

Steps to reproduce:

  1. Create a library video with one or more transcripts (here, I used your mp4 video link, but it happens with the imported transcripts from the example youtube video too).
  2. Publish the library video.
  3. Copy it to the clipboard.
  4. Paste into a course.
    Note that the transcripts are displaying fine here (despite the message about needing to upload transcript files??)
  5. Re-edit the library video, and replace a transcript. Wait for it to process fully before hitting Save.
  6. Publish the library video again.
  7. Return to the course LibraryBlock, and refresh to see the "updates available" button. Click it.
    Bug: the downstream (course) video preview shows the updated English transcript from upstream, not the actual transcript that's on the downstream block.
  8. Accept changes.
    Sync works fine (sorry, screencapture below doesn't show this step, but it does work :) )
Transcripts.sync.bug.mp4

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks @pomegranited! Do you think we can move that issue to another ticket? I've already spent a lot of budget on this task, and it's getting much bigger every time 😃

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.

@ChrisChV Yes I think so -- the syncing works, it's just the preview that's oddly borked. And AFAIK, syncing was out of scope here anyway :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks! I created the issue: openedx/frontend-app-authoring#1682

Comment thread xmodule/video_block/video_handlers.py Outdated
Comment thread cms/djangoapps/contentstore/views/transcripts_ajax.py Outdated
Comment thread xmodule/video_block/video_handlers.py

@bradenmacdonald bradenmacdonald 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.

Code looks good to me - thanks for those updates!

@pomegranited can you please test this carefully again before merging? Or let me know if you want help.

@pomegranited pomegranited 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.

@ChrisChV This is working great, except for one weird issue still in the upstream/downstream preview. So I'm approving, in case this can be fixed in a follow-up PR?

  • I tested this using the test instructions from openedx/frontend-app-authoring#1596, and also by syncing transcript changes from library blocks to downstream course blocks.
  • I read through the code
  • I checked for accessibility issues by using my keyboard to navigate
  • Includes documentation
  • User-facing strings are extracted for translation

@@ -10,6 +10,7 @@
import re

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.

Hi @ChrisChV -- your fix is an improvement, but now I'm seeing a slightly different bug in the "updates available" preview.

Steps to reproduce:

  1. Create a library video with one or more transcripts (here, I used your mp4 video link, but it happens with the imported transcripts from the example youtube video too).
  2. Publish the library video.
  3. Copy it to the clipboard.
  4. Paste into a course.
    Note that the transcripts are displaying fine here (despite the message about needing to upload transcript files??)
  5. Re-edit the library video, and replace a transcript. Wait for it to process fully before hitting Save.
  6. Publish the library video again.
  7. Return to the course LibraryBlock, and refresh to see the "updates available" button. Click it.
    Bug: the downstream (course) video preview shows the updated English transcript from upstream, not the actual transcript that's on the downstream block.
  8. Accept changes.
    Sync works fine (sorry, screencapture below doesn't show this step, but it does work :) )
Transcripts.sync.bug.mp4

@ChrisChV
ChrisChV merged commit b6489e7 into openedx:master Feb 21, 2025
@ChrisChV
ChrisChV deleted the chris/FAL-3989-video-transcripts branch February 21, 2025 18:33
@edx-pipeline-bot

Copy link
Copy Markdown
Contributor

2U Release Notice: This PR has been deployed to the edX staging environment in preparation for a release to production.

gabrielC1409 pushed a commit to aulasneo/edx-platform that referenced this pull request Feb 24, 2025
* Add error handler on save video to avoid creating sjson
* Support transcripts without edx_video_id in definition_to_xml
* When copying a video from a library to a course: Create a new edx_video_id
* Save transcripts as static assets in a video in a library when adding a new transcript.
* Delete transcripts as static assets in a video in a library when deleting transcripts.
* Support download transcript in a video in a library.
* Support replace transcript in a video in a library.
* Support updating transcripts in video in a library.
* Refactor the code of downloading YouTube transcripts to enable this feature in libraries.
* Support copy from a library to a course and a course to a library.
Comment on lines +300 to +304
isVideoBlock = downstream.usage_key.block_type == "video"
for field_name in syncable_fields - customizable_fields:
if isVideoBlock and field_name == 'edx_video_id':
# Avoid overwriting edx_video_id between blocks
continue

@kdmccormick kdmccormick Feb 24, 2025

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@ChrisChV @pomegranited With all due appreciation for the VideoBlock nonsense you've had to grapple with to support transcripts, it truly pains me to see such block-type-specific code in this highly generalized function 😓 Upstream syncing is complex but nature, but adding special cases like this move it from being "complex" to being "complicated".

Is there any other way we can ensure that edx_video_id isn't synced? Would it not work to put it in the dict returned by get_customizable_fields, as @pomegranited did for graceperiod, grading_method, etc.?

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.

+1, good point

Though the two root problems here are (1) that there is no standard way to associate a block with external data that's not in an XBlock field (e.g. edx_video_id points to VAL or ORA2 has tons of Django models holding its data) and (2) that there is no proper XBlock API for dealing with static files (e.g. transcripts)

@edx-pipeline-bot

Copy link
Copy Markdown
Contributor

2U Release Notice: This PR has been deployed to the edX production environment.

1 similar comment
@edx-pipeline-bot

Copy link
Copy Markdown
Contributor

2U Release Notice: This PR has been deployed to the edX production environment.

jciasenza pushed a commit to jciasenza/edx-platform that referenced this pull request Feb 25, 2025
* Add error handler on save video to avoid creating sjson
* Support transcripts without edx_video_id in definition_to_xml
* When copying a video from a library to a course: Create a new edx_video_id
* Save transcripts as static assets in a video in a library when adding a new transcript.
* Delete transcripts as static assets in a video in a library when deleting transcripts.
* Support download transcript in a video in a library.
* Support replace transcript in a video in a library.
* Support updating transcripts in video in a library.
* Refactor the code of downloading YouTube transcripts to enable this feature in libraries.
* Support copy from a library to a course and a course to a library.
tonybusa pushed a commit to tonybusa/edx-platform that referenced this pull request Apr 23, 2025
* Add error handler on save video to avoid creating sjson
* Support transcripts without edx_video_id in definition_to_xml
* When copying a video from a library to a course: Create a new edx_video_id
* Save transcripts as static assets in a video in a library when adding a new transcript.
* Delete transcripts as static assets in a video in a library when deleting transcripts.
* Support download transcript in a video in a library.
* Support replace transcript in a video in a library.
* Support updating transcripts in video in a library.
* Refactor the code of downloading YouTube transcripts to enable this feature in libraries.
* Support copy from a library to a course and a course to a library.
UsamaSadiq pushed a commit that referenced this pull request May 14, 2025
* Add error handler on save video to avoid creating sjson
* Support transcripts without edx_video_id in definition_to_xml
* When copying a video from a library to a course: Create a new edx_video_id
* Save transcripts as static assets in a video in a library when adding a new transcript.
* Delete transcripts as static assets in a video in a library when deleting transcripts.
* Support download transcript in a video in a library.
* Support replace transcript in a video in a library.
* Support updating transcripts in video in a library.
* Refactor the code of downloading YouTube transcripts to enable this feature in libraries.
* Support copy from a library to a course and a course to a library.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

FC Relates to an Axim Funded Contribution project open-source-contribution PR author is not from Axim or 2U

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

8 participants