-
-
Notifications
You must be signed in to change notification settings - Fork 166
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
Show more videos and consolidate media logic #791
Conversation
Thanks for the PR! I'll take a look as soon as I can |
Hi there, thanks again for the PR! So, I have a couple concerns about the approach taken in this PR.
Overall this isn't the approach I'd like to take for Voyager, but I do appreciate your efforts here! Let me know if you have any questions on the above. |
@aeharding I think your concerns about iframes are valid I even forgot to add the I think the biggest benefit of this PR is the consolidation and error handling for images and videos as well as being able to render video files from the Let me know if you have any comments on those. |
There was a previous PR playing with support for embed_video_url in the past, see here: https://github.com/aeharding/voyager/pull/571/files The problem with that at the time was a lot of embed_video_url returned by lemmy is invalid, which is why Voyager doesn't support it at the moment. I don't remember why exactly, maybe browsers had trouble handling the media files. Might be worth checking again though |
Yup that was my previous PR, this fixes that issue thanks to the fallback logic via the onError events. I just went a little overboard and tried to add embeds too 😆 . Just finished removing those so this is ready for review again. |
I see, thanks! |
This fixes issues with embed links that could've been rendered using the Video component
This fixes an issue on the LargePost where image would try to render broken thumbnails instead of the working image url.
- This fixes an issue where .gifv would not be considered a video
This checks and renders media types and in the case of videos will try the embed url as well as the normal url if one fails to play. Videos and images render with the gallery created for the LargePost component Embeds are sized in a 16/9 ratio since we can't fetch their size with this implementation. Communicates errors to parent component via callback to hide media if it fails to play.
- Remove embed url helpers - Improve error handling on PostDetail
// Transform known video platform urls into their embed counterparts | ||
export const transformUrl = (inputUrl: string): string => { | ||
// If the URL contains gifv replace it with mp4 in order for the video to play inline | ||
const url = inputUrl.replace(/\.gifv/g, ".mp4"); |
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.
Is this fixing a particular site or set of sites? I would like to avoid changing any instance of .gifv in the url, that feels quite dangerous.
I am closing this because it has become stale and there have been various fixes made to the video player over the past month or so. Thank you though for the PR! |
Given a Lemmy post containing media this will try to display the content inside the app. This uses the existing image and video renderers and adds a new
iframe
for video embeds.Features
embed_video_url
.gifv
->.mp4
, etc.).mov
urls as videosMedia
component used by bothPostDetail
andLargePost
isUrlMedia
to easily check for media instead of manually checking for image, video or embedFallbacks
url
fails to load try rendering thethumbnail
insteadembed_video_url
, try rendering theurl
url