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: video gallery thumbnail fallback #412

Merged

Conversation

ArturGaspar
Copy link
Contributor

Description

Add a fallback when thumbnail fails to load in video gallery.

Before:
image

After:
image

Testing instructions

  1. (Optional) Create a mock videos response with some broken thumbnails
    1. Enable mock video uploads (create waffle flag contentstore.mock_video_uploads enabled for everyone)
    2. Modify videos_index_json() as follows:
      def videos_index_json(course):
          """
          ...
          """
          # index_videos, __ = _get_index_videos(course)
          # A PNG that says "Test".
          test_image = ("data:image/png;base64,"
                        "iVBORw0KGgoAAAANSUhEUgAAAFsAAAA5AQMAAABjxMWLAAAABlBMVEX///8AAABVwtN+AAAACXBI"
                        "WXMAAA7EAAAOxAGVKw4bAAAAp0lEQVQokcXRvQ3DIBAF4EMuKG+DMAorZYIYy4XXOm/CCJQUiBci"
                        "czZdUkTySQg+IXj8EN1eHsjf8ByRWrNyjM2/4CP5xDjQklA6DIpB7ZjSyyTf11hxU3QdHHgSVhCv"
                        "A+wqmuMaouLRUM4ZYIdcEOQBvl4IFucGrbAM4EVzPt1+hm5B0Q66yYBV7DLch0NHmk121K+NagDS"
                        "1ymEqpgT+Uzzz799R70BcoGEnUOQPZMAAAAASUVORK5CYII=")
          index_videos = [
              {
                  'edx_video_id': 'aaaaaaaa-aaaa-4aaa-aaaa-aaaaaaaaaaaa',
                  'client_video_id': 'video.mp4',
                  'created': '1970-01-01T00:00:00Z',
                  'duration': 42.5,
                  'status': 'upload',
                  'course_video_image_url': test_image
              },
              {
                  'edx_video_id': 'aaaaaaaa-aaaa-4aaa-aaaa-aaaaaaaaaaaa',
                  'client_video_id': 'video.mp4',
                  'created': '1970-01-01T00:00:00Z',
                  'duration': 42.5,
                  'status': 'upload',
                  'course_video_image_url': 'https://video/images/1234.jpg'
              }
          ]
          return JsonResponse({"videos": index_videos}, status=200)
      
  2. Open video gallery
    1. Enable the new video editor (create waffle flags new_core_editors.use_new_video_editor and new_core_editors.use_video_gallery_flow enabled for everyone)
    2. Create a course unit with a video
    3. Edit the video (should open in new editor)
    4. Click "< Replace video" to go to the gallery
  3. See that an icon is shown instead of a broken image

@openedx-webhooks
Copy link

openedx-webhooks commented Oct 18, 2023

Thanks for the pull request, @ArturGaspar! Please note that it may take us up to several weeks or months to complete a review and merge your PR.

Feel free to add as much of the following information to the ticket as you can:

  • supporting documentation
  • Open edX discussion forum threads
  • timeline information ("this must be merged by XX date", and why that is)
  • partner information ("this is a course on edx.org")
  • any other information that can help Product understand the context for the PR

All technical communication about the code itself will be done via the GitHub pull request interface. As a reminder, our process documentation is here.

Please let us know once your PR is ready for our review and all tests are green.

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Oct 18, 2023
@mphilbrick211 mphilbrick211 added the needs test run Author's first PR to this repository, awaiting test authorization from Axim label Oct 19, 2023
@ArturGaspar ArturGaspar force-pushed the artur/video-gallery-thumbnail-fallback branch from 1468405 to 1e6fb33 Compare October 19, 2023 17:32
@e0d e0d removed the needs test run Author's first PR to this repository, awaiting test authorization from Axim label Oct 24, 2023
@mphilbrick211 mphilbrick211 requested a review from a team October 24, 2023 18:52
@mphilbrick211
Copy link

Hi @openedx/teaching-and-learning! This is ready for review.

@mphilbrick211 mphilbrick211 added the waiting for eng review PR is ready for review. Review and merge it, or suggest changes. label Oct 24, 2023
thumbnail
className="px-6 py-4.5"
src={videoThumbnail}
style={{ height: '100%' }}
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we can use https://paragon-openedx.netlify.app/foundations/css-utilities for the classes from here.

Copy link
Member

@farhaanbukhsh farhaanbukhsh left a comment

Choose a reason for hiding this comment

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

👍

  • ✅ I tested this on devstack and it looks good to me
  • ✅ I read through the code
  • ❌ I checked for accessibility issues
  • ❌ Includes documentation
  • ❌ I made sure any change in configuration variables is reflected in the corresponding client's configuration-secure repository.

@ArturGaspar ArturGaspar force-pushed the artur/video-gallery-thumbnail-fallback branch from 1e6fb33 to 9b9ea79 Compare October 26, 2023 12:30
@mphilbrick211 mphilbrick211 added needs test run Author's first PR to this repository, awaiting test authorization from Axim and removed waiting for eng review PR is ready for review. Review and merge it, or suggest changes. needs test run Author's first PR to this repository, awaiting test authorization from Axim labels Oct 26, 2023
@mphilbrick211
Copy link

@openedx/teaching-and-learning - this is ready for review / merge. Thanks!

@tecoholic
Copy link

@navinkarkera Another PR to tag with "jira:2u" label.

cc: @cablaa77

@jristau1984 jristau1984 added the jira:2u We want an issue in the 2U Jira instance label Nov 9, 2023
@openedx-webhooks
Copy link

I've created issue TNL-11196 in the private 2U Jira.

@mphilbrick211 mphilbrick211 added the waiting for eng review PR is ready for review. Review and merge it, or suggest changes. label Nov 9, 2023
Comment on lines +51 to +55
<Image
thumbnail
className="px-6 py-4.5 h-100"
src={videoThumbnail}
/>
Copy link
Member

Choose a reason for hiding this comment

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

Why is image used instead of Paragon's <Icon /> component with a Paragon icon?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@KristinAoki The VideocamOutlined icon was added in Paragon v21.6.0 (47e4379).

The latest release on https://www.npmjs.com/package/@edx/paragon is 21.5.6 and a notice says that future versions will be publised as https://www.npmjs.com/package/@openedx/paragon.

Installing @openedx/paragon and importing VideocamOutlined from it works, but is it a good idea?

Copy link
Member

Choose a reason for hiding this comment

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

I would probably wait for the whole repo to switch over to @openedx/paragon. Consider this resolved.

@mphilbrick211 mphilbrick211 removed the waiting for eng review PR is ready for review. Review and merge it, or suggest changes. label Dec 1, 2023
@KristinAoki KristinAoki merged commit 1c9771b into openedx:main Dec 4, 2023
3 checks passed
@openedx-webhooks
Copy link

@ArturGaspar 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
jira:2u We want an issue in the 2U Jira instance 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