Embed reddit video into a html page
Is there any possible way to embed a Reddit video post into a HTML page with the API? I'm working on a website that gets random posts from a users inputed subreddit, but currently it can only display image posts, I was wondering if I could be able to embed video posts aswell
Posted Sep 2, 2023, 6:04 PM UTC
16
Can you share what you tried? For example, what is a sample video URL you tried to display, how are you trying to embed it, and what is the current result?
I tried getting the permalink and setting the <video> tags source as the permalink but it didnt show any video, just the controls
The permalink to the whole post? Yeah, that won't do it - the whole post isn't a video.
Looks like the media_embed content is what you're looking for?
Ohhh kk
I tried this:
Still giving the same result
You have to actually take a look at the json data you are receiving. Some posts use iframes, others are gifs, and others are videos with a separate audio track.
There are a lot of inconsistencies and things won't "just" work.