Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
static fromUrl(videoSrc, scaleMode, crossorigin)
{
const video = document.createElement('video');
video.setAttribute('webkit-playsinline', '');
video.setAttribute('playsinline', '');
const url = Array.isArray(videoSrc) ? (videoSrc[0].src || videoSrc[0]) : (videoSrc.src || videoSrc);
if (crossorigin === undefined && url.indexOf('data:') !== 0)
{
video.crossOrigin = determineCrossOrigin(url);
}
else if (crossorigin)
{
video.crossOrigin = typeof crossorigin === 'string' ? crossorigin : 'anonymous';
}
// array of objects or strings
if (Array.isArray(videoSrc))
{
for (let i = 0; i < videoSrc.length; ++i)
{
video.appendChild(createSource(videoSrc[i].src || videoSrc[i], videoSrc[i].mime));
}
}
// single object or string
else
static crossOrigin(element, url, crossorigin)
{
if (crossorigin === undefined && url.indexOf('data:') !== 0)
{
element.crossOrigin = determineCrossOrigin(url);
}
else if (crossorigin !== false)
{
element.crossOrigin = typeof crossorigin === 'string' ? crossorigin : 'anonymous';
}
}