701iframe.setAttribute('webkitAllowFullScreen', '');702iframe.setAttribute('mozallowfullscreen', '');703iframe.setAttribute('allowFullScreen', '');704iframe.innerHTML = "<p>Your browser don't support videos.</p>";705706return iframe;707}708709function t_videoprocessor__processVimeoVideo(el, params) {710var id = el.getAttribute('data-content-video-url-vimeo');711if (!id) {712el.style.backgroundImage = null;
return; } var noloop = params['video-noloop']; var hash = el.getAttribute('data-content-video-hash-vimeo') || ''; var url = t_videoprocessor__getIframeVideoUrl('vimeo', id, hash, noloop); var iframe = t_videoprocessor__getIframeHtml(url, params['cover-height']); if (!url) { el.style.backgroundImage = null; return; } el.style.backgroundImage = null; el.insertAdjacentElement('beforeend', iframe); t_onReady(function () { var elHeight = window.getComputedStyle(el).height || 0; t_videoprocessor__updateVideoHeight(el, elHeight, 'vimeo'); }); el.addEventListener( 'coverHeightUpdated', function () { var elHeight = window.getComputedStyle(el).height || 0; t_videoprocessor__updateVideoHeight(el, elHeight, 'vimeo'); }, { once: true } ); window.addEventListener( 'resize', t_throttle(function () { var elHeight = window.getComputedStyle(el).height || 0; t_videoprocessor__updateVideoHeight(el, elHeight, 'vimeo'); }, 100) );}/** * Process Rutube video * @param {HTMLElement} el - Element containing Rutube video * @param {Object} params - Options for video processing * @param {string} params ['cover-height'] - Video height * @param {boolean} params['video-noloop'] - Flag indicating whether to loop the video */function t_videoprocessor__processRutubeVideo(el, params) { var id = el.getAttribute('data-content-video-url-rutube'); if (!id) { el.style.backgroundImage = null; return; } var noloop = params['video-noloop']; var hash = el.getAttribute('data-content-video-hash-rutube') || ''; var url = t_videoprocessor__getIframeVideoUrl('rutube', id, hash, noloop); if (!url) { el.style.backgroundImage = null; return; } var iframe = t_videoprocessor__getIframeHtml(url, params['cover-height']); var autoplayInitiated = false; window.addEventListener('message', function (event) { if (!event) return; var message = ''; try { // event.data is not always json message = typeof event.data === 'string' ? JSON.parse(event.data) : event.data; } catch (error) { console.error(error); } if (!message.data) return; // Событие message также возвращает player:ready для других инициализирующихся видео, // добавляем проверку, что это конкретное видео, а не из другого блока if (message.type === 'player:ready' && iframe.src.indexOf(message.data.videoId) !== -1) { t_videoprocessor__doRutubeCommand(iframe, 'stop'); t_videoprocessor__doRutubeCommand(iframe, 'mute'); } else if (message.type === 'player:changeState' && message.data.state === 'buffering' && !autoplayInitiated) { autoplayInitiated = true; t_videoprocessor__doRutubeCommand(iframe, 'play'); } else if (