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

Update duration to check for second value in files array #3500

Conversation

marcellamaki
Copy link
Member

@marcellamaki marcellamaki commented Aug 10, 2022

Summary

Description of the change(s) you made

This updates the duration value to check for both values in the potential array (high and low resolution video), and uses the prop rather than a data calculation.

Fixes #3472

Manual verification steps performed

  1. Upload a video
  2. Ensure the duration is correctly displaying
  3. Click on the file name to change the video file
  4. select a different file of a different length
  5. Check to ensure that the new correct duration is now reflected

Screenshots (if applicable)

studio-video-duration-updates.mp4

Does this introduce any tech-debt items?

Not that I am aware of


Reviewer guidance

How can a reviewer test these changes?

You can follow the manual QA steps listed above

Are there any risky areas that deserve extra testing?

There was one scenario that seemed a bit wonky, but I haven't be able to reproduce consistently.

  1. Video file that is the same for both high and low resolution options
  2. Replace the high resolution file following the steps above
  3. The low resolution sometimes is still the other video file, and sometimes the duration still matches this. Other times, when the file is changed, the "low resolution" option from the old file seems to be automatically deleted.

Comments

It's possible there might be edge cases I'm not thinking of, of why this solution wouldn't be a good idea?


Contributor's Checklist

PR process:

  • If this is an important user-facing change, PR or related issue the CHANGELOG label been added to this PR. Note: items with this label will be added to the CHANGELOG at a later time
  • If this includes an internal dependency change, a link to the diff is provided
  • The docs label has been added if this introduces a change that needs to be updated in the user docs?
  • If any Python requirements have changed, the updated requirements.txt files also included in this PR
  • Opportunities for using Google Analytics here are noted
  • Migrations are safe for a large db

Studio-specifc:

  • All user-facing strings are translated properly
  • The notranslate class been added to elements that shouldn't be translated by Google Chrome's automatic translation feature (e.g. icons, user-generated text)
  • All UI components are LTR and RTL compliant
  • Views are organized into pages, components, and layouts directories as described in the docs
  • Users' storage used is recalculated properly on any changes to main tree files
  • If there new ways this uses user data that needs to be factored into our Privacy Policy, it has been noted.

Testing:

  • Code is clean and well-commented
  • Contributor has fully tested the PR manually
  • If there are any front-end changes, before/after screenshots are included
  • Critical user journeys are covered by Gherkin stories
  • Any new interactions have been added to the QA Sheet
  • Critical and brittle code paths are covered by unit tests

Reviewer's Checklist

This section is for reviewers to fill out.

  • Automated test coverage is satisfactory
  • PR is fully functional
  • PR has been tested for accessibility regressions
  • External dependency files were updated if necessary (yarn and pip)
  • Documentation is updated
  • Contributor is in AUTHORS.md

@marcellamaki marcellamaki requested a review from bjester August 10, 2022 13:55
Copy link
Member

@bjester bjester left a comment

Choose a reason for hiding this comment

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

No blockers, but some worthwhile suggestions. I'll test it now

if (this.firstNode.kind === 'audio' || this.firstNode.kind === 'video') {
return this.nodeFiles.filter(
audioVideoFiles = this.nodeFiles.filter(
file => file.file_format === 'mp4' || file.file_format === 'mp3'
Copy link
Member

Choose a reason for hiding this comment

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

I know you didn't change this, but it looks worthwhile to fix-- it's excluding the newly added .webm format. To go one step further, for posterity, I would suggest using the presets information on what formats are video or audio resources

Copy link
Member Author

Choose a reason for hiding this comment

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

I actually wonder if it's necessary to include this check here, now that I revisit it, since I believe the presets are already checked earlier in upload?

Copy link
Member Author

Choose a reason for hiding this comment

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

@bjester I've removed for now, based on my understanding of what's happening in upload, but if you think keeping this check (and updating to include .webm, using presets) here is helpful, I will add in a modified version

Copy link
Member

Choose a reason for hiding this comment

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

Yeah I thought the same about keeping the check, and what I guessed was that since this uses nodeFiles, that it could run into subtitle files too?

Copy link
Member Author

Choose a reason for hiding this comment

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

great point! I've updated @bjester

Copy link
Member

@bjester bjester left a comment

Choose a reason for hiding this comment

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

Fixes the issue! Please re-request my review if you implement my suggestions

@marcellamaki
Copy link
Member Author

Thanks @bjester - your comments are really helpful. I'll plan to implement these updates and re-request your review tomorrow morning :)

@marcellamaki marcellamaki requested a review from bjester August 12, 2022 13:41
… files that support captioning, subtitles, etc.
Copy link
Member

@bjester bjester left a comment

Choose a reason for hiding this comment

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

LGTM

FormatPresetsMap.get(FormatPresetsNames.HIGH_RES_VIDEO).allowed_formats
);
allowedFileTypes.push(FormatPresetsMap.get(FormatPresetsNames.AUDIO).allowed_formats);
allowedFileTypes = allowedFileTypes.flat();
Copy link
Member

Choose a reason for hiding this comment

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

TIL .flat() exists on Array.prototype

Copy link
Member

Choose a reason for hiding this comment

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

A slight optimization would be to only create this allowedFileTypes array once, outside of this function scope, but I think it's unlikely to have major performance differences

@bjester bjester merged commit ce072d7 into learningequality:unstable Aug 17, 2022
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.

Re-uploading audio and video files doesn't update ActivityDuration
2 participants