Issue playing videos on iOS and macOS Safari

Hi all,

We’re seeing an issue on 3.6.0.beta3-latest where iPhone and Safari on macOS users get an endless spinner when attempting to play an uploaded .mp4 (H.264) video. These same videos played fine until recently (I’m not sure what the last version of Discourse was when they worked).

It looks like Safari makes a GET to fetch the first bytes (Range: bytes=0-1) of the video (eg /uploads/default/original/1X/44395933ccadf546b1b1ce65b742e24f900b33fa.mp4), which returns 200 but fails for reasons that aren’t shown in the JS console or network inspector (just highlighted in red, no error messages). If the same URL is pasted into the browser directly, they are able to successfully download the full video and play it.

Firefox and Chrome on macOS have no issues playing the videos. Browsers on Android also don’t appear to be having issues.

The videos are small (in the 10MB range). We aren’t using S3 for uploads.

Can anyone else corroborate, or confirm that they’re not having issues with iPhones/Safari playing videos? And is there any other diagnostic I can do that might cast light on the issue?

1 Like

I’m facing a similar issue with my forum, but testing the same files here appears to work fine. Only iOS/Safari users are affected. Some videos in the WEBM container work, but most mp4, mov, etc, do not.

2 Likes

Hi, I’ve been seeing issues recently and commented into a thread started by @tsk which has been de-listed. I was working under the assumption that the problem was with mp4/av1 encoded videos as webm/vp9 videos were playing on our forum, but it’s starting to look like the issue is more than that for Safari users.

Just for giggles I have verified I am on latest, though I saw nothing in the commits that would give indication it affects apple users.

My config is using local storage for uploads. Most threads are locked behind trust level, but we are testing in a public category here:

Can you share a link to said video, or upload it here?

1 Like

@Les79 I have uploaded this video in both forums as a test.

Can you confirm the pixelspace safari playback thread video does not work for you, but the one here does?

1 Like

Yes, the video posted here works in Safari on both my iPhone 13 and MacBook Pro M3. It doesn’t work in the PixelSpace forum.

2 Likes

This video is H.264 in MP4, it should play on all browsers that run Discourse. Given it runs here and not on your instance, I suspect there is something misconfigured there.

Do you run any extra reverse proxy on top of Discourse? I’ve seen some headers on this instance that don’t exist on standard installs, so I’m curious on what was done there.

1 Like

I’m seeing the same.

I do use this container as a reverse proxy

I had considered this may be partly responsible but the config has not changed and this is a new issue to 3.6.0-beta2 from what I could tell. I started receiving complaints from apple users after rebuilding. Similar to @mandyk I dont remember what we were on previously.

Is there a particular setting in discourse that I should evaluate?

1 Like

It’s not Discourse, but the proxy.

Unfortunately we can’t realistically cover all infinite possibilities of configurations when people add stuff on top of Discourse, which is why we ship with a know good configuration on the standard install that comes with a reverse proxy configured for Discourse.

It may be missing a single nginx config stanza, but you will need to research into that.

1 Like

Also confirming that the video posted in this thread plays fine in Safari.

Not sure if this is relevant, but one difference I can spot is that the video in this thread is being served from S3. When Safari makes the first range request, S3 is replying with HTTP 206, which seems correct. Both the Pixelspace instance and my instance are not using S3, and it seems that Discourse is replying with HTTP 200 (which doesn’t seem correct, because the request includes a Range: bytes=0-1 header).

I uploaded the same video to my test instance at

https://discourse-on-a-pi5.falco.dev/t/test-safari-bug/25?u=falco

Confirmed that the video on discourse-on-a-pi5.falco.dev is not working for me on Safari. Again, I can see that the video request is returning 200 instead of 206.

Edit: Additionally, it seems like the response is attempting to return the whole video even though Range: bytes=0-1 was specified. I suspect range requests are being ignored, and Safari seems to be sensitive to this.

Further edit: This probably means efficient seeking on larger videos is broken for browsers other than Safari too, as they need to download the entire video before being able to seek.

3 Likes

Playback not working in safari for me

And it works on Test Safari Bug - Discourse right?

Yes, that one works! And I see HTTP 206 there.

1 Like

Looks like a regression in our default nginx configuration then, thanks for the report @mandyk

1 Like

Thanks to @Adubs for posting a counter-repro to compare with! And to the Discourse team for a brilliant tool.

5 Likes

So just for additional giggles, I copied my app.yml to app2.yml, changed the url and a couple directories, and we now have testfor.pixelspace.xyz running stable branch.

https://testfor.pixelspace.xyz/t/safari-playback-test/8

My users confirm it works here through the same proxy.

edit: I see now there is confirmation of the issue. My apologies for not thinking to try this sooner. Thank you for your insight @mandyk

I would have not figured this out by myself.

3 Likes