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

does not support pathPrefix #22

Closed
chadoh opened this issue Apr 6, 2022 · 2 comments
Closed

does not support pathPrefix #22

chadoh opened this issue Apr 6, 2022 · 2 comments

Comments

@chadoh
Copy link

chadoh commented Apr 6, 2022

When deploying sites at non-root domains, Gatsby allows adding a pathPrefix.

gatsby-transformer-video currently ignores this setting, resulting in broken videos.

@mainframeai
Copy link

mainframeai commented May 2, 2022

Is ther esomething new on this issue ? I woudl love to use this. But this is at the moment kind of a dealbreaker. :-(… Otherweise it is exactly what i need.

@chadoh
Copy link
Author

chadoh commented Jun 2, 2022

Workaround: import withPrefix from gatsby and use it in a Video component:

import React from 'react'
import { withPrefix } from 'gatsby'
import useVideoData from "../../hooks/useVideoData"

export type VideoProps = React.DetailedHTMLProps<
  React.VideoHTMLAttributes<HTMLVideoElement>,
  HTMLVideoElement
> & {
  src: string
}

const Video: React.FC<VideoProps> = ({ src, ...props }) => {
  const { videoH264 } = useVideoData(src)
  return (
    <video playsInline muted preload="auto" {...props}>
      <source src={withPrefix(videoH264.path!)} />
    </video>
  )
}

export default Video

Example taken from TENK-DAO/frontend-starter

@chadoh chadoh closed this as completed Jun 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants