Skip to content
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

Add autoPlay and loop to videos/GIFs #457

Merged
merged 1 commit into from
Mar 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions components/HlsPlayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,13 @@ export default function HlsPlayer(props: HlsPlayerProps) {

return (
<video
autoPlay
className={props.className}
controls={props.controls}
crossOrigin={props.crossOrigin}
data-hint={props.dataHint}
height={props.height}
loop
muted={props.muted}
playsInline={props.playsInline}
poster={props.poster}
Expand Down
8 changes: 8 additions & 0 deletions components/Media.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,13 @@ export default function Media(props: Post) {
case 'hosted:video':
return (
<HlsPlayer
autoPlay
className={classes.media}
controls
crossOrigin="anonymous"
dataHint="hosted:video"
height={props?.media?.reddit_video?.height}
loop
playsInline
poster={
props?.over_18 && blurNSFW
Expand All @@ -107,11 +109,13 @@ export default function Media(props: Post) {
case 'rich:video':
return props?.video_preview ? (
<HlsPlayer
autoPlay
className={classes.media}
controls
crossOrigin="anonymous"
dataHint="rich:video"
height={props?.video_preview?.height}
loop
muted
playsInline
poster={
Expand Down Expand Up @@ -149,10 +153,12 @@ export default function Media(props: Post) {
// Search for .gifv and use the mp4 version.
return props?.url.includes('gifv') ? (
<HlsPlayer
autoPlay
className={classes.media}
controls
crossOrigin="anonymous"
dataHint="link:gifv"
loop
muted
playsInline
poster={
Expand All @@ -168,11 +174,13 @@ export default function Media(props: Post) {
) : (
// Otherwise, just play the video.
<HlsPlayer
autoPlay
className={classes.media}
controls
crossOrigin="anonymous"
dataHint="link"
height={props?.video_preview?.height}
loop
muted
playsInline
poster={
Expand Down
6 changes: 3 additions & 3 deletions public/sitemap.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:news="http://www.google.com/schemas/sitemap-news/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:mobile="http://www.google.com/schemas/sitemap-mobile/1.0" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">
<url><loc>https://reddit-image-viewer.vercel.app</loc><changefreq>daily</changefreq><priority>0.7</priority><lastmod>2021-02-08T21:05:42.880Z</lastmod></url>
</urlset>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap><loc>https://reddit-image-viewer.vercel.app/sitemap-0.xml</loc></sitemap>
</sitemapindex>