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

[HOLD for payment 2024-05-09] [$250] Incorrect video downloaded #40647

Closed
1 of 6 tasks
m-natarajan opened this issue Apr 20, 2024 · 27 comments
Closed
1 of 6 tasks

[HOLD for payment 2024-05-09] [$250] Incorrect video downloaded #40647

m-natarajan opened this issue Apr 20, 2024 · 27 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor

Comments

@m-natarajan
Copy link

m-natarajan commented Apr 20, 2024

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: 1.4.63-7
Reproducible in staging?: y
Reproducible in production?: y
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: @blimpich / @KMichel1030
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1713565550549779

Action Performed:

  1. Upload two videos
  2. Play video 1
  3. Play video 2
  4. Open three dot menu of video Some initial fixes and code style updates #1 and press Download

Expected Result:

Video #1 should be downloaded.

Actual Result:

Video #2 is downloaded.

Workaround:

unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

Recording.3005.mp4
Issue.2.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01c92de1e47026775d
  • Upwork Job ID: 1781835136773414912
  • Last Price Increase: 2024-04-20
  • Automatic offers:
    • rayane-djouah | Reviewer | 0
Issue OwnerCurrent Issue Owner: @kadiealexander
@m-natarajan m-natarajan added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Apr 20, 2024
Copy link

melvin-bot bot commented Apr 20, 2024

Triggered auto assignment to @kadiealexander (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

@KMichel1030
Copy link
Contributor

KMichel1030 commented Apr 20, 2024

Proposal

Please re-state the problem that we are trying to solve in this issue.

Incorrect video downloaded

What is the root cause of that problem?

When downloading, we get source uri from currentlyPlayingURL.
currentlyPlayingURL indicates currently playing video. So if we try to download video which is not playing, playing video is downloaded.

const downloadAttachment = useCallback(() => {
if (currentlyPlayingURL === null) {
return;
}
const sourceURI = addEncryptedAuthTokenToURL(currentlyPlayingURL);
fileDownload(sourceURI);
}, [currentlyPlayingURL]);

What changes do you think we should make in order to solve the problem?

We can get source uri from videoPlayerRef instead of currentlyPlayingURL.

  1. Add ref which stores current video ref(ref of video player which we are trying to download) in VideoPopoverMenuContext
  2. set ref with videoPlayerRef when opening popover menu
    const showPopoverMenu = (event?: GestureResponderEvent | KeyboardEvent) => {
    setIsPopoverVisible(true);
  3. In downloadAttachment function, get uri from that ref.

What alternative solutions did you explore? (Optional)

We can update currentlyPlayingURL, currentVideoPlayerRef, when opening popover menu.

const showPopoverMenu = (event?: GestureResponderEvent | KeyboardEvent) => {
setIsPopoverVisible(true);
if (!event || !('nativeEvent' in event)) {
return;
}
setPopoverAnchorPosition({horizontal: event.nativeEvent.pageX, vertical: event.nativeEvent.pageY});
};

test.mp4

Copy link

melvin-bot bot commented Apr 20, 2024

📣 @KMichel1030! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:

  1. Make sure you've read and understood the contributing guidelines.
  2. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  3. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
    Screen Shot 2022-11-16 at 4 42 54 PM
    Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>

@blimpich blimpich self-assigned this Apr 20, 2024
@blimpich blimpich added the External Added to denote the issue can be worked on by a contributor label Apr 20, 2024
@melvin-bot melvin-bot bot changed the title Incorrect video downloaded [$250] Incorrect video downloaded Apr 20, 2024
Copy link

melvin-bot bot commented Apr 20, 2024

Job added to Upwork: https://www.upwork.com/jobs/~01c92de1e47026775d

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Apr 20, 2024
Copy link

melvin-bot bot commented Apr 20, 2024

Triggered auto assignment to Contributor-plus team member for initial proposal review - @rayane-djouah (External)

@Krishna2323
Copy link
Contributor

Krishna2323 commented Apr 21, 2024

Proposal

Please re-state the problem that we are trying to solve in this issue.

Incorrect video downloaded

What is the root cause of that problem?

We are using the url of the current playing video.

const {currentVideoPlayerRef, currentlyPlayingURL} = usePlaybackContext();

const sourceURI = addEncryptedAuthTokenToURL(currentlyPlayingURL);
fileDownload(sourceURI);

What changes do you think we should make in order to solve the problem?

We should create a new state url in VideoPopooverMenuContext and pass the setState function through the context and in VideoPopoverMenu we should accept url from BaseVideoPlayer and whenever the popover becomes visible we will update the url state in VideoPopoverMenu .

// In VideoPopoverMenuContextProvider 
const [url, setUrl] = useState('');

const contextValue = useMemo(
    () => ({menuItems, updatePlaybackSpeed , setUrl}),
    [menuItems, updatePlaybackSpeed, setUrl],
);
    
// in VideoPopoverMenu
const {menuItems, setUrl} = useVideoPopoverMenuContext();   
 
useEffect(() => {
    if (!isPopoverVisible) {
        return;
    }
    setUrl(url);
}, [isPopoverVisible]);

// Pass url from BaseVideoPlayer
<VideoPopoverMenu
    isPopoverVisible={isPopoverVisible}
    hidePopover={hidePopoverMenu}
    anchorPosition={popoverAnchorPosition}
    url={url}
/>

Same can be done with videoRef/currentVideoPlayerRef if needed.

What alternative solutions did you explore? (Optional)

@shahinyan11
Copy link
Contributor

shahinyan11 commented Apr 23, 2024

Proposal

Please re-state the problem that we are trying to solve in this issue.

Incorrect video downloaded

What is the root cause of that problem?

We do not update currentlyPlayingURL when showing video popover

What changes do you think we should make in order to solve the problem?

  1. Add new downloadURL as ref in VideoPopoverMenuContext component and use downloadURL.current in downloadAttachment function instead currentlyPlayingURL. Also add downloadURL in contextValue.
const downloadURL = useRef()

...

const downloadAttachment = useCallback(() => {
    if (downloadURL.current === null) {
        return;
    }
    const sourceURI = addEncryptedAuthTokenToURL(downloadURL.current);
    fileDownload(sourceURI);
}, [downloadURL]);
  1. Get downloadURL from useVideoPopoverMenuContext() in BaseVideoPlayer component and add below code on this line ( before if block ).
downloadURL.current = url

What alternative solutions did you explore? (Optional)

Add bellow code on this line ( before if block ).

if (!isCurrentlyURLSet) {
    updateCurrentlyPlayingURL(url);
}

@melvin-bot melvin-bot bot added the Overdue label Apr 23, 2024
@rayane-djouah
Copy link
Contributor

Reviewing Proposals

@melvin-bot melvin-bot bot removed the Overdue label Apr 23, 2024
@shahinyan11
Copy link
Contributor

Proposal

Updated.

@melvin-bot melvin-bot bot added the Overdue label Apr 25, 2024
@rayane-djouah
Copy link
Contributor

Reviewing now

@melvin-bot melvin-bot bot removed the Overdue label Apr 25, 2024
@rayane-djouah
Copy link
Contributor

rayane-djouah commented Apr 25, 2024

Thank you all for your proposals. Unfortunately, none of the proposals considered changing the playback speed bug case (which has the same root cause). Please ensure that your solution passes the following test:

  1. Upload two videos.
  2. Play video 1.
  3. Play video 2.
  4. Open the three-dot menu for video 1 and select Playback.
  5. Change the playback speed.
  6. Verify that the playback speed of video 1 has changed, and not that of video 2.

@Krishna2323
Copy link
Contributor

@rayane-djouah, here is my test branch incase you want to test.

@rayane-djouah
Copy link
Contributor

The playback speed bug will be handled in #40646. Let's address the download bug in this issue.

@KMichel1030, you've identified the correct root cause, and the suggested changes are working. However, they are causing a type error:

Screenshot 2024-04-25 at 2 11 08 PM

@Krishna2323, your proposal suggests using a state instead of a ref. Are there any concerns with this approach?

@jsdev2547, your proposal involves using the onLayout event of VideoPlayerControls. Are there any concerns with this approach?

@KMichel1030
Copy link
Contributor

@rayane-djouah
Thank you for your check.
It seems you checked my working branch. I've updated working branch.

@rayane-djouah
Copy link
Contributor

Thank you all for your proposals.
@KMichel1030's proposal looks good to me. using videoPlayerRef in VideoPopoverMenuContext will help us fix playback speed bug in the other issue. also, it will be useful if we add additional options to the popover menu in the future.
I'm open for discussion if anyone disagree with the proposal suggested solution.

🎀👀🎀 C+ reviewed

Copy link

melvin-bot bot commented Apr 25, 2024

Current assignee @blimpich is eligible for the choreEngineerContributorManagement assigner, not assigning anyone new.

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Apr 25, 2024
Copy link

melvin-bot bot commented Apr 25, 2024

📣 @rayane-djouah 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job

Copy link

melvin-bot bot commented Apr 25, 2024

The BZ member will need to manually hire KMichel1030 for the Contributor role. Please store your Upwork details and apply to our Upwork job so this process is automatic in the future!

@blimpich
Copy link
Contributor

PS: @KMichel1030 looks like you still need to respond to this comment. Feel free to raise a PR but also don't forget to setup your upwork profile and respond to that comment so we can automate this in the future 👍

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Apr 26, 2024
@KMichel1030
Copy link
Contributor

Contributor details
Your Expensify account email: kmichel1030@gmail.com
Upwork Profile Link: https://www.upwork.com/freelancers/~019b26cf011ef5d91b

Copy link

melvin-bot bot commented Apr 26, 2024

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels May 2, 2024
@melvin-bot melvin-bot bot changed the title [$250] Incorrect video downloaded [HOLD for payment 2024-05-09] [$250] Incorrect video downloaded May 2, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label May 2, 2024
Copy link

melvin-bot bot commented May 2, 2024

Reviewing label has been removed, please complete the "BugZero Checklist".

Copy link

melvin-bot bot commented May 2, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.69-2 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2024-05-09. 🎊

For reference, here are some details about the assignees on this issue:

Copy link

melvin-bot bot commented May 2, 2024

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

  • [@rayane-djouah] The PR that introduced the bug has been identified. Link to the PR:
  • [@rayane-djouah] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
  • [@rayane-djouah] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
  • [@rayane-djouah] Determine if we should create a regression test for this bug.
  • [@rayane-djouah] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
  • [@kadiealexander] Link the GH issue for creating/updating the regression test once above steps have been agreed upon: https://github.com/Expensify/Expensify/issues/394884

@rayane-djouah
Copy link
Contributor

  • The PR that introduced the bug has been identified. Link to the PR: Video player #30829
  • The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment: https://github.com/Expensify/App/pull/30829/files#r1589581156
  • A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion: N.A.
  • Determine if we should create a regression test for this bug. Yes.
  • If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.

Regression test proposal

  1. Upload two videos
  2. Play video 1
  3. Play video 2
  4. Open three dot menu of video 1 and press Download
  5. Verify that video 1 is downloaded.
  • Do we agree 👍 or 👎

@melvin-bot melvin-bot bot added Daily KSv2 Overdue and removed Weekly KSv2 labels May 8, 2024
@KMichel1030
Copy link
Contributor

Hi, @kadiealexander
Can I get paid for this issue?

@kadiealexander
Copy link
Contributor

kadiealexander commented May 10, 2024

Payouts due:

Upwork job is here.

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels May 10, 2024
@melvin-bot melvin-bot bot removed the Overdue label May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor
Projects
Archived in project
Development

No branches or pull requests

7 participants