@content-blocks/js 0.7.6 → 0.7.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -19,7 +19,7 @@ var patchBrowser = () => {
19
19
 
20
20
  patchBrowser().then(async (options) => {
21
21
  await appGlobals.globalScripts();
22
- return index.bootstrapLazy([["content-split-block.cjs",[[4,"content-split-block",{"reverse":[1544],"columns":[1],"classes":[1537],"classString":[32]}]]],["content-carousel.cjs",[[4,"content-carousel",{"initMethod":[1,"init-method"],"swiperOptions":[1,"swiper-options"]},[[0,"setSwiperOptions","setSwiperOptionsCallback"]]]]],["content-navigation-block.cjs",[[4,"content-navigation-block",{"hamburger":[1537],"classes":[1537],"classString":[32],"ariaExpanded":[32],"bodyToggle":[32],"skipAccessibilityMessage":[32],"hasOpenButton":[32],"hasCloseButton":[32],"openButton":[32],"closeButton":[32],"contentSlot":[32]}]]],["content-tabs.cjs",[[4,"content-tabs",{"classes":[1537],"classString":[32]}]]],["content-accordion_11.cjs",[[4,"content-accordion",{"open":[1],"animationStart":[1,"animation-start"],"animationEnd":[1,"animation-end"],"triggerClass":[1,"trigger-class"],"animationTime":[2,"animation-time"],"revealElement":[32],"isOpen":[32],"randomID":[32],"classString":[32]}],[4,"content-button",{"href":[1537],"target":[1],"classes":[1],"clickableBlock":[4,"clickable-block"],"expanded":[1537],"controls":[1],"linkLabel":[1,"link-label"],"linkClass":[1537,"link-class"],"classString":[32],"hasContentToActivate":[32]}],[4,"content-hero-block",{"contentPosition":[1537,"content-position"],"classes":[1],"hasBackground":[32],"classString":[32],"revealHiddenContent":[32]},[[8,"open","contentBlockActivationHandler"]]],[4,"content-image",{"classes":[1537],"lazyLoad":[4,"lazy-load"],"src":[1025],"alt":[1537],"width":[1025],"height":[1025],"aspectRatio":[1025,"aspect-ratio"],"type":[1],"videoType":[1,"video-type"],"showContent":[1537,"show-content"],"activeSrc":[32],"lazyLoadIsComplete":[32],"showVideoAsGif":[32],"activeLazyLoadClass":[32],"classString":[32],"inlineStyle":[32],"hasMediaContent":[32],"pictureImageSrc":[32]},null,{"lazyLoadIsComplete":["watchLazyLoadIsComplete"]}],[4,"content-line",{"tag":[1],"textAlign":[1,"text-align"],"classes":[8],"maxWidth":[1,"max-width"],"classString":[32],"inlineStyle":[32]}],[4,"content-overlay",{"target":[1],"open":[1537],"fullScreen":[1537,"full-screen"],"classes":[1],"horizontal":[1537],"vertical":[1537],"closeTitle":[1,"close-title"],"position":[1537],"isActive":[32],"activeClass":[32],"classString":[32],"contentSlot":[32],"isFullScreen":[32],"hasCloseButton":[32],"originalMarkup":[32],"openOverlay":[64],"closeOverlay":[64]},[[0,"toggle","onContentBlockToggle"],[0,"open","onContentBlockActivated"],[0,"close","onContentBlockDeactivated"]]],[4,"content-spacer",{"classes":[1],"maxWidth":[1,"max-width"],"fullHeight":[1537,"full-height"],"textAlign":[1537,"text-align"],"horizontal":[1537],"vertical":[1537],"topOffset":[1,"top-offset"],"bottomOffset":[1,"bottom-offset"],"leftOffset":[1,"left-offset"],"rightOffset":[1,"right-offset"],"classString":[32],"inlineStyle":[32]}],[4,"content-text-block",{"classes":[1],"minHeight":[1537,"min-height"],"vertical":[1537],"fullHeight":[1537,"full-height"],"textAlign":[1537,"text-align"],"classString":[32],"inlineStyle":[32]}],[4,"content-tout-block",{"hover":[1537],"classes":[1],"classString":[32],"hasHoverContent":[32]}],[4,"content-video",{"method":[1],"autoplay":[4],"src":[1],"width":[2],"height":[2],"type":[1],"playButtonAriaLabel":[1,"play-button-aria-label"],"classes":[1537],"controls":[4],"preload":[1],"fitContainer":[1537,"fit-container"],"classString":[32],"isLoaded":[32],"hasPoster":[32],"isPlayed":[32]}],[4,"content-grid-formatter",{"classes":[1],"type":[1537],"flexGrow":[1537,"flex-grow"],"flexShrink":[1537,"flex-shrink"],"vertical":[1537],"horizontal":[1537],"columns":[1537],"columnGap":[1537,"column-gap"],"rowGap":[1537,"row-gap"],"classString":[32],"activeClassString":[32],"inlineStyle":[32]}]]]], options);
22
+ return index.bootstrapLazy([["content-split-block.cjs",[[4,"content-split-block",{"reverse":[1544],"columns":[1],"classes":[1537],"classString":[32]}]]],["content-carousel.cjs",[[4,"content-carousel",{"initMethod":[1,"init-method"],"swiperOptions":[1,"swiper-options"]},[[0,"setSwiperOptions","setSwiperOptionsCallback"]]]]],["content-navigation-block.cjs",[[4,"content-navigation-block",{"hamburger":[1537],"classes":[1537],"classString":[32],"ariaExpanded":[32],"bodyToggle":[32],"skipAccessibilityMessage":[32],"hasOpenButton":[32],"hasCloseButton":[32],"openButton":[32],"closeButton":[32],"contentSlot":[32]}]]],["content-tabs.cjs",[[4,"content-tabs",{"classes":[1537],"classString":[32]}]]],["content-accordion_11.cjs",[[4,"content-accordion",{"open":[1],"animationStart":[1,"animation-start"],"animationEnd":[1,"animation-end"],"triggerClass":[1,"trigger-class"],"animationTime":[2,"animation-time"],"revealElement":[32],"isOpen":[32],"randomID":[32],"classString":[32]}],[4,"content-button",{"href":[1537],"target":[1],"classes":[1],"clickableBlock":[4,"clickable-block"],"expanded":[1537],"controls":[1],"linkLabel":[1,"link-label"],"linkClass":[1537,"link-class"],"classString":[32],"hasContentToActivate":[32]}],[4,"content-hero-block",{"contentPosition":[1537,"content-position"],"classes":[1],"hasBackground":[32],"classString":[32],"revealHiddenContent":[32]},[[8,"open","contentBlockActivationHandler"]]],[4,"content-image",{"classes":[1537],"lazyLoad":[4,"lazy-load"],"src":[1025],"alt":[1537],"width":[1025],"height":[1025],"aspectRatio":[1025,"aspect-ratio"],"type":[1],"videoType":[1,"video-type"],"showContent":[1537,"show-content"],"activeSrc":[32],"lazyLoadIsComplete":[32],"showVideoAsGif":[32],"activeLazyLoadClass":[32],"classString":[32],"inlineStyle":[32],"hasMediaContent":[32],"pictureImageSrc":[32]},null,{"lazyLoadIsComplete":["watchLazyLoadIsComplete"]}],[4,"content-line",{"tag":[1],"textAlign":[1,"text-align"],"classes":[8],"maxWidth":[1,"max-width"],"classString":[32],"inlineStyle":[32]}],[4,"content-overlay",{"target":[1],"open":[1537],"fullScreen":[1537,"full-screen"],"classes":[1],"horizontal":[1537],"vertical":[1537],"closeTitle":[1,"close-title"],"position":[1537],"isActive":[32],"activeClass":[32],"classString":[32],"contentSlot":[32],"isFullScreen":[32],"hasCloseButton":[32],"originalMarkup":[32],"openOverlay":[64],"closeOverlay":[64]},[[0,"toggle","onContentBlockToggle"],[0,"open","onContentBlockActivated"],[0,"close","onContentBlockDeactivated"]]],[4,"content-spacer",{"classes":[1],"maxWidth":[1,"max-width"],"fullHeight":[1537,"full-height"],"textAlign":[1537,"text-align"],"horizontal":[1537],"vertical":[1537],"topOffset":[1,"top-offset"],"bottomOffset":[1,"bottom-offset"],"leftOffset":[1,"left-offset"],"rightOffset":[1,"right-offset"],"classString":[32],"inlineStyle":[32]}],[4,"content-text-block",{"classes":[1],"minHeight":[1537,"min-height"],"vertical":[1537],"fullHeight":[1537,"full-height"],"textAlign":[1537,"text-align"],"classString":[32],"inlineStyle":[32]}],[4,"content-tout-block",{"hover":[1537],"classes":[1],"classString":[32],"hasHoverContent":[32]}],[4,"content-video",{"method":[1],"autoplay":[4],"autoplayMute":[4,"autoplay-mute"],"src":[1],"width":[2],"height":[2],"type":[1],"playButtonAriaLabel":[1,"play-button-aria-label"],"classes":[1537],"controls":[4],"preload":[1],"fitContainer":[1537,"fit-container"],"classString":[32],"isLoaded":[32],"hasPoster":[32],"isPlayed":[32]}],[4,"content-grid-formatter",{"classes":[1],"type":[1537],"flexGrow":[1537,"flex-grow"],"flexShrink":[1537,"flex-shrink"],"vertical":[1537],"horizontal":[1537],"columns":[1537],"columnGap":[1537,"column-gap"],"rowGap":[1537,"row-gap"],"classString":[32],"activeClassString":[32],"inlineStyle":[32]}]]]], options);
23
23
  });
24
24
 
25
25
  exports.setNonce = index.setNonce;
@@ -8,7 +8,7 @@ const appGlobals = require('./app-globals-3a1e7e63.js');
8
8
  const defineCustomElements = async (win, options) => {
9
9
  if (typeof window === 'undefined') return undefined;
10
10
  await appGlobals.globalScripts();
11
- return index.bootstrapLazy([["content-split-block.cjs",[[4,"content-split-block",{"reverse":[1544],"columns":[1],"classes":[1537],"classString":[32]}]]],["content-carousel.cjs",[[4,"content-carousel",{"initMethod":[1,"init-method"],"swiperOptions":[1,"swiper-options"]},[[0,"setSwiperOptions","setSwiperOptionsCallback"]]]]],["content-navigation-block.cjs",[[4,"content-navigation-block",{"hamburger":[1537],"classes":[1537],"classString":[32],"ariaExpanded":[32],"bodyToggle":[32],"skipAccessibilityMessage":[32],"hasOpenButton":[32],"hasCloseButton":[32],"openButton":[32],"closeButton":[32],"contentSlot":[32]}]]],["content-tabs.cjs",[[4,"content-tabs",{"classes":[1537],"classString":[32]}]]],["content-accordion_11.cjs",[[4,"content-accordion",{"open":[1],"animationStart":[1,"animation-start"],"animationEnd":[1,"animation-end"],"triggerClass":[1,"trigger-class"],"animationTime":[2,"animation-time"],"revealElement":[32],"isOpen":[32],"randomID":[32],"classString":[32]}],[4,"content-button",{"href":[1537],"target":[1],"classes":[1],"clickableBlock":[4,"clickable-block"],"expanded":[1537],"controls":[1],"linkLabel":[1,"link-label"],"linkClass":[1537,"link-class"],"classString":[32],"hasContentToActivate":[32]}],[4,"content-hero-block",{"contentPosition":[1537,"content-position"],"classes":[1],"hasBackground":[32],"classString":[32],"revealHiddenContent":[32]},[[8,"open","contentBlockActivationHandler"]]],[4,"content-image",{"classes":[1537],"lazyLoad":[4,"lazy-load"],"src":[1025],"alt":[1537],"width":[1025],"height":[1025],"aspectRatio":[1025,"aspect-ratio"],"type":[1],"videoType":[1,"video-type"],"showContent":[1537,"show-content"],"activeSrc":[32],"lazyLoadIsComplete":[32],"showVideoAsGif":[32],"activeLazyLoadClass":[32],"classString":[32],"inlineStyle":[32],"hasMediaContent":[32],"pictureImageSrc":[32]},null,{"lazyLoadIsComplete":["watchLazyLoadIsComplete"]}],[4,"content-line",{"tag":[1],"textAlign":[1,"text-align"],"classes":[8],"maxWidth":[1,"max-width"],"classString":[32],"inlineStyle":[32]}],[4,"content-overlay",{"target":[1],"open":[1537],"fullScreen":[1537,"full-screen"],"classes":[1],"horizontal":[1537],"vertical":[1537],"closeTitle":[1,"close-title"],"position":[1537],"isActive":[32],"activeClass":[32],"classString":[32],"contentSlot":[32],"isFullScreen":[32],"hasCloseButton":[32],"originalMarkup":[32],"openOverlay":[64],"closeOverlay":[64]},[[0,"toggle","onContentBlockToggle"],[0,"open","onContentBlockActivated"],[0,"close","onContentBlockDeactivated"]]],[4,"content-spacer",{"classes":[1],"maxWidth":[1,"max-width"],"fullHeight":[1537,"full-height"],"textAlign":[1537,"text-align"],"horizontal":[1537],"vertical":[1537],"topOffset":[1,"top-offset"],"bottomOffset":[1,"bottom-offset"],"leftOffset":[1,"left-offset"],"rightOffset":[1,"right-offset"],"classString":[32],"inlineStyle":[32]}],[4,"content-text-block",{"classes":[1],"minHeight":[1537,"min-height"],"vertical":[1537],"fullHeight":[1537,"full-height"],"textAlign":[1537,"text-align"],"classString":[32],"inlineStyle":[32]}],[4,"content-tout-block",{"hover":[1537],"classes":[1],"classString":[32],"hasHoverContent":[32]}],[4,"content-video",{"method":[1],"autoplay":[4],"src":[1],"width":[2],"height":[2],"type":[1],"playButtonAriaLabel":[1,"play-button-aria-label"],"classes":[1537],"controls":[4],"preload":[1],"fitContainer":[1537,"fit-container"],"classString":[32],"isLoaded":[32],"hasPoster":[32],"isPlayed":[32]}],[4,"content-grid-formatter",{"classes":[1],"type":[1537],"flexGrow":[1537,"flex-grow"],"flexShrink":[1537,"flex-shrink"],"vertical":[1537],"horizontal":[1537],"columns":[1537],"columnGap":[1537,"column-gap"],"rowGap":[1537,"row-gap"],"classString":[32],"activeClassString":[32],"inlineStyle":[32]}]]]], options);
11
+ return index.bootstrapLazy([["content-split-block.cjs",[[4,"content-split-block",{"reverse":[1544],"columns":[1],"classes":[1537],"classString":[32]}]]],["content-carousel.cjs",[[4,"content-carousel",{"initMethod":[1,"init-method"],"swiperOptions":[1,"swiper-options"]},[[0,"setSwiperOptions","setSwiperOptionsCallback"]]]]],["content-navigation-block.cjs",[[4,"content-navigation-block",{"hamburger":[1537],"classes":[1537],"classString":[32],"ariaExpanded":[32],"bodyToggle":[32],"skipAccessibilityMessage":[32],"hasOpenButton":[32],"hasCloseButton":[32],"openButton":[32],"closeButton":[32],"contentSlot":[32]}]]],["content-tabs.cjs",[[4,"content-tabs",{"classes":[1537],"classString":[32]}]]],["content-accordion_11.cjs",[[4,"content-accordion",{"open":[1],"animationStart":[1,"animation-start"],"animationEnd":[1,"animation-end"],"triggerClass":[1,"trigger-class"],"animationTime":[2,"animation-time"],"revealElement":[32],"isOpen":[32],"randomID":[32],"classString":[32]}],[4,"content-button",{"href":[1537],"target":[1],"classes":[1],"clickableBlock":[4,"clickable-block"],"expanded":[1537],"controls":[1],"linkLabel":[1,"link-label"],"linkClass":[1537,"link-class"],"classString":[32],"hasContentToActivate":[32]}],[4,"content-hero-block",{"contentPosition":[1537,"content-position"],"classes":[1],"hasBackground":[32],"classString":[32],"revealHiddenContent":[32]},[[8,"open","contentBlockActivationHandler"]]],[4,"content-image",{"classes":[1537],"lazyLoad":[4,"lazy-load"],"src":[1025],"alt":[1537],"width":[1025],"height":[1025],"aspectRatio":[1025,"aspect-ratio"],"type":[1],"videoType":[1,"video-type"],"showContent":[1537,"show-content"],"activeSrc":[32],"lazyLoadIsComplete":[32],"showVideoAsGif":[32],"activeLazyLoadClass":[32],"classString":[32],"inlineStyle":[32],"hasMediaContent":[32],"pictureImageSrc":[32]},null,{"lazyLoadIsComplete":["watchLazyLoadIsComplete"]}],[4,"content-line",{"tag":[1],"textAlign":[1,"text-align"],"classes":[8],"maxWidth":[1,"max-width"],"classString":[32],"inlineStyle":[32]}],[4,"content-overlay",{"target":[1],"open":[1537],"fullScreen":[1537,"full-screen"],"classes":[1],"horizontal":[1537],"vertical":[1537],"closeTitle":[1,"close-title"],"position":[1537],"isActive":[32],"activeClass":[32],"classString":[32],"contentSlot":[32],"isFullScreen":[32],"hasCloseButton":[32],"originalMarkup":[32],"openOverlay":[64],"closeOverlay":[64]},[[0,"toggle","onContentBlockToggle"],[0,"open","onContentBlockActivated"],[0,"close","onContentBlockDeactivated"]]],[4,"content-spacer",{"classes":[1],"maxWidth":[1,"max-width"],"fullHeight":[1537,"full-height"],"textAlign":[1537,"text-align"],"horizontal":[1537],"vertical":[1537],"topOffset":[1,"top-offset"],"bottomOffset":[1,"bottom-offset"],"leftOffset":[1,"left-offset"],"rightOffset":[1,"right-offset"],"classString":[32],"inlineStyle":[32]}],[4,"content-text-block",{"classes":[1],"minHeight":[1537,"min-height"],"vertical":[1537],"fullHeight":[1537,"full-height"],"textAlign":[1537,"text-align"],"classString":[32],"inlineStyle":[32]}],[4,"content-tout-block",{"hover":[1537],"classes":[1],"classString":[32],"hasHoverContent":[32]}],[4,"content-video",{"method":[1],"autoplay":[4],"autoplayMute":[4,"autoplay-mute"],"src":[1],"width":[2],"height":[2],"type":[1],"playButtonAriaLabel":[1,"play-button-aria-label"],"classes":[1537],"controls":[4],"preload":[1],"fitContainer":[1537,"fit-container"],"classString":[32],"isLoaded":[32],"hasPoster":[32],"isPlayed":[32]}],[4,"content-grid-formatter",{"classes":[1],"type":[1537],"flexGrow":[1537,"flex-grow"],"flexShrink":[1537,"flex-shrink"],"vertical":[1537],"horizontal":[1537],"columns":[1537],"columnGap":[1537,"column-gap"],"rowGap":[1537,"row-gap"],"classString":[32],"activeClassString":[32],"inlineStyle":[32]}]]]], options);
12
12
  };
13
13
 
14
14
  exports.setNonce = index.setNonce;
@@ -15,6 +15,7 @@ export class ContentVideo {
15
15
  constructor() {
16
16
  this.method = 'youtube';
17
17
  this.autoplay = false;
18
+ this.autoplayMute = true;
18
19
  this.src = '';
19
20
  this.width = 16;
20
21
  this.height = 9;
@@ -34,7 +35,7 @@ export class ContentVideo {
34
35
  videoConfig = {
35
36
  fill: getCurrentValue(this.fitContainer) === 'true',
36
37
  fluid: getCurrentValue(this.fitContainer) === 'false',
37
- autoplay: this.autoplay === true ? 'muted' : false,
38
+ autoplay: this.autoplay === true ? (this.autoplayMute ? 'muted' : 'any') : false,
38
39
  techOrder: ['youtube'],
39
40
  src: this.src,
40
41
  sources: [
@@ -49,6 +50,7 @@ export class ContentVideo {
49
50
  modestbranding: 1,
50
51
  },
51
52
  };
53
+ console.log(videoConfig);
52
54
  return videoConfig;
53
55
  }
54
56
  initVideo() {
@@ -64,28 +66,28 @@ export class ContentVideo {
64
66
  rootMargin: '0px',
65
67
  threshold: 0.1,
66
68
  };
67
- let observer = new IntersectionObserver(entries => {
68
- entries.forEach(async (entry) => {
69
- if (entry.isIntersecting) {
70
- this.player = videojs(this.videoElement, this.computedVideoConfig());
71
- // if (!videojs) {
72
- // videojs = await import('video.js');
73
- // await import('videojs-youtube/dist/Youtube.js');
74
- // }
75
- // this.hasPoster = !!this.hostElement.querySelector('[slot="poster"]');
76
- // if (this.videoElement && !this.player) {
77
- // this.player = videojs.default(this.videoElement, this.computedVideoConfig(), function onPlayerReady() {
78
- // self.initVideo();
79
- // if (self.hasPoster || self.autoplay) {
80
- // self.isPlayed = true;
81
- // setTimeout(() => this.play(), 1);
82
- // }
83
- // });
84
- // }
85
- }
86
- });
87
- }, options);
88
- observer.observe(this.hostElement);
69
+ this.player = videojs(this.videoElement);
70
+ // let observer = new IntersectionObserver(entries => {
71
+ // entries.forEach(async entry => {
72
+ // if (entry.isIntersecting && !this.player) {
73
+ // // if (!videojs) {
74
+ // // videojs = await import('video.js');
75
+ // // await import('videojs-youtube/dist/Youtube.js');
76
+ // // }
77
+ // // this.hasPoster = !!this.hostElement.querySelector('[slot="poster"]');
78
+ // // if (this.videoElement && !this.player) {
79
+ // // this.player = videojs.default(this.videoElement, this.computedVideoConfig(), function onPlayerReady() {
80
+ // // self.initVideo();
81
+ // // if (self.hasPoster || self.autoplay) {
82
+ // // self.isPlayed = true;
83
+ // // setTimeout(() => this.play(), 1);
84
+ // // }
85
+ // // });
86
+ // // }
87
+ // }
88
+ // });
89
+ // }, options);
90
+ // observer.observe(this.hostElement);
89
91
  }
90
92
  onClickHandler(event) {
91
93
  event.preventDefault();
@@ -101,7 +103,7 @@ export class ContentVideo {
101
103
  }
102
104
  render() {
103
105
  let showPlayButton = !this.autoplay && ((this.hasPoster && !this.isPlayed) || !this.isPlayed);
104
- return (h(Host, { key: '4eb01a365b5cdada1754ef431c6b4d4d779d729a', class: this.classString }, this.hasPoster && !this.isLoaded && (h("div", { key: '13ece2dd90e34b04fc678bc0ac6b385016ac04d6', class: "content-video__poster" }, h("slot", { key: '47896b0f5bf7b0f3ab33131e726cb20567c121e3', name: "poster" }))), showPlayButton && (h("button", { key: 'ca90cce7e4ea02d2201cbaecf610fb87c11f86e1', class: "content-video__play", "aria-label": this.playButtonAriaLabel, onClick: ev => this.onClickHandler(ev) }, h("slot", { key: '162cf783704d2bedcb03bb91612e7d86c6f0734b', name: "playButton" }))), h("div", { key: '636a0de9100a7eafb18800bf1134fef64343053b', class: "content-video__content" }, (!this.hasPoster || this.isLoaded) && (h("video", { key: '4a3abea2af63a8e93bfc1eebca323a05a3fbcbd3', ref: element => (this.videoElement = element), class: "video-js vjs-content-block-theme", controls: this.controls, preload: this.preload, width: this.width, height: this.height, crossorigin: "anonymous", "data-setup": JSON.stringify(this.computedVideoConfig()) }, h("slot", { key: '6706262c92d34dbea5400699cc61f5614253300a', name: "no-js-message" }), h("slot", { key: '544c42a1feb5add98941e77a362df1e97cd3fac8', name: "content" }), h("slot", { key: '23c39f3b87587328097e8046f888e5e8469eeef3' }))))));
106
+ return (h(Host, { key: '22cffbd35601f37a8bbc0bd5eda02cda1688c9cc', class: this.classString }, this.hasPoster && !this.isLoaded && (h("div", { key: 'a49d09ea914a8fc90c3dc10bab99e74347fad000', class: "content-video__poster" }, h("slot", { key: 'b1e57d86ac11a2b03950bb9ffb40f73253ac838b', name: "poster" }))), showPlayButton && (h("button", { key: '14dbd5508a52b66ab112d2dbfd1d5de3b96310eb', class: "content-video__play", "aria-label": this.playButtonAriaLabel, onClick: ev => this.onClickHandler(ev) }, h("slot", { key: '6ae7662d21f79e8c05c5d17652cbb7e37533cb5d', name: "playButton" }))), h("div", { key: '3b942a282fd0df1e22569fd02ff248065f67374e', class: "content-video__content" }, (!this.hasPoster || this.isLoaded) && (h("video", { key: 'd93067f22489d1afcfefcd7413e81c41e37d0c37', ref: element => (this.videoElement = element), class: "video-js vjs-content-block-theme", controls: this.controls, preload: this.preload, width: this.width, height: this.height, crossorigin: "anonymous", "data-setup": JSON.stringify(this.computedVideoConfig()) }, h("slot", { key: '8c784e20d7938cfb890d2877d208bbf514735ad4', name: "no-js-message" }), h("slot", { key: '351930777416a2bbc6a89a37e2e69f241a3dbf9c', name: "content" }), h("slot", { key: 'f06a2361d6397fca3d15a9a5533e94667a73bf15' }))))));
105
107
  }
106
108
  static get is() { return "content-video"; }
107
109
  static get originalStyleUrls() {
@@ -170,6 +172,27 @@ export class ContentVideo {
170
172
  "reflect": false,
171
173
  "defaultValue": "false"
172
174
  },
175
+ "autoplayMute": {
176
+ "type": "boolean",
177
+ "mutable": false,
178
+ "complexType": {
179
+ "original": "boolean",
180
+ "resolved": "boolean",
181
+ "references": {}
182
+ },
183
+ "required": false,
184
+ "optional": false,
185
+ "docs": {
186
+ "tags": [{
187
+ "name": "type",
188
+ "text": "Boolean"
189
+ }],
190
+ "text": "Sets whether or not an autoplaying video should be muted. \nBy default autoplay videos will be muted."
191
+ },
192
+ "attribute": "autoplay-mute",
193
+ "reflect": false,
194
+ "defaultValue": "true"
195
+ },
173
196
  "src": {
174
197
  "type": "string",
175
198
  "mutable": false,
@@ -1 +1 @@
1
- {"version":3,"file":"content-video.js","sourceRoot":"","sources":["../../../../src/elements/content-video/content-video.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,OAAO,EAAsB,IAAI,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAClF,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, Host } from '@stencil/core';\nimport { Element, HTMLStencilElement, Prop, State } from '@stencil/core/internal';\nimport { WindowResizeService } from '../../services/window-resize-service';\nimport { ResponsiveString } from '../../typings';\nimport { getCurrentValue, getHydratedClassString } from '../../utils/utils';\nimport videojs from 'video.js';\nimport * as videojsyoutube from 'videojs-youtube';\n\nexport type SupportedVideoMethods = 'html5' | 'youtube';\n\nvideojsyoutube; // needed to ensure videojs youtube loads\n\n/**\n * @slot poster - Poster shown before video is played.\n * @slot playButton - Play button contents.\n * @slot no-js-message - Contents of no JS message.\n * @slot content - Adjacent to no-js message for video. Usually not needed.\n * @slot - Default slot, same as content slot.\n */\n@Component({\n tag: 'content-video',\n styleUrls: ['content-video.scss'],\n shadow: false,\n})\nexport class ContentVideo {\n public player: any;\n videoElement!: HTMLVideoElement;\n @Element() hostElement: HTMLStencilElement;\n /**\n * @type Select\n * @options youtube\n * @options html5\n */\n @Prop() method: SupportedVideoMethods = 'youtube';\n /**\n * If you're using this inside a content-overlay for example, you may want the video to play immediately on launch.\n * @type Boolean\n */\n @Prop() autoplay: boolean = false;\n /**\n * Supports YouTube and self hosted URLs.\n * @type String\n */\n @Prop() src: string = '';\n /**\n * @type Number\n */\n @Prop() width: number = 16;\n /**\n * @type Number\n */\n @Prop() height: number = 9;\n /**\n * @type String\n */\n @Prop() type: string = 'video/mp4';\n /**\n * @type String\n */\n @Prop() playButtonAriaLabel: string = 'Play';\n /**\n * @type String\n * @responsive\n */\n @Prop({\n mutable: true,\n reflect: true,\n })\n classes: ResponsiveString;\n @State() classString;\n /**\n * @type Boolean\n */\n @Prop() controls: boolean = true;\n /**\n * @type String\n */\n @Prop() preload: string = 'metadata';\n /**\n * Fit the container this video is placed in. When the video is used in an overlay or another place where the video will takeover the existing height, it is recommended to enable this option.\n * @responsive\n * @type String\n */\n @Prop({\n mutable: true,\n reflect: true,\n })\n fitContainer: ResponsiveString = 'false';\n @State() isLoaded: boolean = false;\n @State() hasPoster: boolean = false;\n @State() isPlayed: boolean = false;\n\n computedVideoConfig() {\n let videoConfig = {};\n videoConfig = {\n fill: getCurrentValue(this.fitContainer) === 'true',\n fluid: getCurrentValue(this.fitContainer) === 'false',\n autoplay: this.autoplay === true ? 'muted' : false,\n techOrder: ['youtube'],\n src: this.src,\n sources: [\n {\n type: 'video/youtube',\n src: this.src,\n },\n ],\n youtube: {\n showinfo: 0,\n rel: 0,\n modestbranding: 1,\n },\n };\n return videoConfig;\n }\n\n initVideo() {\n this.isLoaded = true;\n }\n\n componentWillLoad() {\n WindowResizeService.registerProp(this.classes).subscribe(newValue => (this.classString = newValue));\n }\n\n componentDidLoad() {\n let self = this;\n let options = {\n root: null,\n rootMargin: '0px',\n threshold: 0.1,\n };\n\n let observer = new IntersectionObserver(entries => {\n entries.forEach(async entry => {\n if (entry.isIntersecting) {\n this.player = videojs(this.videoElement, this.computedVideoConfig());\n // if (!videojs) {\n // videojs = await import('video.js');\n // await import('videojs-youtube/dist/Youtube.js');\n // }\n // this.hasPoster = !!this.hostElement.querySelector('[slot=\"poster\"]');\n // if (this.videoElement && !this.player) {\n // this.player = videojs.default(this.videoElement, this.computedVideoConfig(), function onPlayerReady() {\n // self.initVideo();\n // if (self.hasPoster || self.autoplay) {\n // self.isPlayed = true;\n // setTimeout(() => this.play(), 1);\n // }\n // });\n // }\n }\n });\n }, options);\n observer.observe(this.hostElement);\n }\n\n onClickHandler(event: MouseEvent) {\n event.preventDefault();\n if (!this.isLoaded) {\n return false;\n }\n this.initVideo();\n this.isPlayed = true;\n this.player.play();\n if (this.method === 'html5') {\n this.videoElement.play();\n }\n }\n\n render() {\n let showPlayButton = !this.autoplay && ((this.hasPoster && !this.isPlayed) || !this.isPlayed);\n return (\n <Host class={this.classString}>\n {this.hasPoster && !this.isLoaded && (\n <div class=\"content-video__poster\">\n <slot name=\"poster\"></slot>\n </div>\n )}\n {showPlayButton && (\n <button class=\"content-video__play\" aria-label={this.playButtonAriaLabel} onClick={ev => this.onClickHandler(ev)}>\n <slot name=\"playButton\"></slot>\n </button>\n )}\n <div class=\"content-video__content\">\n {(!this.hasPoster || this.isLoaded) && (\n <video\n ref={element => (this.videoElement = element)}\n class=\"video-js vjs-content-block-theme\"\n controls={this.controls}\n preload={this.preload}\n width={this.width}\n height={this.height}\n crossorigin=\"anonymous\"\n data-setup={JSON.stringify(this.computedVideoConfig())}\n >\n <slot name=\"no-js-message\"></slot>\n <slot name=\"content\"></slot>\n <slot></slot>\n </video>\n )}\n </div>\n </Host>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"content-video.js","sourceRoot":"","sources":["../../../../src/elements/content-video/content-video.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,OAAO,EAAsB,IAAI,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAClF,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAE3E,OAAO,EAAE,eAAe,EAA0B,MAAM,mBAAmB,CAAC;AAC5E,OAAO,OAAO,MAAM,UAAU,CAAC;AAC/B,OAAO,KAAK,cAAc,MAAM,iBAAiB,CAAC;AAIlD,cAAc,CAAC,CAAC,yCAAyC;AAEzD;;;;;;GAMG;AAMH,MAAM,OAAO,YAAY;;sBASiB,SAAS;wBAKrB,KAAK;4BAMD,IAAI;mBAKd,EAAE;qBAIA,EAAE;sBAID,CAAC;oBAIH,WAAW;mCAII,MAAM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O,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,EAAE,CAAC;gBAC9G,6DAAM,IAAI,EAAC,YAAY,GAAQ,CACxB,CACV;YACD,4DAAK,KAAK,EAAC,wBAAwB,IAChC,CAAC,CAAC,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CACrC,8DACE,GAAG,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,EAC7C,KAAK,EAAC,kCAAkC,EACxC,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,MAAM,EAAE,IAAI,CAAC,MAAM,EACnB,WAAW,EAAC,WAAW,gBACX,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,mBAAmB,EAAE,CAAC;gBAEtD,6DAAM,IAAI,EAAC,eAAe,GAAQ;gBAClC,6DAAM,IAAI,EAAC,SAAS,GAAQ;gBAC5B,8DAAa,CACP,CACT,CACG,CACD,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, Host } from '@stencil/core';\nimport { Element, HTMLStencilElement, Prop, State } from '@stencil/core/internal';\nimport { WindowResizeService } from '../../services/window-resize-service';\nimport { ResponsiveString } from '../../typings';\nimport { getCurrentValue, getHydratedClassString } from '../../utils/utils';\nimport videojs from 'video.js';\nimport * as videojsyoutube from 'videojs-youtube';\n\nexport type SupportedVideoMethods = 'html5' | 'youtube';\n\nvideojsyoutube; // needed to ensure videojs youtube loads\n\n/**\n * @slot poster - Poster shown before video is played.\n * @slot playButton - Play button contents.\n * @slot no-js-message - Contents of no JS message.\n * @slot content - Adjacent to no-js message for video. Usually not needed.\n * @slot - Default slot, same as content slot.\n */\n@Component({\n tag: 'content-video',\n styleUrls: ['content-video.scss'],\n shadow: false,\n})\nexport class ContentVideo {\n public player: any;\n videoElement!: HTMLVideoElement;\n @Element() hostElement: HTMLStencilElement;\n /**\n * @type Select\n * @options youtube\n * @options html5\n */\n @Prop() method: SupportedVideoMethods = 'youtube';\n /**\n * If you're using this inside a content-overlay for example, you may want the video to play immediately on launch.\n * @type Boolean\n */\n @Prop() autoplay: boolean = false;\n /**\n * Sets whether or not an autoplaying video should be muted. \n * By default autoplay videos will be muted.\n * @type Boolean\n */\n @Prop() autoplayMute: boolean = true;\n /**\n * Supports YouTube and self hosted URLs.\n * @type String\n */\n @Prop() src: string = '';\n /**\n * @type Number\n */\n @Prop() width: number = 16;\n /**\n * @type Number\n */\n @Prop() height: number = 9;\n /**\n * @type String\n */\n @Prop() type: string = 'video/mp4';\n /**\n * @type String\n */\n @Prop() playButtonAriaLabel: string = 'Play';\n /**\n * @type String\n * @responsive\n */\n @Prop({\n mutable: true,\n reflect: true,\n })\n classes: ResponsiveString;\n @State() classString;\n /**\n * @type Boolean\n */\n @Prop() controls: boolean = true;\n /**\n * @type String\n */\n @Prop() preload: string = 'metadata';\n /**\n * Fit the container this video is placed in. When the video is used in an overlay or another place where the video will takeover the existing height, it is recommended to enable this option.\n * @responsive\n * @type String\n */\n @Prop({\n mutable: true,\n reflect: true,\n })\n fitContainer: ResponsiveString = 'false';\n @State() isLoaded: boolean = false;\n @State() hasPoster: boolean = false;\n @State() isPlayed: boolean = false;\n\n computedVideoConfig() {\n let videoConfig = {};\n videoConfig = {\n fill: getCurrentValue(this.fitContainer) === 'true',\n fluid: getCurrentValue(this.fitContainer) === 'false',\n autoplay: this.autoplay === true ? (this.autoplayMute ? 'muted' : 'any') : false,\n techOrder: ['youtube'],\n src: this.src,\n sources: [\n {\n type: 'video/youtube',\n src: this.src,\n },\n ],\n youtube: {\n showinfo: 0,\n rel: 0,\n modestbranding: 1,\n },\n };\n console.log(videoConfig);\n return videoConfig;\n }\n\n initVideo() {\n this.isLoaded = true;\n }\n\n componentWillLoad() {\n WindowResizeService.registerProp(this.classes).subscribe(newValue => (this.classString = newValue));\n }\n\n componentDidLoad() {\n let self = this;\n let options = {\n root: null,\n rootMargin: '0px',\n threshold: 0.1,\n };\n \n this.player = videojs(this.videoElement);\n // let observer = new IntersectionObserver(entries => {\n // entries.forEach(async entry => {\n // if (entry.isIntersecting && !this.player) {\n // // if (!videojs) {\n // // videojs = await import('video.js');\n // // await import('videojs-youtube/dist/Youtube.js');\n // // }\n // // this.hasPoster = !!this.hostElement.querySelector('[slot=\"poster\"]');\n // // if (this.videoElement && !this.player) {\n // // this.player = videojs.default(this.videoElement, this.computedVideoConfig(), function onPlayerReady() {\n // // self.initVideo();\n // // if (self.hasPoster || self.autoplay) {\n // // self.isPlayed = true;\n // // setTimeout(() => this.play(), 1);\n // // }\n // // });\n // // }\n // }\n // });\n // }, options);\n // observer.observe(this.hostElement);\n }\n\n onClickHandler(event: MouseEvent) {\n event.preventDefault();\n if (!this.isLoaded) {\n return false;\n }\n this.initVideo();\n this.isPlayed = true;\n this.player.play();\n if (this.method === 'html5') {\n this.videoElement.play();\n }\n }\n\n render() {\n let showPlayButton = !this.autoplay && ((this.hasPoster && !this.isPlayed) || !this.isPlayed);\n return (\n <Host class={this.classString}>\n {this.hasPoster && !this.isLoaded && (\n <div class=\"content-video__poster\">\n <slot name=\"poster\"></slot>\n </div>\n )}\n {showPlayButton && (\n <button class=\"content-video__play\" aria-label={this.playButtonAriaLabel} onClick={ev => this.onClickHandler(ev)}>\n <slot name=\"playButton\"></slot>\n </button>\n )}\n <div class=\"content-video__content\">\n {(!this.hasPoster || this.isLoaded) && (\n <video\n ref={element => (this.videoElement = element)}\n class=\"video-js vjs-content-block-theme\"\n controls={this.controls}\n preload={this.preload}\n width={this.width}\n height={this.height}\n crossorigin=\"anonymous\"\n data-setup={JSON.stringify(this.computedVideoConfig())}\n >\n <slot name=\"no-js-message\"></slot>\n <slot name=\"content\"></slot>\n <slot></slot>\n </video>\n )}\n </div>\n </Host>\n );\n }\n}\n"]}
@@ -69287,6 +69287,7 @@ const ContentVideo$1 = /*@__PURE__*/ proxyCustomElement(class ContentVideo exten
69287
69287
  this.__registerHost();
69288
69288
  this.method = 'youtube';
69289
69289
  this.autoplay = false;
69290
+ this.autoplayMute = true;
69290
69291
  this.src = '';
69291
69292
  this.width = 16;
69292
69293
  this.height = 9;
@@ -69306,7 +69307,7 @@ const ContentVideo$1 = /*@__PURE__*/ proxyCustomElement(class ContentVideo exten
69306
69307
  videoConfig = {
69307
69308
  fill: getCurrentValue(this.fitContainer) === 'true',
69308
69309
  fluid: getCurrentValue(this.fitContainer) === 'false',
69309
- autoplay: this.autoplay === true ? 'muted' : false,
69310
+ autoplay: this.autoplay === true ? (this.autoplayMute ? 'muted' : 'any') : false,
69310
69311
  techOrder: ['youtube'],
69311
69312
  src: this.src,
69312
69313
  sources: [
@@ -69321,6 +69322,7 @@ const ContentVideo$1 = /*@__PURE__*/ proxyCustomElement(class ContentVideo exten
69321
69322
  modestbranding: 1,
69322
69323
  },
69323
69324
  };
69325
+ console.log(videoConfig);
69324
69326
  return videoConfig;
69325
69327
  }
69326
69328
  initVideo() {
@@ -69330,33 +69332,28 @@ const ContentVideo$1 = /*@__PURE__*/ proxyCustomElement(class ContentVideo exten
69330
69332
  WindowResizeService.registerProp(this.classes).subscribe(newValue => (this.classString = newValue));
69331
69333
  }
69332
69334
  componentDidLoad() {
69333
- let options = {
69334
- root: null,
69335
- rootMargin: '0px',
69336
- threshold: 0.1,
69337
- };
69338
- let observer = new IntersectionObserver(entries => {
69339
- entries.forEach(async (entry) => {
69340
- if (entry.isIntersecting) {
69341
- this.player = videojs(this.videoElement, this.computedVideoConfig());
69342
- // if (!videojs) {
69343
- // videojs = await import('video.js');
69344
- // await import('videojs-youtube/dist/Youtube.js');
69345
- // }
69346
- // this.hasPoster = !!this.hostElement.querySelector('[slot="poster"]');
69347
- // if (this.videoElement && !this.player) {
69348
- // this.player = videojs.default(this.videoElement, this.computedVideoConfig(), function onPlayerReady() {
69349
- // self.initVideo();
69350
- // if (self.hasPoster || self.autoplay) {
69351
- // self.isPlayed = true;
69352
- // setTimeout(() => this.play(), 1);
69353
- // }
69354
- // });
69355
- // }
69356
- }
69357
- });
69358
- }, options);
69359
- observer.observe(this.hostElement);
69335
+ this.player = videojs(this.videoElement);
69336
+ // let observer = new IntersectionObserver(entries => {
69337
+ // entries.forEach(async entry => {
69338
+ // if (entry.isIntersecting && !this.player) {
69339
+ // // if (!videojs) {
69340
+ // // videojs = await import('video.js');
69341
+ // // await import('videojs-youtube/dist/Youtube.js');
69342
+ // // }
69343
+ // // this.hasPoster = !!this.hostElement.querySelector('[slot="poster"]');
69344
+ // // if (this.videoElement && !this.player) {
69345
+ // // this.player = videojs.default(this.videoElement, this.computedVideoConfig(), function onPlayerReady() {
69346
+ // // self.initVideo();
69347
+ // // if (self.hasPoster || self.autoplay) {
69348
+ // // self.isPlayed = true;
69349
+ // // setTimeout(() => this.play(), 1);
69350
+ // // }
69351
+ // // });
69352
+ // // }
69353
+ // }
69354
+ // });
69355
+ // }, options);
69356
+ // observer.observe(this.hostElement);
69360
69357
  }
69361
69358
  onClickHandler(event) {
69362
69359
  event.preventDefault();
@@ -69372,13 +69369,14 @@ const ContentVideo$1 = /*@__PURE__*/ proxyCustomElement(class ContentVideo exten
69372
69369
  }
69373
69370
  render() {
69374
69371
  let showPlayButton = !this.autoplay && ((this.hasPoster && !this.isPlayed) || !this.isPlayed);
69375
- return (h(Host, { key: '4eb01a365b5cdada1754ef431c6b4d4d779d729a', class: this.classString }, this.hasPoster && !this.isLoaded && (h("div", { key: '13ece2dd90e34b04fc678bc0ac6b385016ac04d6', class: "content-video__poster" }, h("slot", { key: '47896b0f5bf7b0f3ab33131e726cb20567c121e3', name: "poster" }))), showPlayButton && (h("button", { key: 'ca90cce7e4ea02d2201cbaecf610fb87c11f86e1', class: "content-video__play", "aria-label": this.playButtonAriaLabel, onClick: ev => this.onClickHandler(ev) }, h("slot", { key: '162cf783704d2bedcb03bb91612e7d86c6f0734b', name: "playButton" }))), h("div", { key: '636a0de9100a7eafb18800bf1134fef64343053b', class: "content-video__content" }, (!this.hasPoster || this.isLoaded) && (h("video", { key: '4a3abea2af63a8e93bfc1eebca323a05a3fbcbd3', ref: element => (this.videoElement = element), class: "video-js vjs-content-block-theme", controls: this.controls, preload: this.preload, width: this.width, height: this.height, crossorigin: "anonymous", "data-setup": JSON.stringify(this.computedVideoConfig()) }, h("slot", { key: '6706262c92d34dbea5400699cc61f5614253300a', name: "no-js-message" }), h("slot", { key: '544c42a1feb5add98941e77a362df1e97cd3fac8', name: "content" }), h("slot", { key: '23c39f3b87587328097e8046f888e5e8469eeef3' }))))));
69372
+ return (h(Host, { key: '22cffbd35601f37a8bbc0bd5eda02cda1688c9cc', class: this.classString }, this.hasPoster && !this.isLoaded && (h("div", { key: 'a49d09ea914a8fc90c3dc10bab99e74347fad000', class: "content-video__poster" }, h("slot", { key: 'b1e57d86ac11a2b03950bb9ffb40f73253ac838b', name: "poster" }))), showPlayButton && (h("button", { key: '14dbd5508a52b66ab112d2dbfd1d5de3b96310eb', class: "content-video__play", "aria-label": this.playButtonAriaLabel, onClick: ev => this.onClickHandler(ev) }, h("slot", { key: '6ae7662d21f79e8c05c5d17652cbb7e37533cb5d', name: "playButton" }))), h("div", { key: '3b942a282fd0df1e22569fd02ff248065f67374e', class: "content-video__content" }, (!this.hasPoster || this.isLoaded) && (h("video", { key: 'd93067f22489d1afcfefcd7413e81c41e37d0c37', ref: element => (this.videoElement = element), class: "video-js vjs-content-block-theme", controls: this.controls, preload: this.preload, width: this.width, height: this.height, crossorigin: "anonymous", "data-setup": JSON.stringify(this.computedVideoConfig()) }, h("slot", { key: '8c784e20d7938cfb890d2877d208bbf514735ad4', name: "no-js-message" }), h("slot", { key: '351930777416a2bbc6a89a37e2e69f241a3dbf9c', name: "content" }), h("slot", { key: 'f06a2361d6397fca3d15a9a5533e94667a73bf15' }))))));
69376
69373
  }
69377
69374
  get hostElement() { return this; }
69378
69375
  static get style() { return ContentVideoStyle0; }
69379
69376
  }, [4, "content-video", {
69380
69377
  "method": [1],
69381
69378
  "autoplay": [4],
69379
+ "autoplayMute": [4, "autoplay-mute"],
69382
69380
  "src": [1],
69383
69381
  "width": [2],
69384
69382
  "height": [2],