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

[Awaiting Contributor Response for Payment - Payment 27th June] [$250] Incorrect video is paused after turning on and off full screen mode #42427

Closed
1 of 6 tasks
m-natarajan opened this issue May 21, 2024 · 51 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Weekly KSv2

Comments

@m-natarajan
Copy link

m-natarajan commented May 21, 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.74-4
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/p1716239323512349

Action Performed:

  1. Upload two videos (Video1, Video2)
  2. Play Video1
  3. Play Video2
  4. Click full screen mode button of Video1 while Video2 is playing
  5. Exit full screen mode by pressing Esc key
  6. Click play button of Video1

Expected Result:

Video1 should be played

Actual Result:

Video2 is played

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

bandicam.2024-05-17.08-42-04-936.mp4
Recording.97.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0153a7421c659e1e1b
  • Upwork Job ID: 1793023328329351168
  • Last Price Increase: 2024-05-28
  • Automatic offers:
    • hoangzinh | Reviewer | 102587027
Issue OwnerCurrent Issue Owner: @trjExpensify
@m-natarajan m-natarajan added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels May 21, 2024
Copy link

melvin-bot bot commented May 21, 2024

Triggered auto assignment to @trjExpensify (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.

@trjExpensify
Copy link
Contributor

@KMichel1030 are you interesting in proposing a solution for this?

@trjExpensify trjExpensify added the External Added to denote the issue can be worked on by a contributor label May 21, 2024
@melvin-bot melvin-bot bot changed the title Incorrect video is paused after turning on and off full screen mode [$250] Incorrect video is paused after turning on and off full screen mode May 21, 2024
Copy link

melvin-bot bot commented May 21, 2024

Job added to Upwork: https://www.upwork.com/jobs/~0153a7421c659e1e1b

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

melvin-bot bot commented May 21, 2024

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

@jacobnguyen0000
Copy link
Contributor

Proposal

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

Incorrect video is paused after turning on and off full screen mode

What is the root cause of that problem?

When entering full screen mode, currentlyPlayingURL is updated, but currentVideoPlayerRef is not updated because we have isFullScreenRef check here.
Since we use currentVideoPlayerRef when play and pause video, incorrect video is paused.

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

We should remove isFullScreenRef check here.
We also need to modify last parameter of this line to prevent auto play when entering full screen mode.

What alternative solutions did you explore? (Optional)

Copy link

melvin-bot bot commented May 21, 2024

📣 @jacobnguyen0000! 📣
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>

@tienifr
Copy link
Contributor

tienifr commented May 22, 2024

Proposal

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

What is the root cause of that problem?

  • Let say we have two video A and B.

  • When we play B then enter the fullscreen mode with A, we call updateCurrentlyPlayingURL in here and we do not call shareVideoPlayerElements in here. Now currentlyPlayingURL refers to A, but currentVideoPlayerRef refers to B.

  • Then, after we turn off fullscreen mode, currentlyPlayingURL still refers to A, but currentVideoPlayerRef still refers to B.

  • So when we click on the "Play" button in A, in here, because isCurrentlyURLSet is true, so the updateCurrentlyPlayingURL(url) is not called.

  • So this useEffect is not called because one of its dependences, currentlyPlayingURL is not updated. That leads to currentVideoPlayerRef still refers to B. That why we click on "Play" button in A, B is played.

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

 if (!isUploading && shouldPlayVideo) { 
     playVideo(); 
 }
  • Then, we can call this logic manually in here with param shouldPlayVideo: false

What alternative solutions did you explore? (Optional)

  • We can call updateCurrentlyPlayingURL(null) in here to reset the currently playing url.

@mstindia-com
Copy link

mstindia-com commented May 22, 2024

Proposal

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

Incorrect video is paused after turning on and off full-screen mode on a video.

What is the root cause of that problem?

The initial value for currectVideoPlayerRef was set by VideoWithOnFullScreenUpdate.
That's why only play action sets the currectVideoPlayerRef. and not the fullscreen button action.
Because of the reference to the last played video, the incorrect video is paused.

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

currectVideoPlayerRef should be updated or assigned as per action taken on videos.
Initially set currentVideoPlayerRef as null to fix errors on load.
currentVideoPlayerRef will be assigned when the video player play button is triggered.

  1. Update the following line
    const {updateCurrentlyPlayingURL} = usePlaybackContext();

    with following
const {updateCurrentlyPlayingURL, currentVideoPlayerRef} = usePlaybackContext();
  1. In the function enterFullScreenMode after the following line
    videoPlayerRef.current?.presentFullscreenPlayer();

    add the following line of code
currentVideoPlayerRef?.current = videoPlayerRef.current;
  1. Update the following line
    const currentVideoPlayerRef = useRef<VideoWithOnFullScreenUpdate | null>(null);

    with the following
const currentVideoPlayerRef = useRef(null);

What alternative solutions did you explore? (Optional)

@tienifr
Copy link
Contributor

tienifr commented May 23, 2024

I updated alternative solution

@hoangzinh
Copy link
Contributor

Thanks for proposals everyone, I will manage to review today

@hoangzinh
Copy link
Contributor

hoangzinh commented May 24, 2024

@jacobnguyen0000 Thanks for proposal #42427 (comment). I don't think we can remove isFullScreenRef.current from here. Thanks to @tienifr, he already confirmed reason with author of that line here

@hoangzinh
Copy link
Contributor

@mstindia-com Thanks for proposal #42427 (comment). I don't think your solution is correct. It makes sense to set isFullScreenRef.current = true from here so player knows it's on full screen mode.

@hoangzinh
Copy link
Contributor

@tienifr Thanks for proposal #42427 (comment). Your RCA is great, it's very clear to help me understand RC. But I'm confused your main solution, why having shouldPlayVideo would solve this issue, or your alternative solution, could you help me understand why set updateCurrentlyPlayingURL(null) solve this issue? Base on your RCA, I think that is it better if we also set currentVideoPlayerRef refers to A here?

@tienifr
Copy link
Contributor

tienifr commented May 24, 2024

@hoangzinh In my main solution, the solution to fix the bug is just calling this logic manually in here. shouldPlayVideo is used to fix the bug that: the video is always played after turning off fullscreen mode.

@tienifr
Copy link
Contributor

tienifr commented May 24, 2024

could you help me understand why set updateCurrentlyPlayingURL(null) solve this issue

As I mentioned in the RCA:

So this useEffect is not called because one of its dependences, currentlyPlayingURL is not updated. That leads to currentVideoPlayerRef still refers to B. That why we click on "Play" button in A, B is played.

If we call updateCurrentlyPlayingURL(null) after turning off fullscreen mode, it will set the currentlyPlayingURL to null. When we click on play button, currentlyPlayingURL will be set to A. Because null !== A, so the useEffect is called, so the shareVideoPlayerElements is called.

@jacobnguyen0000
Copy link
Contributor

@hoangzinh
Thank you for your review.

@jacobnguyen0000 Thanks for proposal #42427 (comment). I don't think we can remove isFullScreenRef.current from here. Thanks to @tienifr, he already confirmed reason with author of that line #38407 (comment)

I've tested on my end but it seems removing isFullScreenRef.current doesn't any problem.

@mstindia-com
Copy link

Proposal

Updated

@mstindia-com
Copy link

@hoangzinh Thanks for your reply. I managed to find a solution. updated my proposal.

@hoangzinh
Copy link
Contributor

@tienifr @jacobnguyen0000 @mstindia-com thanks for updates. After considering proposals, I think:

@tienifr
Copy link
Contributor

tienifr commented May 27, 2024

@hoangzinh Thanks for your feedback.

  • As mentioned in here, the video player should not be set when turning on fullscreen mode. But this solution does not follow this rule. So it can lead to regression.

  • With the above point, the RCA "When entering full-screen mode on a video currentlyPlayingURL is updated, but currentVideoPlayerRef is not updated." is not correct as well. Because "currentVideoPlayerRef is not updated" aims to make sure this rule, but it is considered as the RCA leads to the bug.

  • Also, I don't think that using an additional param shouldPlayVideo is the problem. It is very straightforward.

@tienifr
Copy link
Contributor

tienifr commented May 27, 2024

@hoangzinh Also, what do you think about my alternative solution?

@jacobnguyen0000
Copy link
Contributor

@hoangzinh

@jacobnguyen0000 solution could lead to the unknown bug here #42427 (comment)

Thank you for your check.

isFullScreenRef is responsible for locking the video player when screen orientation changes in full-screen mode. It prevents video players from changing their state because of device rotation or window size changes. Changing state causes the full screen to dismiss. We need it here to block updating currently shared video element

I've tested above cases and confirmed it's working properly with my proposal.

@jacobnguyen0000
Copy link
Contributor

@hoangzinh
Checking with author here

@trjExpensify
Copy link
Contributor

Bump @jacobnguyen0000 on providing your Upwork profile for payment.

@grgia
Copy link
Contributor

grgia commented Jul 1, 2024

awaiting payment details, not overdue

@trjExpensify
Copy link
Contributor

Melvin, stop it.

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Jul 1, 2024
@trjExpensify
Copy link
Contributor

@jacobnguyen0000 bump here!

@melvin-bot melvin-bot bot added Daily KSv2 and removed Overdue Daily KSv2 labels Jul 4, 2024
@hoangzinh
Copy link
Contributor

He hasn't had any activities this July yet https://github.com/jacobnguyen0000. We can change to weekly label while waiting for @jacobnguyen0000 response 🤔

@melvin-bot melvin-bot bot added the Overdue label Jul 8, 2024
@trjExpensify trjExpensify changed the title [Awaiting Payment 27th June] [$250] Incorrect video is paused after turning on and off full screen mode [Awaiting Contributor Response for Payment - Payment 27th June] [$250] Incorrect video is paused after turning on and off full screen mode Jul 8, 2024
@trjExpensify trjExpensify added Weekly KSv2 and removed Daily KSv2 labels Jul 8, 2024
@melvin-bot melvin-bot bot removed the Overdue label Jul 8, 2024
@trjExpensify
Copy link
Contributor

Cool, dropped to weekly. I'll likely just close this after a couple of weeks, and @jacobnguyen0000 can let me know when he's back if he wants to get paid.

@melvin-bot melvin-bot bot added the Overdue label Jul 18, 2024
@trjExpensify
Copy link
Contributor

Closing.

@jacobnguyen0000
Copy link
Contributor

Hi, @trjExpensify
Sorry for late response. Can I get payment now?

Contributor details
Your Expensify account email: jacobnguyen0000@outlook.com
Upwork Profile Link: https://www.upwork.com/freelancers/~014cac515a92876fc5

Copy link

melvin-bot bot commented Aug 6, 2024

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

@jacobnguyen0000
Copy link
Contributor

@mallenexpensify
It seems @trjExpensify is not here.
Could you please complete payment here?

@trjExpensify
Copy link
Contributor

Sent an offer.

@trjExpensify trjExpensify reopened this Aug 7, 2024
@jacobnguyen0000
Copy link
Contributor

Thank you, @trjExpensify.
I've accepted offer.

@trjExpensify
Copy link
Contributor

Paid!

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. External Added to denote the issue can be worked on by a contributor Weekly KSv2
Projects
No open projects
Archived in project
Development

No branches or pull requests

7 participants