mattermost / mattermost-mobile

Next generation iOS and Android apps for Mattermost in React Native
https://about.mattermost.com/
Apache License 2.0
2.2k stars 1.33k forks source link

There seems to be an issue with video(.mp4) on Ios17. #7631

Closed bitdessert closed 9 months ago

bitdessert commented 11 months ago

Per Mattermost guidelines, GitHub issues are for bug reports: http://www.mattermost.org/filing-issues/.

For troubleshooting see: http://forum.mattermost.org/. For feature proposals see: http://www.mattermost.org/feature-requests/

If you've found a bug--something appears unintentional--please follow these steps:

  1. Confirm you’re filing a new issue. Search existing tickets in Jira to ensure that the ticket does not already exist.
  2. Confirm your issue does not involve security. Otherwise, please see our Responsible Disclosure Policy.
  3. File a new issue using the format below. Mattermost will confirm steps to reproduce and file in Jira, or ask for more details if there is trouble reproducing it. If there's already an existing bug in Jira, it will be linked back to the GitHub issue so you can track when it gets fixed.

Summary

Bug report in one concise sentence

Environment Information

Steps to reproduce

Attach a video. Press Play or attempt to download the video.

Expected behavior

The video should download, play, or preview.

Observed behavior (that appears unintentional)

There seems to be a problem with the features listed above for MP4.

Possible fixes

Everything works fine on ios16 devices. My device is also an XR. However, there seems to be an issue with video in iOS17. The files I've seen are mp4 files, but there may be issues with other video files.

amyblais commented 11 months ago

Opened https://mattermost.atlassian.net/browse/MM-55147.

bitdessert commented 10 months ago

@amyblais Everything seems to be fixed in 17.1. Download, play, and preview all work fine. However, for the preview, it takes 2 download attempts to see the preview, and I checked the cause and it's a permission issue. The authtoken seems to be missing in the header, are there any issues with this? The file is located at video_file.tsx and the source code is the following const videoUrl = buildFileUrl(serverUrl, data.id!);

I changed this to const publicLink = await fetchPublicLink(serverUrl, data.id!); const videoUrl = publicLink.link;

Alternatively, can you tell me how I can access the bearerToken? If I can figure that out, I think I can do something like this const {path: uri, height, width} = await createThumbnail({url: data.localPath || videoUrl, timeStamp: 2000, headers:{Authorization:'BEARER ${beareToken}'}});

However, even in this case, there is a problem. The server throws a file size error. The error message is related to the following NSLocalizedFailureReason=The server is not correctly configured., NSLocalizedDescription=Operation Stopped Do you see these errors? It could be an issue with the server configuration we're deploying, but I don't have any modifications to make, and I think it's caused by the server not supporting HTTP Range Requests.

bitdessert commented 10 months ago

@amyblais Is it possible to make the video preview visible or invisible on the channel or the direct message itself, depending on your server settings?

A thumbnail of the video looks like this

image

However, depending on your server settings, you may see a list instead of thumbnails, as shown below.

image
amyblais commented 10 months ago

I'll let @larkox take a look at these questions.

larkox commented 10 months ago

@bitdessert For technical reasons, in order to properly create the thumbnails, the video need to have a public url. That is why you are seeing those two different looks.

Regarding the issue, I am having trouble reproducing it. Maybe, as you said, the issue is regarding your server configuration? Are you able to reproduce it in our community server? (community.mattermost.com)

bitdessert commented 10 months ago

@larkox It's hard to tell which settings make such a difference. In the pure version, the default thumbnail resolves the filename, while in the customized version, only the thumbnail is visible. Can you give me a variable name or method to indicate which setting values are affected?

larkox commented 9 months ago

@bitdessert If you want to track down the code, the logic is in app/components/files/file.tsx. There it decides whether to show it as a video attachment or a file attachment depending on:

After that it calls some native functions to create the thumbnail based on the video public url.

Regarding the public links enabled variables, it just check the config for EnablePublicLink.

bitdessert commented 9 months ago

@larkox Thank you. I think this is because the pure server setup has a publicLinkEnabled value of false, and my customized server has a value of true. I think we can fix it so that the thumbnail is not visible regardless of whether it is a public link or not.