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

[PAID] [$500] Video - Two different crashes occur when downloading video #36833

Closed
6 tasks
kavimuru opened this issue Feb 20, 2024 · 42 comments
Closed
6 tasks
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor

Comments

@kavimuru
Copy link

kavimuru commented Feb 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.43-0
Reproducible in staging?: y
Reproducible in production?: new feature
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: applause internal team
Slack conversation:

Action Performed:

  1. Launch New Expensify app.
  2. Go to any chat.
  3. Upload a video.
  4. Without playing the video, tap 3-dot menu > Download.
  5. Tap Refresh.
  6. Upload a video.
  7. Play the videp.
  8. While the video is playing, tap 3-dot menu > Download.

Expected Result:

In Step 4 and 8, video will be downloaded successfully.

Actual Result:

In Step 4 and 8, different kind of crash occurs when downloading the video.

Workaround:

Can the user still use Expensify without this being fixed? Have you informed them of the workaround?

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

Bug6385234_1708401514169.Screen_Recording_20240220_100945_New_Expensify.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0123abf5d159d1b988
  • Upwork Job ID: 1759796028263505920
  • Last Price Increase: 2024-02-20
  • Automatic offers:
    • shahinyan11 | Contributor | 0
@kavimuru kavimuru added DeployBlockerCash This issue or pull request should block deployment External Added to denote the issue can be worked on by a contributor Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Feb 20, 2024
@melvin-bot melvin-bot bot changed the title Video - Two different crashes occur when downloading video [$500] Video - Two different crashes occur when downloading video Feb 20, 2024
Copy link

melvin-bot bot commented Feb 20, 2024

Job added to Upwork: https://www.upwork.com/jobs/~0123abf5d159d1b988

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

melvin-bot bot commented Feb 20, 2024

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

Copy link

melvin-bot bot commented Feb 20, 2024

Triggered auto assignment to @strepanier03 (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@github-actions github-actions bot added Engineering Hourly KSv2 and removed Daily KSv2 labels Feb 20, 2024
Copy link
Contributor

👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

  1. Identify the pull request that introduced this issue and revert it.
  2. Find someone who can quickly fix the issue.
  3. Fix the issue yourself.

@kavimuru
Copy link
Author

we think this bug might be related to #vip-vsb
cc @quinthar

Copy link

melvin-bot bot commented Feb 20, 2024

Triggered auto assignment to @MariaHCD (Engineering), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

@habasefa
Copy link

Proposal

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

Crashes occur when downloading video from preview

What is the root cause of that problem?

Downloading a video from preview, a video not uploaded yet.

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

We should remove the download button, just like in pdf preview

const menuItems = useMemo(
() => [
{
icon: Expensicons.Download,
text: translate('common.download'),
onSelected: () => {
downloadAttachment();
},
},

What alternative solutions did you explore? (Optional)

@MariaHCD
Copy link
Contributor

This looks related to #30829

cc: @Skalakid @francoisl @akinwale

@shahinyan11
Copy link
Contributor

shahinyan11 commented Feb 20, 2024

Proposal

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

Video - Two different crashes occur when downloading video

What is the root cause of that problem?

Here the download function uses currentVideoPlayerRef from usePlaybackContext() .
And now the currentVideoPlayerRef is null until the video is playing. It is because here the shareVideoPlayerElements should be called to set currentVideoPlayerRef in VideoPlayerContexts.
But it is not called due to above condition url !== currentlyPlayingURL. The url is preview url but the currentlyPlayingURL is null until the video is playing

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

And add below useEffect here

useEffect(() => {
    currentVideoPlayerRef.current = videoPlayerRef.current;
}, [url]);

What alternative solutions did you explore? (Optional)

Remove download code from default menuItems and add it only when the currentVideoPlayerRef.current exists

    const menuItems = useMemo(
        () => [
                {
                    icon: Expensicons.Meter,
                    text: translate('videoPlayer.playbackSpeed'),
                    subMenuItems: [
                        ..._.map(CONST.VIDEO_PLAYER.PLAYBACK_SPEEDS, (speed) => ({
                            icon: currentPlaybackSpeed === speed ? Expensicons.Checkmark : null,
                            text: speed.toString(),
                            onSelected: () => {
                                updatePlaybackSpeed(speed);
                            },
                            shouldPutLeftPaddingWhenNoIcon: true,
                        })),
                    ],
                },
            ],
        [currentVideoPlayerRef, currentPlaybackSpeed, downloadAttachment, translate, updatePlaybackSpeed],
    );

    if(currentVideoPlayerRef.current && menuItems.length < 2){
        menuItems.unshift({
            icon: Expensicons.Download,
            text: translate('common.download'),
            onSelected: () => {
                downloadAttachment();
            },
        })
    }

What alternative solutions did you explore? (Optional)

I don’t know why this url !== currentlyPlayingURL check is used there to say whether it is worth deleting it altogether?
No if it should not be deleted it we can change this condition with one of below options

  1. if (shouldUseSharedVideoElement || !url)
  2. if (shouldUseSharedVideoElement || (currentlyPlayingURL && url !== currentlyPlayingURL))

But with these changes, the video will play automatically after uploading and If we do not like this approach we can choose below option

@MariaHCD
Copy link
Contributor

@eVoloshchak What do you think of the proposals so far?

@MariaHCD
Copy link
Contributor

@francoisl
Copy link
Contributor

@Habtamu-Asefa I think your proposal is incomplete, it would remove the download button even when playing a video that's already been uploaded. Also, the same crash happens when changing the playback speed, and while it would make sense to remove the download button for a video that hasn't been uploaded yet, we probably want to keep the playback speed option while previewing videos before uploading them.

@shahinyan11 your solution fixes the crashes for me locally, though in your second useEffect() it looks like setCurrentVideoPlayerRef and videoPlayerRef are missing as dependencies, right?

@shahinyan11
Copy link
Contributor

@shahinyan11 your solution fixes the crashes for me locally, though in your second useEffect() it looks like setCurrentVideoPlayerRef and videoPlayerRef are missing as dependencies, right?

@francoisl No sense to use ref value in dependencies . It doesn't affect anything . Are you agree ?

@francoisl
Copy link
Contributor

francoisl commented Feb 20, 2024

Maybe but that's an ESLint rule, you can try locally and I'm pretty sure the linter will give you a warning.

Other question: the currentVideoPlayerRef.current is already being set in the shareVideoPlayerElements useCallback, can we remove it from there?

@puneetlath
Copy link
Contributor

Removing the deploy blocker label. Doesn't seem like this is a staging-only issue.

Copy link

melvin-bot bot commented Mar 5, 2024

⚠️ Looks like this issue was linked to a Deploy Blocker here

If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

If a regression has occurred and you are the assigned CM follow the instructions here.

If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Mar 6, 2024
@melvin-bot melvin-bot bot changed the title [$500] Video - Two different crashes occur when downloading video [HOLD for payment 2024-03-13] [$500] Video - Two different crashes occur when downloading video Mar 6, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Mar 6, 2024
Copy link

melvin-bot bot commented Mar 6, 2024

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

Copy link

melvin-bot bot commented Mar 6, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.47-10 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-03-13. 🎊

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

Copy link

melvin-bot bot commented Mar 6, 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:

  • [@eVoloshchak] The PR that introduced the bug has been identified. Link to the PR:
  • [@eVoloshchak] 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:
  • [@eVoloshchak] 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:
  • [@eVoloshchak] Determine if we should create a regression test for this bug.
  • [@eVoloshchak] 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.
  • [@strepanier03] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Mar 13, 2024
@strepanier03
Copy link
Contributor

@shahinyan11 - I've paid you via Upwork and closed the contract.

@eVoloshchak - I'll post the payment summary for your manual request once the checklist is done.

Thanks!

@aimane-chnaif
Copy link
Contributor

aimane-chnaif commented Mar 14, 2024

Note: there was another crash regression from this issue - https://github.com/Expensify/App/pull/37122/files#r1525005774.
I suggest not to apply penalty since it's tough one and video player feature has still lots of minor small bugs.

@strepanier03
Copy link
Contributor

Thank you @aimane-chnaif for the update and the context into the penalty. Unless someone disagrees I'll go with your recommendation.

@strepanier03
Copy link
Contributor

@eVoloshchak - Checklist when you get a chance please!

@melvin-bot melvin-bot bot added the Overdue label Mar 18, 2024
Copy link

melvin-bot bot commented Mar 18, 2024

@francoisl, @eVoloshchak, @strepanier03, @shahinyan11 Whoops! This issue is 2 days overdue. Let's get this updated quick!

@eVoloshchak eVoloshchak mentioned this issue Mar 19, 2024
58 tasks
@eVoloshchak
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#r1529495802
  • 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: I don't think an additional discussion is needed, this was an edge case missed during implementation of a major feature

Regression Test Proposal

  1. Go to any chat.
  2. Click + button -> Add Attachment -> select any video
  3. Tap 3-dot menu and make sure there is no Download action

Do we agree 👍 or 👎

@melvin-bot melvin-bot bot removed the Overdue label Mar 19, 2024
@strepanier03
Copy link
Contributor

@strepanier03
Copy link
Contributor

strepanier03 commented Mar 19, 2024

Payment summary

@JmillsExpensify incoming payment request from @eVoloshchak.

@strepanier03 strepanier03 changed the title [HOLD for payment 2024-03-13] [$500] Video - Two different crashes occur when downloading video [PAID] [$500] Video - Two different crashes occur when downloading video Mar 19, 2024
@JmillsExpensify
Copy link

$500 approved for @eVoloshchak based on summary.

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 Engineering External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests