You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
728 B
36 lines
728 B
2 years ago
|
import PropTypes from "prop-types"
|
||
|
import { getStrapiMedia } from "utils/media"
|
||
|
import { mediaPropTypes } from "utils/types"
|
||
|
|
||
|
const Video = ({
|
||
|
media,
|
||
|
poster,
|
||
|
className,
|
||
|
controls = true,
|
||
|
autoPlay = false,
|
||
|
}) => {
|
||
|
const fullVideoUrl = getStrapiMedia(media.url)
|
||
|
const fullPosterUrl = getStrapiMedia(poster?.url)
|
||
|
|
||
|
return (
|
||
|
<video
|
||
|
className={className}
|
||
|
poster={fullPosterUrl}
|
||
|
controls={controls}
|
||
|
autoPlay={autoPlay}
|
||
|
>
|
||
|
<source src={fullVideoUrl} type={media.mime} />
|
||
|
</video>
|
||
|
)
|
||
|
}
|
||
|
|
||
|
Video.propTypes = {
|
||
|
media: mediaPropTypes.isRequired,
|
||
|
poster: mediaPropTypes,
|
||
|
className: PropTypes.string,
|
||
|
controls: PropTypes.bool,
|
||
|
autoPlay: PropTypes.bool,
|
||
|
}
|
||
|
|
||
|
export default Video
|