j1-template 2024.3.22 → 2024.3.24
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.
- checksums.yaml +4 -4
- data/assets/data/{galeries.html → gallery_app.html} +106 -18
- data/assets/theme/bla +0 -0
- data/assets/theme/j1/adapter/js/amplitude.js +144 -52
- data/assets/theme/j1/adapter/js/gallery.js +14 -3
- data/assets/theme/j1/adapter/js/themes.js +41 -69
- data/assets/theme/j1/core/css/themes/unolight/bootstrap.css +48 -52
- data/assets/theme/j1/core/css/themes/unolight/bootstrap.min.css +1 -1
- data/assets/theme/j1/core/css/vendor.css +1 -1
- data/assets/theme/j1/core/css/vendor.min.css +1 -1
- data/assets/theme/j1/modules/amplitudejs/js/tech/ytp.js +466 -396
- data/assets/theme/j1/modules/lightGallery/css/lg-transitions.css +3 -126
- data/assets/theme/j1/modules/lightGallery/css/lg-transitions.min.css +3 -10
- data/assets/theme/j1/modules/lightGallery/css/lightgallery-bundle.css +70 -237
- data/assets/theme/j1/modules/lightGallery/css/lightgallery-bundle.min.css +4 -10
- data/assets/theme/j1/modules/lightGallery/css/theme/uno/uno.css +276 -0
- data/assets/theme/j1/modules/lightGallery/css/theme/uno/uno.min.css +17 -0
- data/assets/theme/j1/modules/lightGallery/js/lightgallery.js +196 -134
- data/assets/theme/j1/modules/lightGallery/js/lightgallery.min.js +3 -10
- data/assets/theme/j1/modules/lightGallery/js/plugins/lg-autoplay.js +4 -4
- data/assets/theme/j1/modules/lightGallery/js/plugins/lg-autoplay.min.js +5 -5
- data/assets/theme/j1/modules/lightGallery/js/plugins/lg-comment.js +5 -5
- data/assets/theme/j1/modules/lightGallery/js/plugins/lg-comment.min.js +6 -6
- data/assets/theme/j1/modules/lightGallery/js/plugins/lg-fullscreen.js +4 -4
- data/assets/theme/j1/modules/lightGallery/js/plugins/lg-fullscreen.min.js +5 -5
- data/assets/theme/j1/modules/lightGallery/js/plugins/lg-hash.js +4 -4
- data/assets/theme/j1/modules/lightGallery/js/plugins/lg-hash.min.js +5 -6
- data/assets/theme/j1/modules/lightGallery/js/plugins/lg-medium-zoom.js +5 -5
- data/assets/theme/j1/modules/lightGallery/js/plugins/lg-medium-zoom.min.js +6 -6
- data/assets/theme/j1/modules/lightGallery/js/plugins/lg-pager.js +4 -4
- data/assets/theme/j1/modules/lightGallery/js/plugins/lg-pager.min.js +5 -5
- data/assets/theme/j1/modules/lightGallery/js/plugins/lg-relative-caption.js +179 -0
- data/assets/theme/j1/modules/lightGallery/js/plugins/lg-relative-caption.min.js +32 -0
- data/assets/theme/j1/modules/lightGallery/js/plugins/lg-rotate.js +4 -4
- data/assets/theme/j1/modules/lightGallery/js/plugins/lg-rotate.min.js +6 -6
- data/assets/theme/j1/modules/lightGallery/js/plugins/lg-share.js +4 -4
- data/assets/theme/j1/modules/lightGallery/js/plugins/lg-share.min.js +6 -7
- data/assets/theme/j1/modules/lightGallery/js/plugins/lg-thumbnail.js +27 -20
- data/assets/theme/j1/modules/lightGallery/js/plugins/lg-thumbnail.min.js +5 -5
- data/assets/theme/j1/modules/lightGallery/js/plugins/lg-video.js +489 -411
- data/assets/theme/j1/modules/lightGallery/js/plugins/lg-video.min.js +3 -10
- data/assets/theme/j1/modules/lightGallery/js/plugins/lg-vimeo-thumbnail.js +4 -4
- data/assets/theme/j1/modules/lightGallery/js/plugins/lg-vimeo-thumbnail.min.js +5 -5
- data/assets/theme/j1/modules/lightGallery/js/plugins/lg-zoom.js +11 -5
- data/assets/theme/j1/modules/lightGallery/js/plugins/lg-zoom.min.js +5 -5
- data/assets/theme/j1/modules/rtable/css/theme/uno/rtable.css +11 -1
- data/assets/theme/j1/modules/themeSwitcher/js/switcher.js +13 -12
- data/assets/theme/j1/modules/videoPlayer/tiktoc/README.md +1 -0
- data/assets/theme/j1/modules/videojs/assets/README.md +1 -0
- data/assets/theme/j1/modules/videojs/assets/icons/speedometer-medium.svg +35 -0
- data/assets/theme/j1/modules/videojs/css/font/VideoJS.ttf +0 -0
- data/assets/theme/j1/modules/videojs/css/font/VideoJS.woff +0 -0
- data/assets/theme/j1/modules/videojs/css/themes/uno.css +189 -42
- data/assets/theme/j1/modules/videojs/css/themes/uno.min.css +1 -1
- data/assets/theme/j1/modules/videojs/css/videojs.css +674 -316
- data/assets/theme/j1/modules/videojs/css/videojs.min.css +4 -3
- data/assets/theme/j1/modules/videojs/js/video.js +15893 -12288
- data/assets/theme/j1/modules/videojs/js/video.min.js +22 -23
- data/assets/theme/j1/modules/videojs/plugins/controls/aspect-ratio-panel/!examples/index.html +26 -0
- data/assets/theme/j1/modules/videojs/plugins/controls/aspect-ratio-panel/LICENSE +19 -0
- data/assets/theme/j1/modules/videojs/plugins/controls/aspect-ratio-panel/README.md +69 -0
- data/assets/theme/j1/modules/videojs/plugins/controls/aspect-ratio-panel/css/aspect-ratio-panel.css +2 -0
- data/assets/theme/j1/modules/videojs/plugins/controls/aspect-ratio-panel/css/aspect-ratio-panel.min.css +2 -0
- data/assets/theme/j1/modules/videojs/plugins/controls/aspect-ratio-panel/js/aspect-ratio-panel.js +339 -0
- data/assets/theme/j1/modules/videojs/plugins/controls/aspect-ratio-panel/js/aspect-ratio-panel.min.js +2 -0
- data/assets/theme/j1/modules/videojs/{js/plugins/controls/autocaption → plugins/controls/autocaption/js}/autocaption.js +0 -5
- data/assets/theme/j1/modules/videojs/{js/plugins/controls/hotkeys/examples → plugins/controls/hotkeys/!examples}/example.html +1 -1
- data/assets/theme/j1/modules/videojs/plugins/controls/persist-settings/!examples/index.html +25 -0
- data/assets/theme/j1/modules/videojs/plugins/controls/persist-settings/LICENSE +19 -0
- data/assets/theme/j1/modules/videojs/plugins/controls/persist-settings/README.md +90 -0
- data/assets/theme/j1/modules/videojs/plugins/controls/persist-settings/js/videojs-persist.js +120 -0
- data/assets/theme/j1/modules/videojs/plugins/controls/persist-settings/js/videojs-persist.min.js +2 -0
- data/assets/theme/j1/modules/videojs/plugins/controls/playbackrate-adjuster/!examples/index.html +32 -0
- data/assets/theme/j1/modules/videojs/plugins/controls/playbackrate-adjuster/LICENSE +19 -0
- data/assets/theme/j1/modules/videojs/plugins/controls/playbackrate-adjuster/README.md +61 -0
- data/assets/theme/j1/modules/videojs/plugins/controls/playbackrate-adjuster/js/playbackrate-adjuster.js +94 -0
- data/assets/theme/j1/modules/videojs/plugins/controls/playbackrate-adjuster/js/playbackrate-adjuster.min.js +20 -0
- data/assets/theme/j1/modules/videojs/{js/plugins → plugins}/controls/skipbuttons/README.md +25 -11
- data/assets/theme/j1/modules/videojs/{css/plugins/controls → plugins/controls/zoom/css}/zoom.css +7 -6
- data/assets/theme/j1/modules/videojs/plugins/controls/zoom/css/zoom.min.css +22 -0
- data/assets/theme/j1/modules/videojs/{js/plugins/players/dm/examples → plugins/players/dm/!examples}/dailymotion-controls.html +4 -4
- data/assets/theme/j1/modules/videojs/{js/plugins/players/dm/examples → plugins/players/dm/!examples}/dailymotion-javascript.html +3 -3
- data/assets/theme/j1/modules/videojs/{js/plugins/players/dm/examples → plugins/players/dm/!examples}/dailymotion-playlist.html +3 -3
- data/assets/theme/j1/modules/videojs/{js/plugins/players/dm/examples → plugins/players/dm/!examples}/global-parameters.html +3 -3
- data/assets/theme/j1/modules/videojs/plugins/players/dm/!examples/simple.html +31 -0
- data/assets/theme/j1/modules/videojs/{js/plugins/players/dm/examples → plugins/players/dm/!examples}/switch.html +3 -3
- data/assets/theme/j1/modules/videojs/{js/plugins/players/dm → plugins/players/dm/js}/dailymotion.js +1 -1
- data/assets/theme/j1/modules/videojs/{js/plugins/players/vm/examples → plugins/players/vm/!examples}/index.html +3 -3
- data/assets/theme/j1/modules/videojs/{js/plugins/players/vm/examples → plugins/players/vm/!examples}/player/index.html +3 -3
- data/assets/theme/j1/modules/videojs/plugins/players/vm/!unused/vimeo.0.js +521 -0
- data/assets/theme/j1/modules/videojs/plugins/players/vm/!unused/vimeo.1.js +605 -0
- data/assets/theme/j1/modules/videojs/plugins/players/vm/!unused/vimeo.3.js +643 -0
- data/assets/theme/j1/modules/videojs/plugins/players/vm/!unused/vimeo.4.js +583 -0
- data/assets/theme/j1/modules/videojs/plugins/players/vm/!unused/vimeo.5.js +665 -0
- data/assets/theme/j1/modules/videojs/plugins/players/vm/!unused/vimeo.6.js +642 -0
- data/assets/theme/j1/modules/videojs/plugins/players/vm/!unused/vimeo.7.js +673 -0
- data/assets/theme/j1/modules/videojs/{js/plugins/players/vm/api → plugins/players/vm/api/js}/vimeo.js +1 -1
- data/assets/theme/j1/modules/videojs/{js/plugins/players/vm/api → plugins/players/vm/api/js}/vimeo.min.js +1 -1
- data/assets/theme/j1/modules/videojs/{js/plugins/players/vm → plugins/players/vm/js}/vimeo.js +4 -5
- data/assets/theme/j1/modules/videojs/plugins/players/vm/js/vimeo.min.js +28 -0
- data/assets/theme/j1/modules/videojs/plugins/players/wt/!unused/wistia.0.js +395 -0
- data/assets/theme/j1/modules/videojs/plugins/players/wt/!unused/wistia.1.js +401 -0
- data/assets/theme/j1/modules/videojs/{js/plugins/players/yt/examples → plugins/players/yt/!examples}/global-parameters.html +5 -5
- data/assets/theme/j1/modules/videojs/{js/plugins/players/yt/examples → plugins/players/yt/!examples}/simple.html +5 -5
- data/assets/theme/j1/modules/videojs/{js/plugins/players/yt/examples → plugins/players/yt/!examples}/switch.html +5 -5
- data/assets/theme/j1/modules/videojs/{js/plugins/players/yt/examples → plugins/players/yt/!examples}/youtube-controls.html +5 -5
- data/assets/theme/j1/modules/videojs/{js/plugins/players/yt/examples → plugins/players/yt/!examples}/youtube-javascript.html +5 -5
- data/assets/theme/j1/modules/videojs/{js/plugins/players/yt/examples → plugins/players/yt/!examples}/youtube-list.html +5 -5
- data/assets/theme/j1/modules/videojs/{js/plugins/players/yt/examples → plugins/players/yt/!examples}/youtube-playlist.html +5 -5
- data/lib/j1/version.rb +1 -1
- data/lib/starter_web/README.md +5 -5
- data/lib/starter_web/_config.yml +1 -1
- data/lib/starter_web/_data/blocks/banner.yml +2 -2
- data/lib/starter_web/_data/modules/amplitude_playlists.yml +16 -1
- data/lib/starter_web/_data/modules/attics.yml +11 -0
- data/lib/starter_web/_data/modules/carousel.yml +1 -1
- data/lib/starter_web/_data/modules/defaults/gallery.yml +3 -3
- data/lib/starter_web/_data/modules/defaults/masonry.yml +115 -22
- data/lib/starter_web/_data/modules/gallery.yml +225 -281
- data/lib/starter_web/_data/modules/masonry.yml +6 -0
- data/lib/starter_web/_data/modules/navigator_menu.yml +3 -3
- data/lib/starter_web/_data/resources.yml +16 -12
- data/lib/starter_web/_data/templates/feed.xml +1 -1
- data/lib/starter_web/_includes/attributes.asciidoc +7 -0
- data/lib/starter_web/_plugins/asciidoctor/videojs-block.rb +50 -30
- data/lib/starter_web/_plugins/asciidoctor/youtube-block.rb +37 -23
- data/lib/starter_web/_plugins/index/lunr.rb +1 -1
- data/lib/starter_web/assets/image/module/attic/1920x1280/alexander-redl.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/alexander-shatov.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/alexey-ruban.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/andrea-badino.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/bootstrap-modal.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/bp-miller.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/brad-neathery.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/brigitta-schneiter.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/build-with-gemini.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/clem-onojeghuo.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/crawford-jolly.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/eleni-afiontzi.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/fly-d.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/guillaume-bolduc.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/ideas-start-here-1920x1280.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/isaac-davis.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/j1-content-mockup-2.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/j1-content-mockup-3.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/j1-starter-mockup-1.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/john-schnobrich-2.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/josep-martins.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/josh-liu.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/kelly-sikkemal.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/kira-auf-der-heide.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/kristopher-roller.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/markus-spiske.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/martin-sanchez.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/material_symbols.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/matthaeus.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/melanie-deziel.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/milad-fakurian.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/mohammad-rahmani.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/nasa.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/quino-al-2.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/stories-ink-tattoo-care.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/towfiqu-barbhuiya.jpg +0 -0
- data/lib/starter_web/assets/image/page/tour/bootswatch-themes.jpg +0 -0
- data/lib/starter_web/assets/video/poster/vimeo/fall_2011.jpg +0 -0
- data/lib/starter_web/index.html +3 -2
- data/lib/starter_web/package.json +1 -1
- data/lib/starter_web/pages/public/panels/intro_panel/_includes/attributes.asciidoc +1 -1
- data/lib/starter_web/pages/public/tools/previewer/preview_bootstrap_theme.adoc +5 -5
- data/lib/starter_web/pages/public/tools/tester/app_tester_amplitudejs_yt.adoc +7 -3
- data/lib/starter_web/pages/public/tools/tester/app_tester_swiperjs.adoc +7 -3
- data/lib/starter_web/pages/public/tools/tester/videojs_macro_tester.adoc +297 -0
- data/lib/starter_web/pages/public/tour/_includes/attributes.asciidoc +1 -2
- data/lib/starter_web/pages/public/tour/_includes/documents/themes_bootstrap.asciidoc +1 -1
- data/lib/starter_web/pages/public/tour/asciidoc_extensions.adoc +7 -3
- data/lib/starter_web/pages/public/tour/bootstrap_themes.adoc +62 -7
- data/lib/starter_web/pages/public/tour/icon_fonts.adoc +4 -8
- data/lib/starter_web/pages/public/tour/modal_extentions.adoc +2 -2
- data/lib/starter_web/pages/public/tour/responsive_tables.adoc +21 -15
- data/lib/starter_web/pages/public/tour/typography.adoc +5 -5
- data/lib/starter_web/pages/public/tour/video_data.adoc +25 -5
- metadata +142 -118
- data/assets/data/swiper_app.2.html +0 -757
- data/assets/data/swiper_app.4.html +0 -769
- data/assets/theme/j1/modules/lightGallery/css/themes/uno/uno.css +0 -140
- data/assets/theme/j1/modules/lightGallery/css/themes/uno/uno.min.css +0 -19
- data/assets/theme/j1/modules/lightGallery/js/plugins/j1/j1-video.js +0 -402
- data/assets/theme/j1/modules/lightGallery/js/plugins/j1/j1-video.min.js +0 -7
- data/assets/theme/j1/modules/lightGallery/js/plugins/j1/lg-video.1.js +0 -585
- data/assets/theme/j1/modules/videojs/css/font/video-js-cdn.css +0 -2012
- data/assets/theme/j1/modules/videojs/css/plugins/controls/skipbuttons.0.css +0 -32
- data/assets/theme/j1/modules/videojs/css/plugins/controls/skipbuttons.1.css +0 -31
- data/assets/theme/j1/modules/videojs/css/plugins/controls/zoom.min.css +0 -21
- data/assets/theme/j1/modules/videojs/js/plugins/players/dm/examples/simple.html +0 -20
- data/assets/theme/j1/modules/videojs/js/plugins/players/vm/vimeo.min.js +0 -16
- data/assets/theme/j1/modules/videojs/js/plugins/players/wt/api/src/WistiaPlayer.ts +0 -1617
- data/lib/starter_web/_data/modules/gallery_app.yml +0 -1002
- data/lib/starter_web/_data/modules/gallery_playlists.yml +0 -534
- data/lib/starter_web/assets/image/module/attic/1920x1280/alina-grubnyak.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/bruno-figueiredo.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/harpal-singh.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/hayden-mills-2.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/j1-content-mockup-1.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/recha-oktaviani.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/1920x1280/tiny_desk.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/ideas-start-here-1920x1280-bw.jpg +0 -0
- data/lib/starter_web/assets/image/module/attic/ideas-start-here-1920x1280.jpg +0 -0
- data/lib/starter_web/assets/video/poster/vimeo/stay_colorful.jpg +0 -0
- /data/assets/theme/j1/modules/lightGallery/css/{themes → theme}/uno/icons/animation-w.png +0 -0
- /data/assets/theme/j1/modules/lightGallery/css/{themes → theme}/uno/icons/customize-w.png +0 -0
- /data/assets/theme/j1/modules/lightGallery/css/{themes → theme}/uno/icons/dynamic-w.png +0 -0
- /data/assets/theme/j1/modules/lightGallery/css/{themes → theme}/uno/icons/facebook-icon.svg +0 -0
- /data/assets/theme/j1/modules/lightGallery/css/{themes → theme}/uno/icons/googleplus-icon.svg +0 -0
- /data/assets/theme/j1/modules/lightGallery/css/{themes → theme}/uno/icons/html5-w.png +0 -0
- /data/assets/theme/j1/modules/lightGallery/css/{themes → theme}/uno/icons/linked-in.png +0 -0
- /data/assets/theme/j1/modules/lightGallery/css/{themes → theme}/uno/icons/module-w.png +0 -0
- /data/assets/theme/j1/modules/lightGallery/css/{themes → theme}/uno/icons/play-button-hover.svg +0 -0
- /data/assets/theme/j1/modules/lightGallery/css/{themes → theme}/uno/icons/play-button.png +0 -0
- /data/assets/theme/j1/modules/lightGallery/css/{themes → theme}/uno/icons/play-button.svg +0 -0
- /data/assets/theme/j1/modules/lightGallery/css/{themes → theme}/uno/icons/responsive-w.png +0 -0
- /data/assets/theme/j1/modules/lightGallery/css/{themes → theme}/uno/icons/thumb-w.png +0 -0
- /data/assets/theme/j1/modules/lightGallery/css/{themes → theme}/uno/icons/touch-w.png +0 -0
- /data/assets/theme/j1/modules/lightGallery/css/{themes → theme}/uno/icons/twitter-icon.svg +0 -0
- /data/assets/theme/j1/modules/lightGallery/css/{themes → theme}/uno/icons/twitter.png +0 -0
- /data/assets/theme/j1/modules/lightGallery/css/{themes → theme}/uno/icons/video1-w.png +0 -0
- /data/assets/theme/j1/modules/lightGallery/css/{themes → theme}/uno/icons/zoom-w.png +0 -0
- /data/assets/theme/j1/modules/lightGallery/css/{themes → theme}/uno/icons/zoom.png +0 -0
- /data/assets/theme/j1/modules/videoPlayer/dailymotion/js/{!readme → README.md} +0 -0
- /data/assets/theme/j1/modules/videoPlayer/tiktoc/{js/player.min.js → player.min.js} +0 -0
- /data/assets/theme/j1/modules/videoPlayer/vimeo/js/{!readme → README.md} +0 -0
- /data/assets/theme/j1/modules/videoPlayer/wistia/js/{!readme → README.md} +0 -0
- /data/assets/theme/j1/modules/videojs/{js/plugins → plugins}/controls/autocaption/LICENSE +0 -0
- /data/assets/theme/j1/modules/videojs/{js/plugins → plugins}/controls/autocaption/README.md +0 -0
- /data/assets/theme/j1/modules/videojs/{js/plugins/controls/autocaption → plugins/controls/autocaption/js}/autocaption.min.js +0 -0
- /data/assets/theme/j1/modules/videojs/{js/plugins → plugins}/controls/hotkeys/LICENSE.md +0 -0
- /data/assets/theme/j1/modules/videojs/{js/plugins → plugins}/controls/hotkeys/README.md +0 -0
- /data/assets/theme/j1/modules/videojs/{js/plugins/controls/hotkeys → plugins/controls/hotkeys/js}/hotkeys.js +0 -0
- /data/assets/theme/j1/modules/videojs/{js/plugins/controls/hotkeys → plugins/controls/hotkeys/js}/hotkeys.min.js +0 -0
- /data/assets/theme/j1/modules/videojs/{css/plugins/controls → plugins/controls/skipbuttons/css}/skipbuttons.css +0 -0
- /data/assets/theme/j1/modules/videojs/{css/plugins/controls → plugins/controls/skipbuttons/css}/skipbuttons.min.css +0 -0
- /data/assets/theme/j1/modules/videojs/{js/plugins/controls/skipbuttons → plugins/controls/skipbuttons/js}/skipbuttons.js +0 -0
- /data/assets/theme/j1/modules/videojs/{js/plugins/controls/skipbuttons → plugins/controls/skipbuttons/js}/skipbuttons.min.js +0 -0
- /data/assets/theme/j1/modules/videojs/{js/plugins/controls/zoom/examples → plugins/controls/zoom/!examples}/index.html +0 -0
- /data/assets/theme/j1/modules/videojs/{js/plugins/controls/zoom/examples → plugins/controls/zoom/!examples}/index.js +0 -0
- /data/assets/theme/j1/modules/videojs/{js/plugins/controls/zoom/examples → plugins/controls/zoom/!examples}/styles.css +0 -0
- /data/assets/theme/j1/modules/videojs/{js/plugins → plugins}/controls/zoom/LICENSE.md +0 -0
- /data/assets/theme/j1/modules/videojs/{js/plugins → plugins}/controls/zoom/README.md +0 -0
- /data/assets/theme/j1/modules/videojs/{js/plugins/controls/zoom → plugins/controls/zoom/js}/zoom.js +0 -0
- /data/assets/theme/j1/modules/videojs/{js/plugins/controls/zoom → plugins/controls/zoom/js}/zoom.min.js +0 -0
- /data/assets/theme/j1/modules/videojs/{js/plugins → plugins}/players/dm/LICENSE +0 -0
- /data/assets/theme/j1/modules/videojs/{js/plugins/players/dm/doc → plugins/players/dm}/README.md +0 -0
- /data/assets/theme/j1/modules/videojs/{js/plugins → plugins}/players/dm/api/LICENSE +0 -0
- /data/assets/theme/j1/modules/videojs/{js/plugins/players/dm/api/doc → plugins/players/dm/api}/README.md +0 -0
- /data/assets/theme/j1/modules/videojs/{js/plugins/players/dm/api → plugins/players/dm/api/js}/dailymotion.sdk.js +0 -0
- /data/assets/theme/j1/modules/videojs/{js/plugins/players/dm/api → plugins/players/dm/api/js}/dailymotion.sdk.min.js +0 -0
- /data/assets/theme/j1/modules/videojs/{js/plugins → plugins}/players/dm/icon/scalable/dailymotion.svg +0 -0
- /data/assets/theme/j1/modules/videojs/{js/plugins/players/dm → plugins/players/dm/js}/dailymotion.min.js +0 -0
- /data/assets/theme/j1/modules/videojs/{js/plugins → plugins}/players/vm/LICENSE +0 -0
- /data/assets/theme/j1/modules/videojs/{js/plugins/players/vm/doc → plugins/players/vm}/README.md +0 -0
- /data/assets/theme/j1/modules/videojs/{js/plugins/players/vm/api/doc → plugins/players/vm/api}/README.md +0 -0
- /data/assets/theme/j1/modules/videojs/{js/plugins → plugins}/players/vm/api/css/embed.player.css +0 -0
- /data/assets/theme/j1/modules/videojs/{js/plugins → plugins}/players/vm/api/css/embed.player.uno.css +0 -0
- /data/assets/theme/j1/modules/videojs/{js/plugins → plugins}/players/vm/api/css/player.css +0 -0
- /data/assets/theme/j1/modules/videojs/{js/plugins/players/wt/doc → plugins/players/wt}/README.md +0 -0
- /data/assets/theme/j1/modules/videojs/{js/plugins/players/wt/api/doc/Readme.txt → plugins/players/wt/api/README.md} +0 -0
- /data/assets/theme/j1/modules/videojs/{js/plugins/players/wt/api → plugins/players/wt/api/js}/wistia.min.js +0 -0
- /data/assets/theme/j1/modules/videojs/{js/plugins/players/wt → plugins/players/wt/js}/wistia.js +0 -0
- /data/assets/theme/j1/modules/videojs/{js/plugins/players/wt → plugins/players/wt/js}/wistia.min.js +0 -0
- /data/assets/theme/j1/modules/videojs/{js/plugins/players/yt/v3.0.0 → plugins/players/yt/!v3.0.0}/youtube.js +0 -0
- /data/assets/theme/j1/modules/videojs/{js/plugins/players/yt/v3.0.0 → plugins/players/yt/!v3.0.0}/youtube.min.js +0 -0
- /data/assets/theme/j1/modules/videojs/{js/plugins → plugins}/players/yt/LICENSE +0 -0
- /data/assets/theme/j1/modules/videojs/{js/plugins/players/yt/doc → plugins/players/yt}/README.md +0 -0
- /data/assets/theme/j1/modules/videojs/{js/plugins/players/yt/api → plugins/players/yt/api/js}/youtube.min.js +0 -0
- /data/assets/theme/j1/modules/videojs/{js/plugins/players/yt → plugins/players/yt/js}/youtube.js +0 -0
- /data/assets/theme/j1/modules/videojs/{js/plugins/players/yt → plugins/players/yt/js}/youtube.min.js +0 -0
@@ -1,1617 +0,0 @@
|
|
1
|
-
import type {
|
2
|
-
AllowedQualities,
|
3
|
-
EmbedOptions,
|
4
|
-
Logger as LoggerType,
|
5
|
-
PublicApi,
|
6
|
-
MediaData,
|
7
|
-
PublicApiOptions,
|
8
|
-
PlayerState,
|
9
|
-
Players,
|
10
|
-
WistiaLocalStorage,
|
11
|
-
} from '../types/e-v1-player-api-types.d.ts';
|
12
|
-
import type {
|
13
|
-
EmailChangeEventData,
|
14
|
-
PlayerColorChangeEventData,
|
15
|
-
} from '../types/custom-event-data.js';
|
16
|
-
import type { DynamicImportOptions } from '../utilities/dynamicImport.ts';
|
17
|
-
import { dynamicImport } from '../utilities/dynamicImport.ts';
|
18
|
-
import { elemWidth } from '../utilities/elem.js';
|
19
|
-
import { setEmbedOptionStore } from '../utilities/embedOptionStore.ts';
|
20
|
-
import { extractEmailFromParams } from '../utilities/extractEmailFromParams.ts';
|
21
|
-
import { inferPageUrl } from '../utilities/inferPageUrl.ts';
|
22
|
-
import {
|
23
|
-
getWistiaLocalStorage,
|
24
|
-
updateWistiaLocalStorage,
|
25
|
-
} from '../utilities/wistiaLocalStorage.js';
|
26
|
-
import { sanePlayerColor } from '../utilities/sane-player-color.js';
|
27
|
-
import { wlog } from '../utilities/wlog.js';
|
28
|
-
|
29
|
-
// The component will not run without these attributes.
|
30
|
-
const requiredAttributes = ['media-id'];
|
31
|
-
|
32
|
-
// Optional attributes surfaced in documentation to our customers.
|
33
|
-
const optionalPublicAttributes = [
|
34
|
-
'aspect',
|
35
|
-
'autoplay',
|
36
|
-
'big-play-button',
|
37
|
-
'disable-fullscreen-on-rotate-to-landscape',
|
38
|
-
'do-not-track',
|
39
|
-
'email',
|
40
|
-
'end-video-behavior',
|
41
|
-
'fullscreen-control',
|
42
|
-
'hide-controls-on-load',
|
43
|
-
'hide-copy-link-and-thumbnail',
|
44
|
-
'muted',
|
45
|
-
'playback-rate-control',
|
46
|
-
'play-bar-control',
|
47
|
-
'player-color',
|
48
|
-
'playlist-links',
|
49
|
-
'playlist-loop',
|
50
|
-
'play-pause-control',
|
51
|
-
'play-pause-notifier',
|
52
|
-
'poster',
|
53
|
-
'preload',
|
54
|
-
'quality-control',
|
55
|
-
'quality-max',
|
56
|
-
'quality-min',
|
57
|
-
'resumable',
|
58
|
-
'seo',
|
59
|
-
'settings-control',
|
60
|
-
'silent-autoplay',
|
61
|
-
'transparent-letterbox',
|
62
|
-
'volume',
|
63
|
-
'volume-control',
|
64
|
-
];
|
65
|
-
|
66
|
-
// Optional attributes used by Wistia developers.
|
67
|
-
const optionalPrivateAttributes = [
|
68
|
-
'big-play-button-border-radius',
|
69
|
-
'control-bar-border-radius',
|
70
|
-
'embed-host',
|
71
|
-
'page-url',
|
72
|
-
'player-border-radius',
|
73
|
-
'player-force',
|
74
|
-
'rounded-player',
|
75
|
-
'stats-url',
|
76
|
-
'use-web-component',
|
77
|
-
];
|
78
|
-
|
79
|
-
const defaultEmbedOptions = {
|
80
|
-
autoplay: false,
|
81
|
-
bigPlayButton: true,
|
82
|
-
bigPlayButtonBorderRadius: 0,
|
83
|
-
controlBarBorderRadius: 0,
|
84
|
-
fullscreenControl: true,
|
85
|
-
hideControlsOnLoad: false,
|
86
|
-
hideCopyLinkAndThumbnail: false,
|
87
|
-
playBarControl: true,
|
88
|
-
playerBorderRadius: 0,
|
89
|
-
playerColor: '636155',
|
90
|
-
playPauseControl: true,
|
91
|
-
playPauseNotifier: true,
|
92
|
-
playbackRateControl: true,
|
93
|
-
qualityControl: true,
|
94
|
-
roundedPlayer: 0,
|
95
|
-
seo: true,
|
96
|
-
settingsControl: true,
|
97
|
-
silentAutoplay: false,
|
98
|
-
state: 'beforeplay' as PlayerState,
|
99
|
-
transparentLetterbox: false,
|
100
|
-
volumeControl: true,
|
101
|
-
};
|
102
|
-
|
103
|
-
export class WistiaPlayer extends HTMLElement {
|
104
|
-
public plugin: object | null;
|
105
|
-
|
106
|
-
private readonly _logger: LoggerType;
|
107
|
-
|
108
|
-
// can be null when doing document.createElement and referencing an attribute/property
|
109
|
-
// before being injected into the dom
|
110
|
-
#_api: PublicApi | null;
|
111
|
-
|
112
|
-
#hasElementConnectedToDOM = false;
|
113
|
-
|
114
|
-
#mediaDataServerJson: MediaData = {};
|
115
|
-
|
116
|
-
/**
|
117
|
-
* Represents one embedded Wistia media player.
|
118
|
-
* @constructor
|
119
|
-
*/
|
120
|
-
public constructor() {
|
121
|
-
super();
|
122
|
-
this.attachShadow({ mode: 'open' });
|
123
|
-
|
124
|
-
// Set up a prefixed logger
|
125
|
-
this._logger = (wlog as unknown as LoggerType).getPrefixedFunctions(
|
126
|
-
'WistiaPlayer',
|
127
|
-
) as LoggerType;
|
128
|
-
}
|
129
|
-
|
130
|
-
// --------------------------------------------------
|
131
|
-
// Public properties
|
132
|
-
// --------------------------------------------------
|
133
|
-
|
134
|
-
/**
|
135
|
-
* Return an array of the attributes that we want to observe for changes.
|
136
|
-
* If one of these attributes changes, the attributeChangedCallback will be called.
|
137
|
-
* @returns {string[]}
|
138
|
-
*/
|
139
|
-
public static get observedAttributes(): string[] {
|
140
|
-
return [...requiredAttributes, ...optionalPublicAttributes, ...optionalPrivateAttributes];
|
141
|
-
}
|
142
|
-
|
143
|
-
/**
|
144
|
-
* Returns the public api instance.
|
145
|
-
* TODO: Not sure if we want to expose this.
|
146
|
-
* @returns {PublicApi | null}
|
147
|
-
*/
|
148
|
-
public get api(): PublicApi | null {
|
149
|
-
return this.#_api;
|
150
|
-
}
|
151
|
-
|
152
|
-
/**
|
153
|
-
* Returns the aspect ratio (width / height) of the originally uploaded video or given aspect ratio.
|
154
|
-
* @returns {number}
|
155
|
-
* @see https://wistia.com/support/developers/player-api#aspect
|
156
|
-
*/
|
157
|
-
public get aspect(): number {
|
158
|
-
// Attributes set on wistia-player override all other options
|
159
|
-
if (this.hasAttribute('aspect')) {
|
160
|
-
return Number(this.getAttribute('aspect'));
|
161
|
-
}
|
162
|
-
|
163
|
-
// If no attribute is set, get the value straight from the api, or fallback to the default.
|
164
|
-
return this.api?.aspect() ?? this.offsetWidth / this.offsetHeight;
|
165
|
-
}
|
166
|
-
|
167
|
-
/**
|
168
|
-
* Sets the aspect ratio (width / height) of the video.
|
169
|
-
* @returns {void}
|
170
|
-
*/
|
171
|
-
public set aspect(newAspect: number) {
|
172
|
-
this.setAttribute('aspect', newAspect.toString());
|
173
|
-
if (this.api) {
|
174
|
-
this.api._attrs.aspect = newAspect;
|
175
|
-
// By re-setting width to the same value, we trigger the aspect ratio to be recalculated.
|
176
|
-
this.api.width(elemWidth(this) as number, { constrain: true });
|
177
|
-
}
|
178
|
-
}
|
179
|
-
|
180
|
-
/**
|
181
|
-
* Returns if the player should attempt to autoplay as soon as it's ready.
|
182
|
-
* @returns {boolean}
|
183
|
-
* @see https://wistia.com/support/developers/embed-options#autoplay
|
184
|
-
*/
|
185
|
-
public get autoplay(): boolean {
|
186
|
-
return this.#isAttributePresentOrTrue('autoplay');
|
187
|
-
}
|
188
|
-
|
189
|
-
/**
|
190
|
-
* Sets the attribute to enable/disable autoplay.
|
191
|
-
* @param {boolean} shouldSetAutoplay
|
192
|
-
* @returns {void}
|
193
|
-
* @see https://wistia.com/support/developers/embed-options#autoplay
|
194
|
-
*/
|
195
|
-
public set autoplay(shouldSetAutoplay: boolean) {
|
196
|
-
if (shouldSetAutoplay) {
|
197
|
-
this.setAttribute('autoplay', '');
|
198
|
-
} else {
|
199
|
-
this.removeAttribute('autoplay');
|
200
|
-
}
|
201
|
-
}
|
202
|
-
|
203
|
-
/**
|
204
|
-
* If set to true, the big play button control will appear in the center of the video before play.
|
205
|
-
* @returns {boolean}
|
206
|
-
* @see https://wistia.com/support/developers/embed-options#playbutton
|
207
|
-
*/
|
208
|
-
public get bigPlayButton(): boolean {
|
209
|
-
// Attributes set on wistia-player override all other options
|
210
|
-
if (this.hasAttribute('big-play-button')) {
|
211
|
-
return this.getAttribute('big-play-button') !== 'false';
|
212
|
-
}
|
213
|
-
|
214
|
-
// If no attribute is set, get the value straight from the api, or fallback to the default.
|
215
|
-
return this.api?._attrs.bigPlayButton ?? defaultEmbedOptions.bigPlayButton;
|
216
|
-
}
|
217
|
-
|
218
|
-
/**
|
219
|
-
* If set to true, the big play button control will appear in the center of the video before play.
|
220
|
-
* @param {boolean} shouldDisplay
|
221
|
-
* @returns {void}
|
222
|
-
* @see https://wistia.com/support/developers/embed-options#playbutton
|
223
|
-
*/
|
224
|
-
public set bigPlayButton(shouldDisplay: boolean) {
|
225
|
-
this.setAttribute('big-play-button', shouldDisplay.toString());
|
226
|
-
this.api?._impl.bigPlayButtonEnabled(shouldDisplay);
|
227
|
-
}
|
228
|
-
|
229
|
-
public get bigPlayButtonBorderRadius(): number {
|
230
|
-
return this.api?._attrs.bigPlayButtonBorderRadius ?? 0;
|
231
|
-
}
|
232
|
-
|
233
|
-
public set bigPlayButtonBorderRadius(radius: number) {
|
234
|
-
this.api?._impl.setBigPlayButtonBorderRadius(Number(radius));
|
235
|
-
}
|
236
|
-
|
237
|
-
/**
|
238
|
-
* Returns a new static normalized TimeRanges object that represents the ranges of the media resource,
|
239
|
-
* if any, that the user agent has buffered at the moment the buffered property is accessed.
|
240
|
-
* @returns {TimeRanges}
|
241
|
-
*/
|
242
|
-
public get buffered(): TimeRanges {
|
243
|
-
return this.api?._impl.getStandardBuffered() ?? ({} as TimeRanges);
|
244
|
-
}
|
245
|
-
|
246
|
-
public get controlBarBorderRadius(): number {
|
247
|
-
return this.api?._attrs.controlBarBorderRadius ?? 0;
|
248
|
-
}
|
249
|
-
|
250
|
-
public set controlBarBorderRadius(radius: number) {
|
251
|
-
this.api?._impl.setControlBarBorderRadius(Number(radius));
|
252
|
-
}
|
253
|
-
|
254
|
-
/**
|
255
|
-
* Returns the current time of the video as a decimal in seconds.
|
256
|
-
* @returns {number}
|
257
|
-
* @see https://wistia.com/support/developers/player-api#time
|
258
|
-
*/
|
259
|
-
public get currentTime(): number {
|
260
|
-
return this.api?.time() ?? 0;
|
261
|
-
}
|
262
|
-
|
263
|
-
/**
|
264
|
-
* Sets the current time of the video as a decimal in seconds.
|
265
|
-
* @param {number} shouldSetAutoplay
|
266
|
-
* @returns {void}
|
267
|
-
* @see https://wistia.com/support/developers/player-api#time
|
268
|
-
*/
|
269
|
-
public set currentTime(newTime: number) {
|
270
|
-
this.#_api?.time(newTime);
|
271
|
-
}
|
272
|
-
|
273
|
-
/**
|
274
|
-
* If set to true, the video will not automatically go to true fullscreen on a mobile device.
|
275
|
-
* The player will rotate, and the viewer can still click on the fullscreen option after rotating.
|
276
|
-
* @returns {boolean}
|
277
|
-
*/
|
278
|
-
public get disableFullscreenOnRotateToLandscape(): boolean {
|
279
|
-
return this.#isAttributePresentOrTrue('disable-fullscreen-on-rotate-to-landscape');
|
280
|
-
}
|
281
|
-
|
282
|
-
/**
|
283
|
-
* If set to true, the video will not automatically go to true fullscreen on a mobile device.
|
284
|
-
* The player will rotate, and the viewer can still click on the fullscreen option after rotating.
|
285
|
-
* @param {boolean} shouldDisable
|
286
|
-
* @returns {void}
|
287
|
-
*/
|
288
|
-
public set disableFullscreenOnRotateToLandscape(shouldDisable: boolean) {
|
289
|
-
this.setAttribute('disable-fullscreen-on-rotate-to-landscape', shouldDisable.toString());
|
290
|
-
|
291
|
-
if (this.api) {
|
292
|
-
this.api._attrs.fullscreenOnRotateToLandscape = !shouldDisable;
|
293
|
-
}
|
294
|
-
}
|
295
|
-
|
296
|
-
/**
|
297
|
-
* return the status of the do not track embed option that controls whether the player
|
298
|
-
* sends tracking pings.
|
299
|
-
* @returns {boolean}
|
300
|
-
*/
|
301
|
-
public get doNotTrack(): boolean {
|
302
|
-
return this.#isAttributePresentOrTrue('do-not-track');
|
303
|
-
}
|
304
|
-
|
305
|
-
/**
|
306
|
-
* When present the player will not send tracking events for stats.
|
307
|
-
* Note that this must be set at the time of embed to have any impact
|
308
|
-
*/
|
309
|
-
public set doNotTrack(dontTrack: boolean) {
|
310
|
-
this.setAttribute('do-not-track', dontTrack.toString());
|
311
|
-
|
312
|
-
if (this.api) {
|
313
|
-
this.api._attrs.doNotTrack = dontTrack;
|
314
|
-
}
|
315
|
-
}
|
316
|
-
|
317
|
-
/**
|
318
|
-
* Returns the duration of the video in seconds.
|
319
|
-
* @returns {number}
|
320
|
-
*/
|
321
|
-
public get duration(): number {
|
322
|
-
return this.api?._impl.duration() ?? 0;
|
323
|
-
}
|
324
|
-
|
325
|
-
/**
|
326
|
-
* Returns the email associated with this viewing session.
|
327
|
-
* If no email is associated, it will return undefined.
|
328
|
-
* NOTE: This attribute will impact the entire page and is not scoped to the player.
|
329
|
-
* @returns {string | undefined}
|
330
|
-
*/
|
331
|
-
public get email(): string | undefined {
|
332
|
-
return (
|
333
|
-
this.getAttribute('email') ??
|
334
|
-
extractEmailFromParams(this.#pageUrl) ??
|
335
|
-
((getWistiaLocalStorage() as WistiaLocalStorage)[this.#pageUrl]?.trackEmail as
|
336
|
-
| string
|
337
|
-
| undefined) ??
|
338
|
-
undefined
|
339
|
-
);
|
340
|
-
}
|
341
|
-
|
342
|
-
/**
|
343
|
-
* Associates the view of this media with the given email value.
|
344
|
-
* This email will appear in stats for the video.
|
345
|
-
* NOTE: This attribute will impact the entire page and is not scoped to the player.
|
346
|
-
* @param {string} newEmail
|
347
|
-
* @returns {void}
|
348
|
-
*/
|
349
|
-
public set email(newEmail: string) {
|
350
|
-
if (this.email === newEmail) {
|
351
|
-
return;
|
352
|
-
}
|
353
|
-
|
354
|
-
this.setAttribute('email', newEmail);
|
355
|
-
this.#updateEmail(newEmail);
|
356
|
-
}
|
357
|
-
|
358
|
-
/**
|
359
|
-
* Returns the overridding embed host for the player.
|
360
|
-
* Internal use only.
|
361
|
-
* @returns {string}
|
362
|
-
*/
|
363
|
-
public get embedHost(): string {
|
364
|
-
return this.getAttribute('embed-host') ?? '';
|
365
|
-
}
|
366
|
-
|
367
|
-
/**
|
368
|
-
* Sets the overridding embed host for the player.
|
369
|
-
* Internal use only.
|
370
|
-
* @param {string} newEmbedHost
|
371
|
-
* @returns {void}
|
372
|
-
*/
|
373
|
-
public set embedHost(newEmbedHost: string) {
|
374
|
-
this.setAttribute('embed-host', newEmbedHost);
|
375
|
-
}
|
376
|
-
|
377
|
-
/**
|
378
|
-
* Returns whether the video has ended playback.
|
379
|
-
* @returns {boolean}
|
380
|
-
*/
|
381
|
-
public get ended(): boolean {
|
382
|
-
return this.api?.state() === 'ended';
|
383
|
-
}
|
384
|
-
|
385
|
-
/**
|
386
|
-
* @returns { string } returns the current end video behavior value
|
387
|
-
*/
|
388
|
-
public get endVideoBehavior(): string {
|
389
|
-
const value = this.getAttribute('end-video-behavior') ?? 'default';
|
390
|
-
|
391
|
-
if (['default', 'loop', 'reset'].includes(value)) {
|
392
|
-
return value;
|
393
|
-
}
|
394
|
-
|
395
|
-
return 'default';
|
396
|
-
}
|
397
|
-
|
398
|
-
/**
|
399
|
-
* @param {'default' | 'loop' | 'reset'} behavior set the behavior for what the video should
|
400
|
-
* do when it ends.
|
401
|
-
* @returns {void}
|
402
|
-
*/
|
403
|
-
public set endVideoBehavior(behavior: 'default' | 'loop' | 'reset') {
|
404
|
-
// loop is a slightly odd option, as it's set as an attribute directly on the
|
405
|
-
// underlying <video /> element. So we must do more than just change the api._attrs
|
406
|
-
// for it to be updated.
|
407
|
-
if (behavior === 'loop') {
|
408
|
-
this.api?._impl.addLoopBehavior();
|
409
|
-
} else {
|
410
|
-
this.api?._impl.removeLoopBehavior();
|
411
|
-
}
|
412
|
-
|
413
|
-
this.setAttribute('end-video-behavior', behavior.toString());
|
414
|
-
|
415
|
-
if (this.api) {
|
416
|
-
this.api._attrs.endVideoBehavior = behavior;
|
417
|
-
}
|
418
|
-
}
|
419
|
-
|
420
|
-
public get eventKey(): string | undefined {
|
421
|
-
return this.api?._impl.eventKey();
|
422
|
-
}
|
423
|
-
|
424
|
-
/**
|
425
|
-
* If set to true, the fullscreen button control will appear in the control bar.
|
426
|
-
* @returns {boolean}
|
427
|
-
* @see https://wistia.com/support/developers/embed-options#fullscreenbutton
|
428
|
-
*/
|
429
|
-
public get fullscreenControl(): boolean {
|
430
|
-
if (this.hasAttribute('fullscreen-control')) {
|
431
|
-
return this.getAttribute('fullscreen-control') !== 'false';
|
432
|
-
}
|
433
|
-
|
434
|
-
// If no attribute is set, get the value straight from the api, or fallback to the default.
|
435
|
-
return this.api?._attrs.fullscreenControl ?? defaultEmbedOptions.fullscreenControl;
|
436
|
-
}
|
437
|
-
|
438
|
-
/**
|
439
|
-
* enable or disable the fullscreen button control in the control bar.
|
440
|
-
* @param {boolean} shouldDisplay
|
441
|
-
* @returns {void}
|
442
|
-
* @see https://wistia.com/support/developers/embed-options#fullscreenbutton
|
443
|
-
*/
|
444
|
-
public set fullscreenControl(shouldDisplay: boolean) {
|
445
|
-
this.setAttribute('fullscreen-control', shouldDisplay.toString());
|
446
|
-
this.api?._impl.fullscreenControlEnabled(shouldDisplay);
|
447
|
-
}
|
448
|
-
|
449
|
-
/**
|
450
|
-
* returns whether or not to hide the controls on load
|
451
|
-
* @returns {boolean}
|
452
|
-
*/
|
453
|
-
public get hideControlsOnLoad(): boolean {
|
454
|
-
if (this.hasAttribute('hide-controls-on-load')) {
|
455
|
-
return this.getAttribute('hide-controls-on-load') !== 'false';
|
456
|
-
}
|
457
|
-
|
458
|
-
return !this.api?._attrs.controlsVisibleOnLoad;
|
459
|
-
}
|
460
|
-
|
461
|
-
/**
|
462
|
-
* enable or disable the control on load.
|
463
|
-
* @param {boolean} shouldHide
|
464
|
-
* @returns {void}
|
465
|
-
*/
|
466
|
-
public set hideControlsOnLoad(shouldHide: boolean) {
|
467
|
-
this.setAttribute('hide-controls-on-load', shouldHide.toString());
|
468
|
-
|
469
|
-
if (this.api) {
|
470
|
-
this.api._attrs.controlsVisibleOnLoad = !shouldHide;
|
471
|
-
this.api._impl.renderUI();
|
472
|
-
}
|
473
|
-
}
|
474
|
-
|
475
|
-
/**
|
476
|
-
* returns whether or the copy link and thumbnail option from the context menu
|
477
|
-
* is available.
|
478
|
-
* @returns {boolean}
|
479
|
-
*/
|
480
|
-
public get hideCopyLinkAndThumbnail(): boolean {
|
481
|
-
if (this.hasAttribute('hide-copy-link-and-thumbnail')) {
|
482
|
-
return this.getAttribute('hide-copy-link-and-thumbnail') !== 'false';
|
483
|
-
}
|
484
|
-
|
485
|
-
return !this.api?._attrs.copyLinkAndThumbnailEnabled;
|
486
|
-
}
|
487
|
-
|
488
|
-
/**
|
489
|
-
* enable or disable the copy link and thumbnail option from the context menu.
|
490
|
-
* @param {boolean} shouldHide
|
491
|
-
* @returns {void}
|
492
|
-
*/
|
493
|
-
public set hideCopyLinkAndThumbnail(shouldHide: boolean) {
|
494
|
-
const prevVal = this.getAttribute('hide-copy-link-and-thumbnail');
|
495
|
-
|
496
|
-
if (this.api) {
|
497
|
-
this.api._attrs.copyLinkAndThumbnailEnabled = !shouldHide;
|
498
|
-
}
|
499
|
-
|
500
|
-
if (prevVal !== shouldHide.toString()) {
|
501
|
-
this.dispatchEvent(
|
502
|
-
new CustomEvent('hide-copy-link-and-thumbnail-change', {
|
503
|
-
detail: { copyLinkAndThumbnailEnabled: !shouldHide },
|
504
|
-
}),
|
505
|
-
);
|
506
|
-
}
|
507
|
-
|
508
|
-
this.setAttribute('hide-copy-link-and-thumbnail', shouldHide.toString());
|
509
|
-
}
|
510
|
-
|
511
|
-
/**
|
512
|
-
* Returns whether the video is currently in fullscreen
|
513
|
-
* @returns {boolean}
|
514
|
-
*/
|
515
|
-
public get inFullscreen(): boolean {
|
516
|
-
return this.api?._impl.inFullscreen() ?? false;
|
517
|
-
}
|
518
|
-
|
519
|
-
/**
|
520
|
-
* Returns the hashed id of the media.
|
521
|
-
* @returns {string}
|
522
|
-
*/
|
523
|
-
public get mediaId(): string {
|
524
|
-
return this.getAttribute('media-id') ?? '';
|
525
|
-
}
|
526
|
-
|
527
|
-
/**
|
528
|
-
* Replaces the content of the current video with the video identified by the given mediaId.
|
529
|
-
* @param {string} newMediaId
|
530
|
-
* @returns {void}
|
531
|
-
*/
|
532
|
-
public set mediaId(newMediaId: string) {
|
533
|
-
const prevMediaId = this.mediaId;
|
534
|
-
this.setAttribute('media-id', newMediaId);
|
535
|
-
|
536
|
-
if (prevMediaId !== newMediaId) {
|
537
|
-
this.api?.replaceWith(newMediaId);
|
538
|
-
}
|
539
|
-
}
|
540
|
-
|
541
|
-
/**
|
542
|
-
* Returns if player is currently muted
|
543
|
-
* @returns {boolean}
|
544
|
-
* @see https://wistia.com/support/developers/embed-options#muted
|
545
|
-
*/
|
546
|
-
public get muted(): boolean {
|
547
|
-
if (this.hasAttribute('muted')) {
|
548
|
-
return this.getAttribute('muted') !== 'false';
|
549
|
-
}
|
550
|
-
|
551
|
-
return Boolean(this.#_api?._impl.isMuted());
|
552
|
-
}
|
553
|
-
|
554
|
-
/**
|
555
|
-
* Change player muted state
|
556
|
-
* @param {boolean} val
|
557
|
-
* @see https://wistia.com/support/developers/embed-options#muted
|
558
|
-
*/
|
559
|
-
public set muted(val: boolean) {
|
560
|
-
if (val) {
|
561
|
-
void this.#_api?._impl.mute();
|
562
|
-
this.setAttribute('muted', '');
|
563
|
-
} else {
|
564
|
-
void this.#_api?._impl.unmute();
|
565
|
-
this.removeAttribute('muted');
|
566
|
-
}
|
567
|
-
}
|
568
|
-
|
569
|
-
/**
|
570
|
-
* Returns the name of the media as it is in the Wistia application.
|
571
|
-
* Returns undefined until media data is loaded.
|
572
|
-
* @returns {string | undefined}
|
573
|
-
*/
|
574
|
-
public get name(): string | undefined {
|
575
|
-
return this.#mediaDataServerJson.name ?? this.api?._mediaData?.name ?? undefined;
|
576
|
-
}
|
577
|
-
|
578
|
-
/**
|
579
|
-
* Returns a boolean that indicates whether the video is paused.
|
580
|
-
* @returns {boolean}
|
581
|
-
*/
|
582
|
-
public get paused(): boolean {
|
583
|
-
return this.api?.state() === 'paused';
|
584
|
-
}
|
585
|
-
|
586
|
-
/**
|
587
|
-
* Returns the percent of the video that has been watched as a decimal between 0 and 1.
|
588
|
-
* @returns {number}
|
589
|
-
*/
|
590
|
-
public get percentWatched(): number {
|
591
|
-
return this.api?.percentWatched() ?? 0;
|
592
|
-
}
|
593
|
-
|
594
|
-
/**
|
595
|
-
* Returns the playback rate of the video.
|
596
|
-
* @returns {number}
|
597
|
-
*/
|
598
|
-
public get playbackRate(): number {
|
599
|
-
return this.api?._impl.playbackRate() ?? 1;
|
600
|
-
}
|
601
|
-
|
602
|
-
/**
|
603
|
-
* Set the playback rate of the video.
|
604
|
-
* @param {number} rate
|
605
|
-
* @returns {void}
|
606
|
-
*/
|
607
|
-
public set playbackRate(rate: number) {
|
608
|
-
this.api?._impl.playbackRate(rate);
|
609
|
-
}
|
610
|
-
|
611
|
-
/**
|
612
|
-
* If set to true, the playback rate control will appear in the setting control.
|
613
|
-
* @returns {boolean}
|
614
|
-
* @see https://wistia.com/support/developers/embed-options#playbackratecontrol
|
615
|
-
*/
|
616
|
-
public get playbackRateControl(): boolean {
|
617
|
-
if (this.hasAttribute('playback-rate-control')) {
|
618
|
-
return this.getAttribute('playback-rate-control') !== 'false';
|
619
|
-
}
|
620
|
-
|
621
|
-
// If no attribute is set, get the value straight from the api, or fallback to the default.
|
622
|
-
return this.api?._attrs.playbackRateControl ?? defaultEmbedOptions.playbackRateControl;
|
623
|
-
}
|
624
|
-
|
625
|
-
/**
|
626
|
-
* enable or disable the playback rate control in the settings control.
|
627
|
-
* @param {boolean} shouldDisplay
|
628
|
-
* @returns {void}
|
629
|
-
* @see https://wistia.com/support/developers/embed-options#playbackratecontrol
|
630
|
-
*/
|
631
|
-
public set playbackRateControl(shouldDisplay: boolean) {
|
632
|
-
this.setAttribute('playback-rate-control', shouldDisplay.toString());
|
633
|
-
this.api?._impl.playbackRateControlEnabled(shouldDisplay);
|
634
|
-
}
|
635
|
-
|
636
|
-
/**
|
637
|
-
* If set to true, the playbar - which includes the playhead, current time, and scrubbing functionality - will be available.
|
638
|
-
* @returns {boolean}
|
639
|
-
*/
|
640
|
-
public get playBarControl(): boolean {
|
641
|
-
if (this.hasAttribute('play-bar-control')) {
|
642
|
-
return this.getAttribute('play-bar-control') !== 'false';
|
643
|
-
}
|
644
|
-
|
645
|
-
// If no attribute is set, get the value straight from the api, or fallback to the default.
|
646
|
-
return this.api?._attrs.playBarControl ?? defaultEmbedOptions.playBarControl;
|
647
|
-
}
|
648
|
-
|
649
|
-
/**
|
650
|
-
* If set to true, the playbar - which includes the playhead, current time, and scrubbing functionality - will be available.
|
651
|
-
* @param {boolean} shouldDisplay
|
652
|
-
* @returns {void}
|
653
|
-
*/
|
654
|
-
public set playBarControl(shouldDisplay: boolean) {
|
655
|
-
this.setAttribute('play-bar-control', shouldDisplay.toString());
|
656
|
-
this.api?._impl.playbarControlEnabled(shouldDisplay);
|
657
|
-
}
|
658
|
-
|
659
|
-
public get playerBorderRadius(): number {
|
660
|
-
return this.api?._attrs.playerBorderRadius ?? 0;
|
661
|
-
}
|
662
|
-
|
663
|
-
public set playerBorderRadius(radius: number) {
|
664
|
-
this.api?._impl.setPlayerBorderRadius(Number(radius));
|
665
|
-
}
|
666
|
-
|
667
|
-
/**
|
668
|
-
* Returns the base color of the player.
|
669
|
-
* @returns {string}
|
670
|
-
* @see https://wistia.com/support/developers/embed-options#playercolor
|
671
|
-
*/
|
672
|
-
public get playerColor(): string {
|
673
|
-
return this.getAttribute('player-color') ?? defaultEmbedOptions.playerColor;
|
674
|
-
}
|
675
|
-
|
676
|
-
/**
|
677
|
-
* Changes the base color of the player.
|
678
|
-
* Expects a hexadecimal rgb string like “ff0000” (red), “000000” (black), “ffffff” (white), or “0000ff” (blue).
|
679
|
-
* @param {string} newColor
|
680
|
-
* @returns {void}
|
681
|
-
* @see https://wistia.com/support/developers/embed-options#playercolor
|
682
|
-
*/
|
683
|
-
public set playerColor(newColor: string) {
|
684
|
-
this._logger.info('set playerColor', newColor);
|
685
|
-
const prevPlayerColor = this.playerColor;
|
686
|
-
const finalHexColor = sanePlayerColor(newColor) as string;
|
687
|
-
this.setAttribute('player-color', finalHexColor);
|
688
|
-
|
689
|
-
if (prevPlayerColor !== finalHexColor) {
|
690
|
-
this.dispatchEvent(
|
691
|
-
new CustomEvent<PlayerColorChangeEventData>('playercolorchange', {
|
692
|
-
detail: { color: finalHexColor, prevColor: prevPlayerColor },
|
693
|
-
}),
|
694
|
-
);
|
695
|
-
}
|
696
|
-
}
|
697
|
-
|
698
|
-
/**
|
699
|
-
* Returns the overridding player.
|
700
|
-
* Internal use only.
|
701
|
-
* @returns {Players | undefined}
|
702
|
-
*/
|
703
|
-
public get playerForce(): Players | undefined {
|
704
|
-
return (this.getAttribute('player-force') as Players | null) ?? undefined;
|
705
|
-
}
|
706
|
-
|
707
|
-
/**
|
708
|
-
* Sets the overridding player.
|
709
|
-
* Internal use only.
|
710
|
-
* @param {string} newPlayer
|
711
|
-
* @returns {void}
|
712
|
-
*/
|
713
|
-
public set playerForce(newPlayer: Players) {
|
714
|
-
this.setAttribute('player-force', newPlayer);
|
715
|
-
}
|
716
|
-
|
717
|
-
/**
|
718
|
-
* Returns the strategy for associating specially crafted links on a page with a video, turning them into a playlist.
|
719
|
-
* auto: For each video on the page, look for links after the video, until we come to another Wistia video.
|
720
|
-
* manual: Given each link element, look at its ’container' option to determine which video it should connect to.
|
721
|
-
* "container": For all embed links in a container whose id matches this given string, connect them to this specific video.
|
722
|
-
* @returns {'auto' | 'manual' | string}
|
723
|
-
* @see https://wistia.com/support/developers/embed-links#advanced-embed-links-targeting
|
724
|
-
*/
|
725
|
-
public get playlistLinks(): string {
|
726
|
-
return this.getAttribute('playlist-links') ?? '';
|
727
|
-
}
|
728
|
-
|
729
|
-
/**
|
730
|
-
* Sets the strategy for associating specially crafted links on a page with a video, turning them into a playlist.
|
731
|
-
* @param {'auto' | 'manual' | string} newStrategy
|
732
|
-
*/
|
733
|
-
public set playlistLinks(newStrategy: string) {
|
734
|
-
this.setAttribute('playlist-links', newStrategy.toString());
|
735
|
-
|
736
|
-
if (this.api) {
|
737
|
-
this.api._attrs.playlistLinks = newStrategy;
|
738
|
-
}
|
739
|
-
}
|
740
|
-
|
741
|
-
/**
|
742
|
-
* When present or set to true and this video has a playlist, it will loop back to
|
743
|
-
* the first video and replay it once the last video has finished.
|
744
|
-
* @returns {boolean}
|
745
|
-
*/
|
746
|
-
public get playlistLoop(): boolean {
|
747
|
-
return this.#isAttributePresentOrTrue('playlist-loop');
|
748
|
-
}
|
749
|
-
|
750
|
-
/**
|
751
|
-
* When present or set to true and this video has a playlist, it will loop back to
|
752
|
-
* the first video and replay it once the last video has finished.
|
753
|
-
*/
|
754
|
-
public set playlistLoop(shouldLoop: boolean) {
|
755
|
-
this.setAttribute('playlist-loop', shouldLoop.toString());
|
756
|
-
|
757
|
-
if (this.api) {
|
758
|
-
this.api._attrs.playlistLoop = shouldLoop;
|
759
|
-
}
|
760
|
-
}
|
761
|
-
|
762
|
-
/**
|
763
|
-
* If set to true, the small play button control will be available.
|
764
|
-
* @returns {boolean}
|
765
|
-
*/
|
766
|
-
public get playPauseControl(): boolean {
|
767
|
-
if (this.hasAttribute('play-pause-control')) {
|
768
|
-
return this.getAttribute('play-pause-control') !== 'false';
|
769
|
-
}
|
770
|
-
|
771
|
-
// If no attribute is set, get the value straight from the api, or fallback to the default.
|
772
|
-
return this.api?._attrs.playPauseControl ?? defaultEmbedOptions.playPauseControl;
|
773
|
-
}
|
774
|
-
|
775
|
-
/**
|
776
|
-
* If set to true, the small play button control will be available.
|
777
|
-
* @param {boolean} shouldDisplay
|
778
|
-
* @returns {void}
|
779
|
-
*/
|
780
|
-
public set playPauseControl(shouldDisplay: boolean) {
|
781
|
-
this.setAttribute('play-pause-control', shouldDisplay.toString());
|
782
|
-
this.api?._impl.playPauseControlEnabled(shouldDisplay);
|
783
|
-
}
|
784
|
-
|
785
|
-
/**
|
786
|
-
* By default, pausing a video will display a brief animation of the pause symbol
|
787
|
-
* and resuming the video will display an animation of the play symbol.
|
788
|
-
* Setting this embed option to false will remove those animations.
|
789
|
-
* @returns {boolean}
|
790
|
-
*/
|
791
|
-
public get playPauseNotifier(): boolean {
|
792
|
-
if (this.hasAttribute('play-pause-notifier')) {
|
793
|
-
return this.getAttribute('play-pause-notifier') !== 'false';
|
794
|
-
}
|
795
|
-
|
796
|
-
// If no attribute is set, get the value straight from the api, or fallback to the default.
|
797
|
-
return this.api?._attrs.playPauseNotifier ?? defaultEmbedOptions.playPauseNotifier;
|
798
|
-
}
|
799
|
-
|
800
|
-
/**
|
801
|
-
* By default, pausing a video will display a brief animation of the pause symbol
|
802
|
-
* and resuming the video will display an animation of the play symbol.
|
803
|
-
* Setting this embed option to false will remove those animations.
|
804
|
-
* @param {boolean} shouldDisplay
|
805
|
-
* @returns {void}
|
806
|
-
*/
|
807
|
-
public set playPauseNotifier(shouldDisplay: boolean) {
|
808
|
-
this.setAttribute('play-pause-notifier', shouldDisplay.toString());
|
809
|
-
this.api?._impl.playPauseNotifierEnabled(shouldDisplay);
|
810
|
-
}
|
811
|
-
|
812
|
-
/**
|
813
|
-
* Overrides the thumbnail image that appears before the video plays.
|
814
|
-
* Expects an absolute URL to an image.
|
815
|
-
* @returns {string}
|
816
|
-
*/
|
817
|
-
public get poster(): string {
|
818
|
-
return this.getAttribute('poster') ?? this.api?._attrs.poster ?? '';
|
819
|
-
}
|
820
|
-
|
821
|
-
/**
|
822
|
-
* Overrides the thumbnail image that appears before the video plays.
|
823
|
-
* Expects an absolute URL to an image.
|
824
|
-
* @param {string} newUrl
|
825
|
-
* @returns {void}
|
826
|
-
*/
|
827
|
-
public set poster(newUrl: string) {
|
828
|
-
const prevUrl = this.poster;
|
829
|
-
this.setAttribute('poster', newUrl);
|
830
|
-
if (this.api) {
|
831
|
-
this.api._attrs.poster = newUrl;
|
832
|
-
}
|
833
|
-
|
834
|
-
if (prevUrl !== newUrl) {
|
835
|
-
this.dispatchEvent(new CustomEvent('thumbnailchange'));
|
836
|
-
}
|
837
|
-
}
|
838
|
-
|
839
|
-
/**
|
840
|
-
* Returns the preload setting for the player.
|
841
|
-
* @returns {string | undefined}
|
842
|
-
* @see https://wistia.com/support/developers/embed-options#preload
|
843
|
-
* undefined is allowed as a return type because there may be situations
|
844
|
-
* where the player and/or engine has not loaded and we don't know what
|
845
|
-
* preload setting will be used
|
846
|
-
*/
|
847
|
-
public get preload(): string | undefined {
|
848
|
-
const value = this.getAttribute('preload') ?? '';
|
849
|
-
|
850
|
-
if (['auto', 'metadata', 'none'].includes(value)) {
|
851
|
-
return value;
|
852
|
-
}
|
853
|
-
|
854
|
-
return this.api?._impl.preloadValue();
|
855
|
-
}
|
856
|
-
|
857
|
-
/**
|
858
|
-
* sets the preload value for the player. Note that changing this option
|
859
|
-
* after player initialization has no impact.
|
860
|
-
* @param {'auto'| 'metadata' | 'none'} preloadValue
|
861
|
-
* @returns {void}
|
862
|
-
* @see https://wistia.com/support/developers/player-api#preload
|
863
|
-
*/
|
864
|
-
public set preload(preloadValue: 'auto' | 'metadata' | 'none') {
|
865
|
-
if (this.api) {
|
866
|
-
this.api._attrs.preload = preloadValue;
|
867
|
-
}
|
868
|
-
|
869
|
-
this.setAttribute('preload', preloadValue.toString());
|
870
|
-
}
|
871
|
-
|
872
|
-
/**
|
873
|
-
* If set to true, the quality control will appear in the setting control.
|
874
|
-
* @returns {boolean}
|
875
|
-
* @see https://wistia.com/support/developers/embed-options#qualitycontrol
|
876
|
-
*/
|
877
|
-
public get qualityControl(): boolean {
|
878
|
-
if (this.hasAttribute('quality-control')) {
|
879
|
-
return this.getAttribute('quality-control') !== 'false';
|
880
|
-
}
|
881
|
-
|
882
|
-
// If no attribute is set, get the value straight from the api, or fallback to the default.
|
883
|
-
return this.api?._attrs.qualityControl ?? defaultEmbedOptions.qualityControl;
|
884
|
-
}
|
885
|
-
|
886
|
-
/**
|
887
|
-
* enable or disable the quality control in the settings control.
|
888
|
-
* @param {boolean} shouldDisplay
|
889
|
-
* @returns {void}
|
890
|
-
* @see https://wistia.com/support/developers/embed-options#qualitycontrol
|
891
|
-
*/
|
892
|
-
public set qualityControl(shouldDisplay: boolean) {
|
893
|
-
this.setAttribute('quality-control', shouldDisplay.toString());
|
894
|
-
this.api?._impl.qualityControlEnabled(shouldDisplay);
|
895
|
-
}
|
896
|
-
|
897
|
-
/**
|
898
|
-
* Return the max quality allowed for the 'Auto' asset in HLS playback
|
899
|
-
* @returns {number}
|
900
|
-
* @see https://wistia.com/support/developers/embed-options#qualityMax
|
901
|
-
*/
|
902
|
-
public get qualityMax(): number | undefined {
|
903
|
-
if (this.hasAttribute('quality-max')) {
|
904
|
-
return Number(this.getAttribute('quality-max'));
|
905
|
-
}
|
906
|
-
|
907
|
-
// If no attribute is set, get the value straight from the api.
|
908
|
-
return this.api?._attrs.qualityMax;
|
909
|
-
}
|
910
|
-
|
911
|
-
/**
|
912
|
-
* Set the max quality to be used for "Auto" in the HLS stream.
|
913
|
-
* @param {number} quality
|
914
|
-
* @returns {void}
|
915
|
-
* @see https://wistia.com/support/developers/embed-options#qualityMax
|
916
|
-
*/
|
917
|
-
public set qualityMax(quality: AllowedQualities) {
|
918
|
-
this.setAttribute('quality-max', quality.toString());
|
919
|
-
|
920
|
-
if (this.api) {
|
921
|
-
this.api._attrs.qualityMax = quality;
|
922
|
-
this.api._impl.qualityMax(quality);
|
923
|
-
}
|
924
|
-
}
|
925
|
-
|
926
|
-
/**
|
927
|
-
* Return the min quality allowed for the 'Auto' asset in HLS playback
|
928
|
-
* @returns {number}
|
929
|
-
* @see https://wistia.com/support/developers/embed-options#qualityMin
|
930
|
-
*/
|
931
|
-
public get qualityMin(): number | undefined {
|
932
|
-
if (this.hasAttribute('quality-min')) {
|
933
|
-
return Number(this.getAttribute('quality-min'));
|
934
|
-
}
|
935
|
-
|
936
|
-
// If no attribute is set, get the value straight from the api.
|
937
|
-
return this.api?._attrs.qualityMin;
|
938
|
-
}
|
939
|
-
|
940
|
-
/**
|
941
|
-
* Set the min quality to be used for "Auto" in the HLS stream.
|
942
|
-
* @param {number} quality
|
943
|
-
* @returns {void}
|
944
|
-
* @see https://wistia.com/support/developers/embed-options#qualityMin
|
945
|
-
*/
|
946
|
-
public set qualityMin(quality: AllowedQualities) {
|
947
|
-
this.setAttribute('quality-min', quality.toString());
|
948
|
-
|
949
|
-
if (this.api) {
|
950
|
-
this.api._attrs.qualityMin = quality;
|
951
|
-
this.api._impl.qualityMin(quality);
|
952
|
-
}
|
953
|
-
}
|
954
|
-
|
955
|
-
/**
|
956
|
-
* Returns the readyState of the inner video HTML element.
|
957
|
-
* @returns {number}
|
958
|
-
*/
|
959
|
-
public get readyState(): number {
|
960
|
-
return this.api?._impl.getReadyState() ?? 0;
|
961
|
-
}
|
962
|
-
|
963
|
-
/* Returns the current state of the video.
|
964
|
-
* Returns the current resumable status of the video.
|
965
|
-
* @returns {'auto' | boolean}
|
966
|
-
* @see https://wistia.com/support/developers/embed-options#resumable
|
967
|
-
*/
|
968
|
-
public get resumable(): boolean | string {
|
969
|
-
const attr = this.getAttribute('resumable');
|
970
|
-
if (attr === 'true') {
|
971
|
-
return true;
|
972
|
-
}
|
973
|
-
|
974
|
-
if (attr === 'false') {
|
975
|
-
return false;
|
976
|
-
}
|
977
|
-
|
978
|
-
// If not set explicitly, then we're 'auto' for resumable - which may or may not actually resume
|
979
|
-
return 'auto';
|
980
|
-
}
|
981
|
-
|
982
|
-
/**
|
983
|
-
* set the resumable state of the video to 'auto' | true | false.
|
984
|
-
* note that this can be changed 'beforeplay', however changing the
|
985
|
-
* value after play will have no effect
|
986
|
-
* @param {'auto' | boolean} resumableState
|
987
|
-
* @see https://wistia.com/support/developers/embed-options#resumable
|
988
|
-
*/
|
989
|
-
public set resumable(resumableState: boolean | 'auto') {
|
990
|
-
this.setAttribute('resumable', resumableState.toString());
|
991
|
-
|
992
|
-
if (this.api) {
|
993
|
-
this.api._impl.setResumable(resumableState);
|
994
|
-
}
|
995
|
-
}
|
996
|
-
|
997
|
-
public get roundedPlayer(): number {
|
998
|
-
return this.api?._attrs.roundedPlayer ?? 0;
|
999
|
-
}
|
1000
|
-
|
1001
|
-
public set roundedPlayer(radius: number) {
|
1002
|
-
this.api?._impl.setRoundedPlayer(Number(radius));
|
1003
|
-
}
|
1004
|
-
|
1005
|
-
/**
|
1006
|
-
* Returns the number of unique seconds that have been watched for the video.
|
1007
|
-
* This does not include seconds that have been skipped by seeking.
|
1008
|
-
* @returns {number}
|
1009
|
-
*/
|
1010
|
-
public get secondsWatched(): number {
|
1011
|
-
return this.api?._impl.secondsWatched() ?? 0;
|
1012
|
-
}
|
1013
|
-
|
1014
|
-
/**
|
1015
|
-
* Returns an array where each index represents the number of times the viewer has watched each second of the video.
|
1016
|
-
* @returns {number[]}
|
1017
|
-
*/
|
1018
|
-
public get secondsWatchedVector(): number[] {
|
1019
|
-
return this.api?._impl.secondsWatchedVector() ?? [];
|
1020
|
-
}
|
1021
|
-
|
1022
|
-
/* Returns whether JSON+LD seo data will be injected.
|
1023
|
-
* @returns {boolean}
|
1024
|
-
* @see https://wistia.com/support/developers/embed-options#seo
|
1025
|
-
*/
|
1026
|
-
public get seo(): boolean {
|
1027
|
-
if (this.hasAttribute('seo')) {
|
1028
|
-
return this.getAttribute('seo') !== 'false';
|
1029
|
-
}
|
1030
|
-
|
1031
|
-
// If no attribute is set, get the value straight from the api or use the default
|
1032
|
-
return this.api?._attrs.seo ?? defaultEmbedOptions.seo;
|
1033
|
-
}
|
1034
|
-
|
1035
|
-
/**
|
1036
|
-
* Set whether JSON+LD seo data will be injected.
|
1037
|
-
* Note that changing this value after embed has no impact as JSON+LD needs
|
1038
|
-
* to be injected as soon as possible.
|
1039
|
-
* @param {boolean} val
|
1040
|
-
* @see https://wistia.com/support/developers/embed-options#seo
|
1041
|
-
*/
|
1042
|
-
public set seo(val: boolean) {
|
1043
|
-
this.setAttribute('seo', val.toString());
|
1044
|
-
|
1045
|
-
if (this.api) {
|
1046
|
-
this.api._attrs.seo = val;
|
1047
|
-
}
|
1048
|
-
}
|
1049
|
-
|
1050
|
-
/**
|
1051
|
-
* If set to true, the settings control will appear in the control bar.
|
1052
|
-
* @returns {boolean}
|
1053
|
-
* @see https://wistia.com/support/developers/embed-options#settingscontrol
|
1054
|
-
*/
|
1055
|
-
public get settingsControl(): boolean {
|
1056
|
-
if (this.hasAttribute('settings-control')) {
|
1057
|
-
return this.getAttribute('settings-control') !== 'false';
|
1058
|
-
}
|
1059
|
-
|
1060
|
-
// If no attribute is set, get the value straight from the api, or fallback to the default.
|
1061
|
-
return this.api?._attrs.settingsControl ?? defaultEmbedOptions.settingsControl;
|
1062
|
-
}
|
1063
|
-
|
1064
|
-
/**
|
1065
|
-
* enable or disable the settings control in the control bar.
|
1066
|
-
* @param {boolean} shouldDisplay
|
1067
|
-
* @returns {void}
|
1068
|
-
* @see https://wistia.com/support/developers/embed-options#settingscontrol
|
1069
|
-
*/
|
1070
|
-
public set settingsControl(shouldDisplay: boolean) {
|
1071
|
-
this.setAttribute('settings-control', shouldDisplay.toString());
|
1072
|
-
this.api?._impl.settingsControlEnabled(shouldDisplay);
|
1073
|
-
}
|
1074
|
-
|
1075
|
-
/**
|
1076
|
-
* This option allows videos to autoplay in a muted state in contexts where normal autoplay
|
1077
|
-
* is blocked or not supported (e.g. iOS, Safari 11+, Chrome 66+).
|
1078
|
-
* allow: The video will default to normal autoplay, with silent autoplay as a fallback if needed.
|
1079
|
-
* false: The video will not autoplay silently.
|
1080
|
-
* true: The video will default to autoplaying silently.
|
1081
|
-
* @returns {boolean | 'allow'}
|
1082
|
-
*/
|
1083
|
-
public get silentAutoplay(): boolean | 'allow' {
|
1084
|
-
switch (this.getAttribute('silent-autoplay')) {
|
1085
|
-
case 'allow':
|
1086
|
-
return 'allow';
|
1087
|
-
case 'false':
|
1088
|
-
return false;
|
1089
|
-
case 'true':
|
1090
|
-
return true;
|
1091
|
-
default:
|
1092
|
-
return this.api?._attrs.silentAutoplay ?? defaultEmbedOptions.silentAutoplay;
|
1093
|
-
}
|
1094
|
-
}
|
1095
|
-
|
1096
|
-
/**
|
1097
|
-
* This option allows videos to autoplay in a muted state in contexts where normal autoplay
|
1098
|
-
* is blocked or not supported (e.g. iOS, Safari 11+, Chrome 66+).
|
1099
|
-
* @param {boolean | 'allow'} silentAutoplayValue
|
1100
|
-
* @returns {void}
|
1101
|
-
*/
|
1102
|
-
public set silentAutoplay(silentAutoplayValue: boolean | 'allow') {
|
1103
|
-
if (this.api) {
|
1104
|
-
this.api._attrs.silentAutoplay = silentAutoplayValue;
|
1105
|
-
}
|
1106
|
-
|
1107
|
-
this.setAttribute('silent-autoplay', silentAutoplayValue.toString());
|
1108
|
-
}
|
1109
|
-
|
1110
|
-
/**
|
1111
|
-
* Returns the current state of the video.
|
1112
|
-
* @returns {PlayerState}
|
1113
|
-
* @see https://wistia.com/support/developers/player-api#state
|
1114
|
-
*/
|
1115
|
-
public get state(): PlayerState {
|
1116
|
-
return this.api?.state() ?? defaultEmbedOptions.state;
|
1117
|
-
}
|
1118
|
-
|
1119
|
-
/**
|
1120
|
-
* Returns the current state of the video.
|
1121
|
-
* @returns {string | null}
|
1122
|
-
*/
|
1123
|
-
public get statsUrl(): string | null {
|
1124
|
-
if (this.hasAttribute('stats-url')) {
|
1125
|
-
return this.getAttribute('stat-url');
|
1126
|
-
}
|
1127
|
-
|
1128
|
-
return this.api?._attrs.statsUrl ?? null;
|
1129
|
-
}
|
1130
|
-
|
1131
|
-
public set statsUrl(url: string) {
|
1132
|
-
this.setAttribute('stats-url', url);
|
1133
|
-
|
1134
|
-
if (this.api) {
|
1135
|
-
this.api._attrs.statsUrl = url;
|
1136
|
-
}
|
1137
|
-
}
|
1138
|
-
|
1139
|
-
/**
|
1140
|
-
* If present, the background behind the video player will be transparent
|
1141
|
-
* allowing the page color to show through instead of black.
|
1142
|
-
* @returns {boolean}
|
1143
|
-
*/
|
1144
|
-
public get transparentLetterbox(): boolean {
|
1145
|
-
return this.#isAttributePresentOrTrue('transparent-letterbox');
|
1146
|
-
}
|
1147
|
-
|
1148
|
-
/**
|
1149
|
-
* Sets the letterbox to be transparent or not.
|
1150
|
-
* @param {boolean} shouldSetTransparentLetterbox
|
1151
|
-
* @returns {void}
|
1152
|
-
*/
|
1153
|
-
public set transparentLetterbox(shouldSetTransparentLetterbox: boolean) {
|
1154
|
-
if (shouldSetTransparentLetterbox) {
|
1155
|
-
this.setAttribute('transparent-letterbox', '');
|
1156
|
-
} else {
|
1157
|
-
this.removeAttribute('transparent-letterbox');
|
1158
|
-
}
|
1159
|
-
|
1160
|
-
if (this.api) {
|
1161
|
-
this.api._attrs.transparentLetterbox = shouldSetTransparentLetterbox;
|
1162
|
-
}
|
1163
|
-
}
|
1164
|
-
|
1165
|
-
/**
|
1166
|
-
* @returns {boolean} the value for the `use-web-component` attribute or property
|
1167
|
-
*/
|
1168
|
-
public get useWebComponent(): boolean {
|
1169
|
-
const val = this.getAttribute('use-web-component');
|
1170
|
-
|
1171
|
-
return val === 'true';
|
1172
|
-
}
|
1173
|
-
|
1174
|
-
/**
|
1175
|
-
* @param {boolean} val Value for the `use-web-component` attribute or property
|
1176
|
-
*/
|
1177
|
-
public set useWebComponent(val: boolean) {
|
1178
|
-
if (val) {
|
1179
|
-
this.setAttribute('use-web-component', String(val));
|
1180
|
-
} else {
|
1181
|
-
this.removeAttribute('use-web-component');
|
1182
|
-
}
|
1183
|
-
}
|
1184
|
-
|
1185
|
-
public get videoQuality(): number | 'auto' {
|
1186
|
-
if (this.api) {
|
1187
|
-
return this.api._impl.getVideoQuality();
|
1188
|
-
}
|
1189
|
-
|
1190
|
-
return 'auto';
|
1191
|
-
}
|
1192
|
-
|
1193
|
-
public set videoQuality(quality: number | 'auto') {
|
1194
|
-
this.api?._impl.setVideoQuality(quality);
|
1195
|
-
}
|
1196
|
-
|
1197
|
-
/**
|
1198
|
-
* get the current volume set on the player
|
1199
|
-
* @returns {number}
|
1200
|
-
* @see https://wistia.com/support/developers/embed-options#volume
|
1201
|
-
*/
|
1202
|
-
public get volume(): number {
|
1203
|
-
if (this.hasAttribute('volume')) {
|
1204
|
-
const vol = this.getAttribute('volume');
|
1205
|
-
if (vol !== null) {
|
1206
|
-
return Number(vol);
|
1207
|
-
}
|
1208
|
-
return 1;
|
1209
|
-
}
|
1210
|
-
|
1211
|
-
return this.api?._attrs.volume ?? 1;
|
1212
|
-
}
|
1213
|
-
|
1214
|
-
/**
|
1215
|
-
* get the current volume set on the player
|
1216
|
-
* @param {number} level - a Number from 0 - 1
|
1217
|
-
* @see https://wistia.com/support/developers/embed-options#volume
|
1218
|
-
*/
|
1219
|
-
public set volume(level: number) {
|
1220
|
-
this.setAttribute('volume', level.toString());
|
1221
|
-
this.api?._impl.volume(level);
|
1222
|
-
}
|
1223
|
-
|
1224
|
-
/**
|
1225
|
-
* If set to true, the volume control will appear in the control bar.
|
1226
|
-
* Note that on mobile, we never show a volume control, as the device
|
1227
|
-
* volume is used.
|
1228
|
-
* @returns {boolean}
|
1229
|
-
* @see https://wistia.com/support/developers/embed-options#volumecontrol
|
1230
|
-
*/
|
1231
|
-
public get volumeControl(): boolean {
|
1232
|
-
if (this.hasAttribute('volume-control')) {
|
1233
|
-
return this.getAttribute('volume-control') !== 'false';
|
1234
|
-
}
|
1235
|
-
|
1236
|
-
// If no attribute is set, get the value straight from the api, or fallback to the default.
|
1237
|
-
return this.api?._attrs.volumeControl ?? defaultEmbedOptions.volumeControl;
|
1238
|
-
}
|
1239
|
-
|
1240
|
-
/**
|
1241
|
-
* enable or disable the volume control in the control bar.
|
1242
|
-
* @param {boolean} shouldDisplay
|
1243
|
-
* @returns {void}
|
1244
|
-
* @see https://wistia.com/support/developers/embed-options#volumecontrol
|
1245
|
-
*/
|
1246
|
-
public set volumeControl(shouldDisplay: boolean) {
|
1247
|
-
this.setAttribute('volume-control', shouldDisplay.toString());
|
1248
|
-
this.api?._impl.volumeControlEnabled(shouldDisplay);
|
1249
|
-
}
|
1250
|
-
|
1251
|
-
/**
|
1252
|
-
* @returns {MediaData} object containing the final mediaData object that will be given to the PublicApi
|
1253
|
-
*/
|
1254
|
-
get #mediaDataConfig(): MediaData {
|
1255
|
-
const result = { ...this.#mediaDataServerJson };
|
1256
|
-
|
1257
|
-
const embedOptionsFromAttributes = { ...this.#getEmbedOptionsFromAttributes() };
|
1258
|
-
// we want to strip any null/undefined embed options so they don't override
|
1259
|
-
// anything from the mediaData response :/
|
1260
|
-
const cleanEmbedOptions = Object.fromEntries(
|
1261
|
-
Object.entries(embedOptionsFromAttributes).filter(([_k, val]) => !(val === null)),
|
1262
|
-
);
|
1263
|
-
|
1264
|
-
result.embedOptions = {
|
1265
|
-
...result.embedOptions,
|
1266
|
-
...cleanEmbedOptions,
|
1267
|
-
};
|
1268
|
-
|
1269
|
-
return result;
|
1270
|
-
}
|
1271
|
-
|
1272
|
-
get #pageUrl(): string {
|
1273
|
-
return this.getAttribute('page-url') ?? inferPageUrl();
|
1274
|
-
}
|
1275
|
-
|
1276
|
-
// --------------------------------------------------
|
1277
|
-
// Public api methods
|
1278
|
-
// --------------------------------------------------
|
1279
|
-
|
1280
|
-
/**
|
1281
|
-
* Adds a media to the playlist.
|
1282
|
-
* @param {string} mediaId - the id of the media to add
|
1283
|
-
* @param {object} options - embed options to apply for this media in the playlist
|
1284
|
-
* @param {object} position - position to add the media in the playlist
|
1285
|
-
* @returns {Promise<void>}
|
1286
|
-
*/
|
1287
|
-
public async addToPlaylist(mediaId: string, options: object, position: object): Promise<void> {
|
1288
|
-
if (this.api) {
|
1289
|
-
this.api.addToPlaylist(mediaId, options, position);
|
1290
|
-
return Promise.resolve();
|
1291
|
-
}
|
1292
|
-
|
1293
|
-
return Promise.reject(new Error(`Playlist cannot be accessed`));
|
1294
|
-
}
|
1295
|
-
|
1296
|
-
/**
|
1297
|
-
* Attempt to enter fullscreen mode.
|
1298
|
-
* @returns {Promise<void>}
|
1299
|
-
* @see https://wistia.com/support/developers/player-api#cancelfullscreen
|
1300
|
-
*/
|
1301
|
-
public async cancelFullscreen(): Promise<void> {
|
1302
|
-
return this.api?._impl.cancelFullscreen();
|
1303
|
-
}
|
1304
|
-
|
1305
|
-
/**
|
1306
|
-
* Defines a plugin on the player.
|
1307
|
-
* @param {string} name name of the plugin to define
|
1308
|
-
* @param {object} options object of plugin options related to the specific plugin
|
1309
|
-
* @returns {Promise<void>} returns a Promise that resolves with the defined plugin
|
1310
|
-
*/
|
1311
|
-
public async definePlugin(name: string, options: object): Promise<void> {
|
1312
|
-
const addPlugin = async (): Promise<void> => {
|
1313
|
-
return (
|
1314
|
-
this.api?.addPlugin(name, options) ??
|
1315
|
-
Promise.reject(new Error(`plugin ${name} cannot be defined`))
|
1316
|
-
);
|
1317
|
-
};
|
1318
|
-
|
1319
|
-
if (this.api) {
|
1320
|
-
return addPlugin();
|
1321
|
-
}
|
1322
|
-
|
1323
|
-
return new Promise((resolve, reject) => {
|
1324
|
-
const handler = () => {
|
1325
|
-
this.removeEventListener('ready', handler);
|
1326
|
-
addPlugin()
|
1327
|
-
.then((plugin) => resolve(plugin))
|
1328
|
-
.catch((err) => {
|
1329
|
-
reject(err);
|
1330
|
-
});
|
1331
|
-
};
|
1332
|
-
|
1333
|
-
this.addEventListener('ready', handler);
|
1334
|
-
});
|
1335
|
-
}
|
1336
|
-
|
1337
|
-
/**
|
1338
|
-
* Gets a plugin from the player.
|
1339
|
-
* @param {string} name name of the plugin to retrieve
|
1340
|
-
* @returns {Promise<void>} returns a Promise that resolves with the request plugin
|
1341
|
-
*/
|
1342
|
-
public async getPlugin(name: string): Promise<void> {
|
1343
|
-
if (this.api) {
|
1344
|
-
return this.api.plugin(name);
|
1345
|
-
}
|
1346
|
-
|
1347
|
-
return Promise.reject(new Error(`plugin ${name} is not yet defined`));
|
1348
|
-
}
|
1349
|
-
|
1350
|
-
/**
|
1351
|
-
* Attempts to load the media data from the server.
|
1352
|
-
* Public so it can be mocked in tests.
|
1353
|
-
* @param {number | string} mediaId
|
1354
|
-
* @param {DynamicImportOptions} options
|
1355
|
-
* @returns {void}
|
1356
|
-
*/
|
1357
|
-
public async importMediaData(
|
1358
|
-
mediaId: number | string,
|
1359
|
-
options: DynamicImportOptions,
|
1360
|
-
): Promise<unknown> {
|
1361
|
-
return dynamicImport(`embed/${String(mediaId)}.js`, options);
|
1362
|
-
}
|
1363
|
-
|
1364
|
-
/**
|
1365
|
-
* Pauses the video.
|
1366
|
-
* If this is called and the video’s state is “playing,”
|
1367
|
-
* it’s expected that it will change to “paused.”
|
1368
|
-
* @returns {Promise<void>}
|
1369
|
-
*/
|
1370
|
-
public async pause(): Promise<void> {
|
1371
|
-
return this.api?._impl.pause();
|
1372
|
-
}
|
1373
|
-
|
1374
|
-
/**
|
1375
|
-
* Plays the video.
|
1376
|
-
* If this is called, it is expected that the state will change to “playing.”
|
1377
|
-
* @returns {Promise<void>}
|
1378
|
-
*/
|
1379
|
-
public async play(): Promise<void> {
|
1380
|
-
return this.api?._impl.play();
|
1381
|
-
}
|
1382
|
-
|
1383
|
-
/**
|
1384
|
-
* Attempt to enter fullscreen mode.
|
1385
|
-
* @returns {Promise<void>}
|
1386
|
-
* @see https://wistia.com/support/developers/player-api#requestfullscreen
|
1387
|
-
*/
|
1388
|
-
public async requestFullscreen(): Promise<void> {
|
1389
|
-
return this.api?._impl.requestFullscreen();
|
1390
|
-
}
|
1391
|
-
|
1392
|
-
// --------------------------------------------------
|
1393
|
-
// Custom element lifecycle methods
|
1394
|
-
// --------------------------------------------------
|
1395
|
-
|
1396
|
-
/**
|
1397
|
-
* Called when an observed attribute has been added, removed, updated, or replaced.
|
1398
|
-
* Also called for initial values when an element is created by the parser, or upgraded.
|
1399
|
-
* Note: only attributes listed in the observedAttributes property will receive this callback.
|
1400
|
-
* @param {string} name - The name of the attribute that changed.
|
1401
|
-
* @param {string} oldValue - The previous value of the attribute, or null if it was added for the first time.
|
1402
|
-
* @param {string} newValue - The new value of the attribute, or null if it was removed.
|
1403
|
-
* @returns {void}
|
1404
|
-
*/
|
1405
|
-
protected attributeChangedCallback(name: string, oldValue: string, newValue: string): void {
|
1406
|
-
// We need this to make sure we don't needlessly call api methods during initial component setup
|
1407
|
-
if (!this.#hasElementConnectedToDOM) {
|
1408
|
-
return;
|
1409
|
-
}
|
1410
|
-
|
1411
|
-
if (oldValue === newValue) {
|
1412
|
-
return;
|
1413
|
-
}
|
1414
|
-
|
1415
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
1416
|
-
if (oldValue === null && newValue === '') {
|
1417
|
-
return;
|
1418
|
-
}
|
1419
|
-
|
1420
|
-
// Attribute names must match their corresponding property names (kebab-case -> camelCase)
|
1421
|
-
// So the player-color attribute maps to the playerColor property
|
1422
|
-
this[this.#kebabToCamelCase(name)] = newValue;
|
1423
|
-
}
|
1424
|
-
|
1425
|
-
protected connectedCallback(): void {
|
1426
|
-
const mediaId = this.getAttribute('media-id');
|
1427
|
-
if (mediaId == null) {
|
1428
|
-
throw new Error('media-id attribute is required');
|
1429
|
-
}
|
1430
|
-
|
1431
|
-
const options: DynamicImportOptions = {};
|
1432
|
-
|
1433
|
-
if (this.#getValueFromAttribute('embed-host') !== null) {
|
1434
|
-
options.host = this.embedHost;
|
1435
|
-
}
|
1436
|
-
|
1437
|
-
// if we're coming from a legacy E-v1.js embed, it is likely to already have JSONP on the page.
|
1438
|
-
// use the old init flow.
|
1439
|
-
if (this.useWebComponent) {
|
1440
|
-
const embedOptions = this.#getEmbedOptionsFromAttributes();
|
1441
|
-
|
1442
|
-
// Create and save the public api instance
|
1443
|
-
this.#initPublicApi(mediaId, { ...embedOptions, container: this.id });
|
1444
|
-
} else {
|
1445
|
-
// Sometimes if an attribute is set on the player, we want to do something immediately
|
1446
|
-
this.#runMethodsFromAttributes();
|
1447
|
-
|
1448
|
-
const domOptions = Object.fromEntries(
|
1449
|
-
Object.entries(this.attributes).map(([, value]) => [
|
1450
|
-
this.#kebabToCamelCase(value.name),
|
1451
|
-
value.value,
|
1452
|
-
]),
|
1453
|
-
);
|
1454
|
-
setEmbedOptionStore(`__${this.id}_dom_options__`, domOptions);
|
1455
|
-
|
1456
|
-
this.importMediaData(mediaId, options)
|
1457
|
-
.then((module: PublicApiOptions) => {
|
1458
|
-
const { mediaData } = module;
|
1459
|
-
this.#mediaDataServerJson = mediaData;
|
1460
|
-
|
1461
|
-
// Create and save the public api instance
|
1462
|
-
this.#initPublicApi(mediaId, {
|
1463
|
-
mediaData: this.#mediaDataConfig,
|
1464
|
-
});
|
1465
|
-
})
|
1466
|
-
.catch((error: Error) => {
|
1467
|
-
throw new Error(error.message);
|
1468
|
-
});
|
1469
|
-
}
|
1470
|
-
|
1471
|
-
// Add our responsive embed template to the shadow DOM
|
1472
|
-
if (this.shadowRoot) {
|
1473
|
-
this.shadowRoot.appendChild(this.#createEmbedTemplate().content.cloneNode(true));
|
1474
|
-
}
|
1475
|
-
|
1476
|
-
this.#hasElementConnectedToDOM = true;
|
1477
|
-
}
|
1478
|
-
|
1479
|
-
// --------------------------------------------------
|
1480
|
-
// Private methods
|
1481
|
-
// --------------------------------------------------
|
1482
|
-
|
1483
|
-
/**
|
1484
|
-
* Creates a template for the embed code
|
1485
|
-
* @returns {HTMLTemplateElement}
|
1486
|
-
*/
|
1487
|
-
#createEmbedTemplate(): HTMLTemplateElement {
|
1488
|
-
const template = document.createElement('template');
|
1489
|
-
|
1490
|
-
// web components always default to display: inline, which we don't want.
|
1491
|
-
template.innerHTML = /* html */ `
|
1492
|
-
<style>
|
1493
|
-
:host {
|
1494
|
-
display: block;
|
1495
|
-
}
|
1496
|
-
</style>
|
1497
|
-
`;
|
1498
|
-
|
1499
|
-
return template;
|
1500
|
-
}
|
1501
|
-
|
1502
|
-
/**
|
1503
|
-
* Gets the embed options from the element's attributes
|
1504
|
-
* @returns {Record<string, boolean | number | object | string | null>}
|
1505
|
-
*/
|
1506
|
-
#getEmbedOptionsFromAttributes(): Record<string, boolean | number | object | string | null> {
|
1507
|
-
return WistiaPlayer.observedAttributes.reduce(
|
1508
|
-
(acc: Record<string, boolean | number | object | string | null>, attr) => {
|
1509
|
-
// Automatically convert kebab-case attributes to camelCase embed options
|
1510
|
-
acc[this.#kebabToCamelCase(attr)] = this.#getValueFromAttribute(attr);
|
1511
|
-
|
1512
|
-
// Add any additional legacy embed options which don't exist in Aurora
|
1513
|
-
acc.videoFoam = !(this.style.width || this.style.height);
|
1514
|
-
|
1515
|
-
return acc;
|
1516
|
-
},
|
1517
|
-
{},
|
1518
|
-
);
|
1519
|
-
}
|
1520
|
-
|
1521
|
-
/**
|
1522
|
-
* Gets the value of an attribute if it exists, returns null if not
|
1523
|
-
* @param {string} name - Name of the attribute
|
1524
|
-
* @returns {boolean | string | null}
|
1525
|
-
*/
|
1526
|
-
#getValueFromAttribute(name: string): boolean | string | null {
|
1527
|
-
if (this.hasAttribute(name)) {
|
1528
|
-
// Boolean attributes are set to '' when they are present
|
1529
|
-
// so we need to convert them to true
|
1530
|
-
return this.getAttribute(name) === '' ? true : this.getAttribute(name);
|
1531
|
-
}
|
1532
|
-
|
1533
|
-
// If no attribute is present, return null instead of an explicit false
|
1534
|
-
// so our media data config doesn't get overridden
|
1535
|
-
return null;
|
1536
|
-
}
|
1537
|
-
|
1538
|
-
/**
|
1539
|
-
* Initializes the public api instance and sends a ready event
|
1540
|
-
* @param {number | string} mediaId - The media id
|
1541
|
-
* @param {EmbedOptions | PublicApiOptions | undefined} options - The public api options
|
1542
|
-
* @returns {void}
|
1543
|
-
*/
|
1544
|
-
#initPublicApi(
|
1545
|
-
mediaId: number | string,
|
1546
|
-
options: EmbedOptions | PublicApiOptions | undefined,
|
1547
|
-
): void {
|
1548
|
-
const { Wistia } = window;
|
1549
|
-
if (!Wistia?.PublicApi) {
|
1550
|
-
throw new Error('Wistia.PublicApi is not defined');
|
1551
|
-
}
|
1552
|
-
|
1553
|
-
this.#_api = new Wistia.PublicApi(mediaId, options) as PublicApi;
|
1554
|
-
|
1555
|
-
this.api?.ready(() => {
|
1556
|
-
this.dispatchEvent(new CustomEvent('ready', { detail: { mediaId, api: this.#_api } }));
|
1557
|
-
});
|
1558
|
-
}
|
1559
|
-
|
1560
|
-
/**
|
1561
|
-
* Checks if an attribute is present and is not set to false
|
1562
|
-
* @param {string} name - Name of the attribute
|
1563
|
-
* @returns {boolean}
|
1564
|
-
*/
|
1565
|
-
#isAttributePresentOrTrue(name: string): boolean {
|
1566
|
-
return (
|
1567
|
-
this.#getValueFromAttribute(name) !== 'false' && this.#getValueFromAttribute(name) !== null
|
1568
|
-
);
|
1569
|
-
}
|
1570
|
-
|
1571
|
-
/**
|
1572
|
-
* Takes a string in kebab-case and converts it to camelCase
|
1573
|
-
* This is a pretty generic helper function, so it could be moved to a utility file if needed
|
1574
|
-
* @param {string} kebabString - String in kebab-case
|
1575
|
-
* @returns {string}
|
1576
|
-
*/
|
1577
|
-
#kebabToCamelCase(kebabString: string): string {
|
1578
|
-
return kebabString.replace(/-./g, (word) => word[1].toUpperCase());
|
1579
|
-
}
|
1580
|
-
|
1581
|
-
/**
|
1582
|
-
* Runs any methods associated with set attributes when the element is connected to the DOM
|
1583
|
-
* @returns {void}
|
1584
|
-
* @private
|
1585
|
-
*/
|
1586
|
-
#runMethodsFromAttributes(): void {
|
1587
|
-
if (this.#getValueFromAttribute('email') !== null) {
|
1588
|
-
this.#updateEmail(this.#getValueFromAttribute('email') as string);
|
1589
|
-
}
|
1590
|
-
}
|
1591
|
-
|
1592
|
-
/**
|
1593
|
-
* Saves new email within localstorage and dispatches an emailchange event
|
1594
|
-
* @param {string} email - The new email
|
1595
|
-
* @returns {void}
|
1596
|
-
* @emits {EmailChangeEventData}
|
1597
|
-
* @private
|
1598
|
-
*/
|
1599
|
-
#updateEmail(email: string): void {
|
1600
|
-
updateWistiaLocalStorage((localStorage: WistiaLocalStorage) => {
|
1601
|
-
const updatedLocalStorage = { ...localStorage };
|
1602
|
-
updatedLocalStorage[this.#pageUrl] = {
|
1603
|
-
...localStorage[this.#pageUrl],
|
1604
|
-
trackEmail: email,
|
1605
|
-
};
|
1606
|
-
});
|
1607
|
-
this.dispatchEvent(
|
1608
|
-
new CustomEvent<EmailChangeEventData>('emailchange', {
|
1609
|
-
detail: { email },
|
1610
|
-
}),
|
1611
|
-
);
|
1612
|
-
}
|
1613
|
-
}
|
1614
|
-
|
1615
|
-
if (customElements.get('wistia-player') === undefined) {
|
1616
|
-
customElements.define('wistia-player', WistiaPlayer);
|
1617
|
-
}
|