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

[$250] Safari - Unable to play video attachment #52673

Open
1 of 8 tasks
m-natarajan opened this issue Nov 16, 2024 · 30 comments
Open
1 of 8 tasks

[$250] Safari - Unable to play video attachment #52673

m-natarajan opened this issue Nov 16, 2024 · 30 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors

Comments

@m-natarajan
Copy link

m-natarajan commented Nov 16, 2024

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.63-3
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?:
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: @rojiphil
Slack conversation (hyperlinked to channel name): ts_external_expensify_bugs

Action Performed:

  1. Sign in to an existing account
  2. Navigate to a chat which has a video attachment
  3. Attempt to play the video.

Expected Result:

The video should play

Actual Result:

The app crashes with Not supported error in dev environment
Unable to play the video in staging environment

Workaround:

Unknown

Platforms:

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

  • Android: Standalone
  • Android: HybridApp
  • Android: mWeb Chrome
  • iOS: Standalone
  • iOS: HybridApp
  • iOS: mWeb Safari
  • MacOS: Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence
attachment-play-crash.mp4
attachment-play-crash-staging.mp4
Recording.3170.mp4

https://github.com/user-attachments/assets/2b502b64-83c3-4b81-bc7b-b57cf6892ab0 (Video used as attachment)

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021858504313972501020
  • Upwork Job ID: 1858504313972501020
  • Last Price Increase: 2024-12-09
Issue OwnerCurrent Issue Owner: @hoangzinh
@m-natarajan m-natarajan added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Nov 16, 2024
Copy link

melvin-bot bot commented Nov 16, 2024

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

@puneetlath puneetlath added the External Added to denote the issue can be worked on by a contributor label Nov 18, 2024
@melvin-bot melvin-bot bot changed the title Safari - Unable to play video attachment [$250] Safari - Unable to play video attachment Nov 18, 2024
Copy link

melvin-bot bot commented Nov 18, 2024

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

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

melvin-bot bot commented Nov 18, 2024

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

@me-ZaidAli
Copy link

@m-natarajan can you please the video format that's causing the bug coz mp4 is working in safari

@PeterZsigmond
Copy link

PeterZsigmond commented Nov 20, 2024

Edited by proposal-police: This proposal was edited at 2024-11-24 13:13:08 UTC.

Proposal

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

A video attachment in the chat won't start playing in Safari on macOS.

What is the root cause of that problem?

Safari don't support AV1 codec playback on devices older than iPhone 15 and M3 Mac. They put a hardware decoder into the new devices in 2023, that can play these video formats, as stated here. But older devices don't support it.

There is further proof of this from caniuse.com:

The video's codec information:

2024-11-24 - 12 31 23

caniuse.com states that Safari don't fully support it:

2024-11-24 - 12 31 55

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

First we have to solve the Unhandled Promise Rejection error. That happens because setStatusAsync(status) called on a video, that failed to load. So I would add a catch to this call, that handles rejections:

playVideoPromiseRef.current = currentVideoPlayerRef.current?.setStatusAsync(newStatus);

Second, I would add a fallback image for these situations, when a video couldn't be played. There is an onError hook on the Video component, that calls a method, when a fatal error happened, and the video couldn't be played. I would add an isError state, and render a fallback image when it's set to true.
Furthermore, we can't really find out why the video can't be played, since the browser will not give us any error message, and the Content-Type doesn't contains the codec, that would give us the ability to find out manually, if the browser supports it, so I propose to use a generic fallback image, just like with AttachmentOfflineIndicator.

Generic fallback image, when the video couldn't be played: 2024-11-24 - 12 05 30 2024-11-24 - 12 11 21

What alternative solutions did you explore? (Optional)

Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

Copy link

melvin-bot bot commented Nov 20, 2024

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

@PeterZsigmond
Copy link

Contributor details
Your Expensify account email: [email protected]
Upwork Profile Link: https://www.upwork.com/freelancers/~0101f7c93c2c56ada0

Copy link

melvin-bot bot commented Nov 20, 2024

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

@melvin-bot melvin-bot bot added the Overdue label Nov 20, 2024
@PeterZsigmond
Copy link

Proposal

Updated

I added images to proof that the video won't load in Safari, but do load in Chrome.

@garatkarr
Copy link

Proposal

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

On Safari, video uploaded to chat will not play. Preview of video shows correctly. Console error shows Not supported error.

What is the root cause of that problem?

Safari does not support AV1 codec. Partial support has been added in Safari 18.1+ but requires specific hardware support such as a M3 MacBook Pro. Video playback on Chrome and Edge works because AV1 codec is supported.

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

After user clicks play, check for browser support of video codec using the onError event. If browser does not support the codec, show a message notifying user Your browser does not support playing this video. This message will replace the video preview.

What alternative solutions did you explore? (Optional)

Copy link

melvin-bot bot commented Nov 22, 2024

@puneetlath, @hoangzinh Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@hoangzinh
Copy link
Contributor

@m-natarajan can you please the video format that's causing the bug coz mp4 is working in safari

@me-ZaidAli he already attached in the issue's description.

@melvin-bot melvin-bot bot removed the Overdue label Nov 22, 2024
@hoangzinh
Copy link
Contributor

@PeterZsigmond thanks for creating a proposal. Your RCA is not clear to me. It doesn't explain why other MP4 video work but this MP4 video. Are you able to check your RCA again to make those points clearer? Thank you.

@hoangzinh
Copy link
Contributor

Safari does not support AV1 codec. Partial support has been added in Safari 18.1+ but requires specific hardware support such as a M3 MacBook Pro. Video playback on Chrome and Edge works because AV1 codec is supported.

@garatkarr thanks for creating a proposal. Could you find proof of your findings in your RCA?

After user clicks play, check for browser support of video codec using the onError event. If browser does not support the codec, show a message notifying user Your browser does not support playing this video. This message will replace the video preview.

Can you also elaborate a bit on your solution? What component of onError event did you mention to? And how do we know if "browser does not support the codec" based on error message/code? Thank you.

@melvin-bot melvin-bot bot added the Overdue label Nov 24, 2024
@PeterZsigmond
Copy link

Proposal

Updated

@garatkarr
Copy link

garatkarr commented Nov 25, 2024

@hoangzinh I uploaded an AV1 mp4 video file to a chat and witness the same issue as the bug reporter. I confirmed that video was indeed AV1 video codec. This screenshot below shows Safari does not support AV1 unless it has the hardware decoder which is found in newest Macs (M3+) and iPhone 15+.

Screenshot 2024-11-24 at 9 15 25 PM

The onError event previous referred to is on the <video> element. Unfortunately this error does not provide the specific error so we'll have to assume that every error is "browser does not support the codec". There is no way to get codec information from the browser itself. It's possible for the backend to provide this codec information. If we find the video element has an error, we can update our component to show an error state. This error state would be a message that states "Your browser does not support playing this video".

Just one idea, open to other solutions.

Copy link

melvin-bot bot commented Nov 25, 2024

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

Copy link

melvin-bot bot commented Nov 26, 2024

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

@hoangzinh
Copy link
Contributor

Thanks for updates @PeterZsigmond @garatkarr.

Although @garatkarr is the first one who pointed out a correct root cause. However, @PeterZsigmond is the 1st one who provided a correct solution to me. We can just display a general error message in those cases.

@melvin-bot melvin-bot bot removed the Overdue label Nov 27, 2024
@mvtglobally
Copy link

Issue not reproducible during KI retests. (First week)

Copy link

melvin-bot bot commented Nov 30, 2024

@puneetlath @hoangzinh 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 melvin-bot bot added the Overdue label Nov 30, 2024
Copy link

melvin-bot bot commented Dec 2, 2024

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

@hoangzinh
Copy link
Contributor

I'm still able to reproduce this issue in latest main

Screen.Recording.2024-12-03.at.06.36.11.mov

@melvin-bot melvin-bot bot removed the Overdue label Dec 2, 2024
@hoangzinh
Copy link
Contributor

@PeterZsigmond's proposal looks good to me

Link to proposal #52673 (comment)

🎀👀🎀 C+ reviewed

Copy link

melvin-bot bot commented Dec 2, 2024

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

Copy link

melvin-bot bot commented Dec 6, 2024

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

@melvin-bot melvin-bot bot added the Overdue label Dec 6, 2024
@hoangzinh
Copy link
Contributor

All your @puneetlath

@melvin-bot melvin-bot bot removed the Overdue label Dec 6, 2024
Copy link

melvin-bot bot commented Dec 9, 2024

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

@melvin-bot melvin-bot bot added the Overdue label Dec 9, 2024
Copy link

melvin-bot bot commented Dec 10, 2024

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

@hoangzinh
Copy link
Contributor

Awaiting @puneetlath for 2nd review round

@melvin-bot melvin-bot bot removed the Overdue label Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors
Projects
Development

No branches or pull requests

7 participants