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.
 
 
 
 

29 lines
1014 B

  1. import './video.scss';
  2. import {createElement} from "../../_global/scripts/helpers";
  3. export const createVideo = ({
  4. videoSrc = 'https://cdn.jsdelivr.net/npm/big-buck-bunny-1080p@0.0.6/video.mp4',
  5. posterSrc = './dummy/placeholder-4-3.svg',
  6. caption = 'Lorem ipsum dolor sit amet consetetur',
  7. copyright = '© Marco Mustermann für Mustervideos',
  8. }) => {
  9. const figure = createElement('figure', ['video']);
  10. const videoBox = createElement('div', ['video-box'], null, figure);
  11. const video = createElement('video', [], null, videoBox);
  12. video.src = videoSrc;
  13. video.controls = true;
  14. if (posterSrc && posterSrc.length > 0) {
  15. video.poster = posterSrc;
  16. }
  17. if (copyright && copyright.length > 0) {
  18. const copy = createElement('span', ['copyright'], copyright, videoBox);
  19. copy.setAttribute("aria-hidden", "true");
  20. createElement('span', ['sr-only'], copyright, videoBox);
  21. }
  22. if (caption && caption.length > 0) {
  23. createElement('figcaption', [], caption, figure);
  24. }
  25. return figure;
  26. }