App icon indicating copy to clipboard operation
App copied to clipboard

[$250] Track - Loading spinner appears on a Track your expenses video modal

Open lanitochka17 opened this issue 1 year ago • 8 comments

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Version Number: 9.0.29-0 Reproducible in staging?: Y Reproducible in production?: Y If this was caught during regression testing, add the test name, ID and link from TestRail: N/A Email or phone of affected tester (no customers): [email protected] Issue reported by: Applause - Internal Team

Action Performed:

  1. Go to FAB> Track
  2. Verify that video modal appears

Expected Result:

There should be no loading spinner over the video modal

Actual Result:

Loading spinner appears on a Track your expenses video modal and remains to the end of the video

Workaround:

Unknown

Platforms:

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

  • [x] Android: Native
  • [ ] Android: mWeb Chrome
  • [ ] iOS: Native
  • [ ] iOS: mWeb Safari
  • [ ] MacOS: Chrome / Safari
  • [ ] MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

https://github.com/user-attachments/assets/2c306d07-ddb3-47d3-91d9-a6e53ed40a90

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021832057700758749301
  • Upwork Job ID: 1832057700758749301
  • Last Price Increase: 2024-09-06
Issue OwnerCurrent Issue Owner: @hungvu193

lanitochka17 avatar Sep 05 '24 14:09 lanitochka17

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

melvin-bot[bot] avatar Sep 05 '24 14:09 melvin-bot[bot]

@bfitzexpensify FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors

lanitochka17 avatar Sep 05 '24 14:09 lanitochka17

Edited by proposal-police: This proposal was edited at {current_timestamp}.

Proposal

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

Loading spinner appears on a Track your expenses video modal

What is the root cause of that problem?

The loading spinner is controlled by setIsLoading and relies on status.durationMillis here. And sometime the expo-av video player might not be providing valid values for durationMillis

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

Update the setIsLoading logic to handle both durationMillis and positionMillis, only set isLoading to true if status.durationMillis is NaN and status.positionMillis is 0

setIsLoading(Number.isNaN(status.durationMillis) && status.positionMillis === 0);

This ensures that the spinner disappears when the video starts playing

What alternative solutions did you explore? (Optional)

nyomanjyotisa avatar Sep 05 '24 14:09 nyomanjyotisa

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

melvin-bot[bot] avatar Sep 06 '24 14:09 melvin-bot[bot]

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

melvin-bot[bot] avatar Sep 06 '24 14:09 melvin-bot[bot]

I am heading out of office until September 21st, so assigning a buddy to watch over this in my absence.

Current status: waiting on proposals

bfitzexpensify avatar Sep 06 '24 14:09 bfitzexpensify

Current assignee @bfitzexpensify is eligible for the Bug assigner, not assigning anyone new.

melvin-bot[bot] avatar Sep 06 '24 14:09 melvin-bot[bot]

@nyomanjyotisa Are you sure? If you used nullish coalescing operator, it's only return the right-hand side operand if the left-hand side is null or undefined.

setIsLoading(Number.isNaN(status.durationMillis) ?? status.positionMillis > 0);

is the same with

setIsLoading(Number.isNaN(status.durationMillis) )

Beacuse Number.isNaN return bool.

hungvu193 avatar Sep 07 '24 14:09 hungvu193

This looks super weird to me. @bfitzexpensify Can we ask someone from an expert agency to look into this to avoid a workaround?

shubham1206agra avatar Sep 08 '24 06:09 shubham1206agra

I'll take closer look today.

hungvu193 avatar Sep 10 '24 04:09 hungvu193

Can't reproduce on latest main:

https://github.com/user-attachments/assets/db4b8f44-0b06-46e9-b449-7cf045c3e04c

hungvu193 avatar Sep 12 '24 02:09 hungvu193

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

melvin-bot[bot] avatar Sep 13 '24 16:09 melvin-bot[bot]

Can you retest this one @lanitochka17 ?

hungvu193 avatar Sep 16 '24 04:09 hungvu193

@hungvu193 @bfitzexpensify this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

melvin-bot[bot] avatar Sep 19 '24 18:09 melvin-bot[bot]

@hungvu193, @bfitzexpensify Whoops! This issue is 2 days overdue. Let's get this updated quick!

melvin-bot[bot] avatar Sep 19 '24 18:09 melvin-bot[bot]

little bump @bfitzexpensify

hungvu193 avatar Sep 20 '24 01:09 hungvu193

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

melvin-bot[bot] avatar Sep 20 '24 16:09 melvin-bot[bot]

@hungvu193, @bfitzexpensify Whoops! This issue is 2 days overdue. Let's get this updated quick!

melvin-bot[bot] avatar Sep 23 '24 18:09 melvin-bot[bot]

little bump @bfitzexpensify

Same

hungvu193 avatar Sep 24 '24 02:09 hungvu193

Apologies, just coming back from ooo

Have asked QA to retest

bfitzexpensify avatar Sep 24 '24 08:09 bfitzexpensify

Able to reproduce

https://github.com/user-attachments/assets/c79a4d33-5533-46c7-9501-bc6b861ac074

m-natarajan avatar Sep 24 '24 11:09 m-natarajan

Interesting, I'll have another look today

hungvu193 avatar Sep 24 '24 11:09 hungvu193

Proposal

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

Track - Loading spinner appears on a Track your expenses video modal and remains to the end of the video

What is root cause of that problem?

We show the loading indicator if it is buffering in addition to checking isLoading and isOffline.

https://github.com/Expensify/App/blob/dc74ee347bf3dc134b5488d2a28911cd031104b3/src/components/VideoPlayer/BaseVideoPlayer.tsx#L444

But in android, the isBuffering variable is true instead of becoming false even after the video has already started playing which is why the loading indicator doesn’t disappear. This was reported as issue here

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

One of the comment suggests that the video will play even if the buffering hasn’t finished completely and as such we should use both isBuffering and isPlaying variable while determining when to show the loading indicator.

The official documentation also advises to do the same.

Playback may not start immediately after calling this function for reasons such as buffering. Make sure to update your UI based on the isPlaying and isBuffering properties of the AVPlaybackStatus

Therefore, in order to solve this issue, we should update the following line

https://github.com/Expensify/App/blob/dc74ee347bf3dc134b5488d2a28911cd031104b3/src/components/VideoPlayer/BaseVideoPlayer.tsx#L444

By adding !isPlaying as shown below.

- {((isLoading && !isOffline) || isBuffering) && <FullScreenLoadingIndicator style={[styles.opacity1, styles.bgTransparent]} />}
+ {((isLoading && !isOffline) || (isBuffering && !isPlaying)) && <FullScreenLoadingIndicator style={[styles.opacity1, styles.bgTransparent]} />}

What alternative solutions did you explore? (Optional)

None.


Result

https://github.com/user-attachments/assets/5a80012a-4846-46b9-8a69-8457a21da57a

HezekielT avatar Sep 25 '24 00:09 HezekielT

@HezekielT Your proposal will be dismissed because you did not follow the proposal template.

github-actions[bot] avatar Sep 25 '24 00:09 github-actions[bot]

I managed to reproduce on my Pixel 4a. I'll review proposals today

hungvu193 avatar Sep 25 '24 01:09 hungvu193

Thanks for the proposals, everyone. It looks like on Android, sometimes the isBuffering is set incorrectly

Android buffering

https://github.com/user-attachments/assets/0789dff3-4a63-4d7c-8851-c0088f4b4e60

I'd go with @HezekielT 's proposal that it has the correct RCA and I agree we shouldn't show the loading indicator while it's playing.

🎀 👀 🎀 C+ reviewed.

hungvu193 avatar Sep 25 '24 07:09 hungvu193

Triggered auto assignment to @MarioExpensify, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

melvin-bot[bot] avatar Sep 25 '24 07:09 melvin-bot[bot]

@HezekielT proposal LGTM! Thanks @HezekielT and @hungvu193

MarioExpensify avatar Sep 25 '24 13:09 MarioExpensify

📣 @HezekielT 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!

Offer link Upwork job Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻 Keep in mind: Code of Conduct | Contributing 📖

melvin-bot[bot] avatar Sep 25 '24 13:09 melvin-bot[bot]