-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Fix crash when expanding video player #37772
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
Fix crash when expanding video player #37772
Conversation
@rushatgabhane Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
@rushatgabhane oops, wrong linked issue. @aimane-chnaif will review this. |
if (!isUploading) { | ||
return; | ||
} | ||
// If we are uploading a new video, we want to immediately set the video player ref. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I use isUploading
condition here because in attachment carousel with multiple video player on small screen, the video player ref is set to the wrong video player.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For example, if we have video A and B in carousel, and we open video B, it could be possible the video A video player is set as the ref when both component mounted.
// This should ensure we clean up any video references when closing the attachment modal as these only existed here in memory during attachment preview. | ||
useEffect( | ||
() => () => { | ||
if (!isVideo) { | ||
return; | ||
} | ||
currentVideoPlayerRef.current = null; | ||
}, | ||
[isVideo, currentVideoPlayerRef], | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make sure that this removal doesn't cause regression of #37142.
Android recording left, it's very laggy on the Android emulator. I also feel like the video player is a bit broken on mobile devices. Sometimes the video is paused randomly. |
@bernhardoj can you please perform full regression tests against these issue? #36833 This would be CP'ed to staging so we should be very careful. |
Lint failing |
#37142 : sometimes the console error shows, looks like sometimes the clearing ref useEffect is a bit late. Will check it further tomorrow. (EDIT: now I can't reproduce it at all) To clarify, the console error that I previously saw is when closing the attachment preview by sending the attachment. |
@bernhardoj thanks. Please keep online for the next hour as this should be merged today as deploy blocker. |
if (shouldUseSharedVideoElementRef.current) { | ||
return; | ||
} | ||
// If it's not a shared video player, clear the video player ref. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// If it's not a shared video player, clear the video player ref. | |
// If it's not a shared video player, clear the video player ref. |
if (!isUploading) { | ||
return; | ||
} | ||
// If we are uploading a new video, we want to immediately set the video player ref. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// If we are uploading a new video, we want to immediately set the video player ref. | |
// If we are uploading a new video, we want to immediately set the video player ref. |
Reviewer Checklist
Screenshots/VideosAndroid: Nativeandroid.movAndroid: mWeb ChromeiOS: Nativeios.moviOS: mWeb Safarimsafari.movMacOS: Chrome / Safariweb.movMacOS: Desktopdesktop.mov |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My comments can be fixed in another PR, NAB
@pecanoro looks like this was merged without a test passing. Please add a note explaining why this was done and remove the |
Hmm, I didn't notice some checks were not passing 😢 |
Hmm, I don't see the check failing, weird, removing the label |
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
…panding-video Fix crash when expanding video player (cherry picked from commit 4ae0b42)
🚀 Deployed to production by https://github.com/roryabraham in version: 1.4.47-10 🚀
|
Details
The app crash when we expand the video player because the video player ref is null.
Fixed Issues
$ #37710
PROPOSAL: #37710 (comment)
Tests
Same as QA Steps
Offline tests
Same as QA Steps
QA Steps
Web/Desktop
Android/iOS/mWeb
(the video player on small screen works really bad right now)
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
Screen.Recording.2024-03-06.at.00.42.22.mov
iOS: Native
Screen.Recording.2024-03-06.at.00.35.42.mov
iOS: mWeb Safari
Screen.Recording.2024-03-06.at.00.37.00.mov
MacOS: Chrome / Safari
Screen.Recording.2024-03-06.at.00.18.25.mov
MacOS: Desktop
Screen.Recording.2024-03-06.at.00.21.45.mov