-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
refactor(server): file streaming logic #3103
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
The issue I encountered was on Android. The media player required those range properties to be sent. Can you please test on Android and make sure that you can stream the video? |
I don't have an Android phone, but |
I can help testing later |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great, thank you for doing this.
Alright, so Nest-style exceptions don't work at all when |
Maybe we can use a custom interceptor for these types of requests. Basically automatically catch the exception and map it to a valid response. I think you can get the http adapter and call reply potentially.. In the controller we probably want to add a .catch(...) and handle the error either via |
Adding an interceptor or filter seems to just get ignored. But adding
|
This is probably good enough for now. We're basically copying the implementation of the default/base nestjs exception filter here though. Might be worth seeing if it is possible to call the filter.catch method manually though, instead of duplicating the logic. |
Exception handling works now without hacks. I.. I just needed to return... |
Hello, can you help me resolve the merge conflict? |
43f6927
to
3da2d9e
Compare
Rebased |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested on Android device Samsung S9 and the video file cannot be played. The same issue I encountered originally thus the implementation of setResRange
Edit: Actually S8 is ancient and something cause the video cannot be played on main
as well. @jrasm91 Do you mind help me test this on your Android phone?
I can test it tomorrow. |
81678da
to
fc97089
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested on the web and mobile. Everything looks good.
- Videos return 206 with byte ranges
- Seeking/buffer works
- Images and thumbnails are served
- premature close warning is gone from the logs
Description
Switching to Express's
sendFile
results in much cleaner code that sets appropriate headers automatically. The current approach is too manual and error-prone in the absence of a good reason for it.Fixes #3097
How Has This Been Tested?
Tested on web by scrolling, hovering on videos and live photos and switching between content in the expanded view. All content is shown as expected and no errors are reported in the server.