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.

VideoAds.jsx 887B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import React from 'react';
  2. import { Box } from '@mui/material';
  3. import PropTypes from 'prop-types';
  4. const VideoAds = ({ video_url, height, width }) => {
  5. return (
  6. <Box
  7. sx={{
  8. position: 'relative',
  9. overflow: 'hidden',
  10. width: width || '100%',
  11. height: height || '300px',
  12. }}
  13. >
  14. <video
  15. src={video_url}
  16. autoPlay
  17. loop
  18. muted
  19. playsInline
  20. style={{
  21. position: 'absolute',
  22. top: 0,
  23. left: 0,
  24. width: '100%',
  25. height: 'auto',
  26. }}
  27. />
  28. </Box>
  29. );
  30. };
  31. VideoAds.propTypes = {
  32. video_url: PropTypes.string.isRequired,
  33. height: PropTypes.string,
  34. width: PropTypes.string,
  35. };
  36. VideoAds.defaultProps = {
  37. video_url: 'https://www.w3schools.com/html/mov_bbb.mp4',
  38. height: '300px',
  39. width: '100%',
  40. };
  41. export default VideoAds;