Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Enable transcripts for video library [FC-0076] #1596

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

ChrisChV
Copy link
Contributor

@ChrisChV ChrisChV commented Jan 17, 2025

Description

  • Get updateTranscriptHandlerUrl() and call it when is ready.
  • Enable LanguageNamesWidget in a library.
  • Enable add transcripts for libraries.
  • Enable delete transcripts for libraries.
  • Enable replace transcripts for libraries.
  • Enable download transcripts for libraries.
  • Enable download transcripts from YouTube
  • Which edX user roles will this change impact? "Course Author"

Supporting information

Testing instructions

  • Create a video in a course unit. You can use this video link
  • Add two or more transcripts. You can use this files
  • Copy the video block.
  • Go to a library in the library home and paste the video block.
  • Verify that you can see the transcripts in the preview and in the static assets.
  • Copy the block and paste it in the course. Verify that you can see the transcripts in the preview.
  • Copy the same block and paste it in the library again. Verify that you can see the transcripts in the preview. and in the static assets.
  • Create a video in a library. You can use this video link
  • Add two or more transcripts. You can use this files. Verify that you can see the transcripts in the preview. and in the static assets.
  • Copy the video block and paste it in a course. Verify that you can see the transcripts in the preview.
  • Copy the same video block from the course and paste it in a library. Verify that you can see the transcripts in the preview. and in the static assets.
  • Copy the same video block from the library and paste in a course. Verify that you can see the transcripts in the preview.
  • In a library, on the video editor, verify:
    • You can delete a transcript.
    • You can replace a transcript.
    • You can download a transcript
    • You can update the language of a transcript.
  • In a library, create a new video block and use a YouTube link. You can use this video
  • Save the block and open the editor again. Click on the Import transcript button in the port transcript from YouTube? box. Save.
  • Verify that you can see the transcripts in the preview. and in the static assets.
  • Copy the video block and paste it in a course. Verify that you can see the transcripts in the preview.

Other information

@ChrisChV ChrisChV requested a review from a team as a code owner January 17, 2025 23:54
@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Jan 17, 2025
@openedx-webhooks
Copy link

openedx-webhooks commented Jan 17, 2025

Thanks for the pull request, @ChrisChV!

This repository is currently maintained by @openedx/2u-tnl.

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.


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 January 17, 2025 23:54
Copy link

codecov bot commented Jan 20, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.26%. Comparing base (b7241a1) to head (e23367e).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1596      +/-   ##
==========================================
+ Coverage   93.24%   93.26%   +0.02%     
==========================================
  Files        1100     1100              
  Lines       21803    21848      +45     
  Branches     4725     4639      -86     
==========================================
+ Hits        20330    20377      +47     
- Misses       1401     1406       +5     
+ Partials       72       65       -7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ChrisChV ChrisChV force-pushed the chris/FAL-3989-video-transcripts branch from 51ac20d to a82e796 Compare January 21, 2025 20:47
@mphilbrick211 mphilbrick211 added the FC Relates to an Axim Funded Contribution project label Jan 22, 2025
@ChrisChV ChrisChV marked this pull request as ready for review January 29, 2025 02:31
Copy link
Contributor

@pomegranited pomegranited left a comment

Choose a reason for hiding this comment

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

@ChrisChV Your code is working fine :) But I left some nits and questions, so would like to re-review once they're addressed.

Also: I found some bugs with the subtitles in the Course asset list. When I've copied a Library Video into a Course (creating a new LibraryBlock), it (correctly) notifies me that the subtitle files have been added to the course. But when I try to view their URLs, I get errors:

Subtitle.asset.bugs.mp4

{!isLibrary && ( // Since content libraries v2 don't support static assets yet, we can't include transcripts.
<TranscriptWidget />
)}
<TranscriptWidget />
Copy link
Contributor

@pomegranited pomegranited Jan 29, 2025

Choose a reason for hiding this comment

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

(out of scope for this issue) The Transcripts part of this VideoPreviewWidget is hard to use 😞

  • Can't type in the language I want in the dropdown; I have to scroll all the way down to the language to select it.
  • No spinners shown while transcript uploads / downloads from Youtube are happening -- it just sits there looking like it's doing nothing.
    It also doesn't prevent me from clicking "Save", and so if an upload / replace / delete for a transcript fails, I don't know about it until I re-open the modal.
  • When I import transcripts from YouTube, only one of the imported transcripts (English) shows up in the preview widget.
    I have to save, and the re-edit to see all languages for the imported transcripts.
  • The "select a language then launch file upload control" behavior is non-intuitive, and may not be accessible either? I think these two components should split in two, so I can select my language / upload a file in whatever order I want to.
  • The "Download" transcript menu item tries to send me to a new page. It should open in a new window (which closes after the download completes).

Do we have budget for a follow-up task to fix this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks @pomegranited for listing this issues. It will be very helpful!

Do we have budget for a follow-up task to fix this?

I think so, I have to evaluate it.

}),
...rest,
}));
const isLibrary = selectors.app.isLibrary(getState());
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Do we need to call getState() twice in each of these 4 functions below?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated here 9f74c07

@@ -80,6 +80,14 @@ export const downloadVideoTranscriptURL = (({ studioEndpointUrl, blockId, langua
`${videoTranscripts({ studioEndpointUrl, blockId })}?language_code=${language}`
)) satisfies UrlFunction;

export const trascriptXblockV2 = (({ transcriptHandlerUrl }) => (
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: typo

Suggested change
export const trascriptXblockV2 = (({ transcriptHandlerUrl }) => (
export const transcriptXblockV2 = (({ transcriptHandlerUrl }) => (

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated here 4961e73

src/editors/data/redux/video/selectors.js Show resolved Hide resolved
@@ -242,6 +242,8 @@ exports[`TranscriptWidget component snapshots snapshot: renders ErrorAlert with
</CollapsibleFormWidget>
`;

exports[`TranscriptWidget component snapshots snapshot: renders when isLibrary is true 1`] = `undefined`;
Copy link
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 this test? Isn't the TranscriptWidget rendered when isLibrary is true?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated here 91b4a9d

@ChrisChV
Copy link
Contributor Author

Also: I found some bugs with the subtitles in the Course asset list. When I've copied a Library Video into a Course (creating a new LibraryBlock), it (correctly) notifies me that the subtitle files have been added to the course. But when I try to view their URLs, I get errors:

I think it's an issue with all files in general. Using that screen, I added a new file, and it has the same problem. For now, it is out of the scope of this task.

Copy link
Contributor

@pomegranited pomegranited left a comment

Choose a reason for hiding this comment

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

👍 Thank you for making those changes @ChrisChV ! Works great.

  • I tested this using the PR testing instructions.
  • I read through the code
  • I checked for accessibility issues by using my keyboard to navigate
  • Includes documentation -- good code comments
  • User-facing strings are extracted for translation N/A

@bradenmacdonald
Copy link
Contributor

@pomegranited @ChrisChV We are fixing the issue with linking static files into a course in openedx/edx-platform#36173

Copy link
Contributor

@DanielVZ96 DanielVZ96 left a comment

Choose a reason for hiding this comment

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

👍 LGTM sorry for taking so long!

  • I tested this
  • I read through the code
  • I checked for accessibility issues

Copy link
Contributor

@bradenmacdonald bradenmacdonald left a comment

Choose a reason for hiding this comment

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

nice work!

@@ -207,6 +213,7 @@ export const mapStateToProps = (state) => ({
allowTranscriptImport: selectors.video.allowTranscriptImport(state),
isUploadError: selectors.requests.isFailed(state, { requestKey: RequestKeys.uploadTranscript }),
isDeleteError: selectors.requests.isFailed(state, { requestKey: RequestKeys.deleteTranscript }),
isLibrary: selectors.app.isLibrary(state),
Copy link
Contributor

Choose a reason for hiding this comment

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

If you need to access the redux store, please use a hook instead of a prop:

const isLibrary = useSelector(selectors.app.isLibrary);

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
Status: Waiting on Author
Development

Successfully merging this pull request may close these issues.

6 participants