I am creating HTML Dom element through the Javascript that uses the VideoJs element creation but it does not work.
Same html code works in normal html file, but when creating through js it does not seem to get work.
let dom: DOMFactoryElement;
dom = {
tagName: 'div',
className: ['swiper-slide'],
children: [
{
tagName: 'div',
className: [
'swiper-zoom-container',
darkMode ? 'canon-bg--grey-darkest' : 'canon-bg--grey-lightest',
image.paddingReq ? 'py-3' : 'py-0',
image.paddingReq ? 'px-4' : 'px-0',
],
children: [
{
tagName: 'div',
className: ['snap-media', 'position-relative'],
attributes: { 'data-pure': '' },
children: [
{
tagName: 'div',
className: ['responsive-video__video-element', 'video-autoplay', 'h-100'],
children: [
{
tagName: 'div',
className: ['responsive-video__placeholder', 'responsive-video__placeholder--autoplay'],
attributes: {
'data-account-id': image?.accountId,
'data-player-id': image?.playerId,
'data-video-id': image?.videoId,
'data-poster': image?.stillImageUrl,
'data-loop': '',
},
},
],
},
{
tagName: 'div',
className: [
'position-absolute',
'snap-media-content',
'standard-article__media-hero__media-controls',
],
children: [
{
tagName: 'div',
className: 'snap-media__controls-list',
attributes: {
'data-control-audio': '',
'data-control-play': '',
},
},
],
},
],
},
],
},
],
};
const factory: DOMFactory = new DOMFactory(dom);
return factory.element;
This generate the html of the div as mentioned but nothing works, its just empty div with audio and player id etc given to it
and I received this error:
VIDEOJS: ERROR: TypeError: Cannot read properties of undefined (reading 'name')
at a.e [as getCustomDimensionValuesFromPlayer]