-
-
Notifications
You must be signed in to change notification settings - Fork 51
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
Dev server cannot serve video to iOS devices (server does not reply to range requests properly) #186
Comments
created an issue on hexo here too in the process of learning what's going on https://github.com/hexojs/hexo/issues/4829
@kfatehi Try adding this to your site's # _config.yml
server:
serveStatic:
acceptRanges: true hexo-server uses |
@SukkaW thank you I didn't know about hexo-server options that's nice; I tested that they make a difference by changing my port number. However, If I had to guess I would suspect some other middleware defined in hexo-server is breaking serve-static's default handling of range request/response. |
I just wrote a test (you can see it referenced in the commit above) which passes, so I don't think the error is in hexo-server anymore. Unless maybe the triviality of the path somehow avoids those middlewares (i.e. avoids autobuild paths that an actual asset would be when existing inside the blog post sources.... 🤔 ) |
@stevenjoezhang I just realized that you moved this from hexo to hexo-server, so maybe you can help with this investigation: do you think the test above is conclusive to indicate that the problem is not in hexo-server, but in hexo itself? |
I spent last few hours trying to dig deeper (within npm linked hexo, hexo-cli, hexo-server) but I got lost somewhere around Reflect.apply which I didn't even know was a feature of JS. Throwing in the towel and raising the white flag. |
Expected behavior
hexo server
should run a server that can reply to range requests appropriately. When viewing a video from a post we would expect that an iPhone user should be able to view it. Apple Safari strictly uses range requests to fetch video content so we expect Hexo's server to support this and serve the video just fine.Actual behavior
Viewing under wireshark we can see clearly that the server is not replying to range requests the way that it should. Safari browser thus does not bother to cache any of the video and fails to play it at all. Works fine in Chrome on desktop.
How to reproduce?
Apple is also very finicky about this too, I use the following technique to create an iOS-compatible mp4 file:
hexo server
hexo generate
and runnpx http-server -p 4000
(it will serve public folder automatically)Is the problem still there under "Safe mode"?
N/A
Environment & Settings
Node.js & npm version(
node -v && npm -v
)Hexo and Plugin version(
npm ls --depth 0
)Your package.json
package.json
Others
Apple's finicky nature both in encoding and in serving video files for Safari are defined here:
https://developer.apple.com/library/archive/documentation/AppleApplications/Reference/SafariWebContent/CreatingVideoforSafarioniPhone/CreatingVideoforSafarioniPhone.html#//apple_ref/doc/uid/TP40006514-SW4
The text was updated successfully, but these errors were encountered: