Your issue broken JavaScript syntax. For-loop needs braces around it and if possible, use them always with e.g. ifs. I recommend using JSHint to test your code for syntax errors at least every now and then.
I modified your source a bit, try this:
function () {
/*try {*/
var v = '';
// HTML5 video
if(document.getElementsByTagName('video').length) {
v += 'video,';
}
// Youtube video
var i = document.getElementsByTagName('iframe');
for(var x = 0, l = i.length; x < l; x++) {
if(/youtube\.com\/embed/.test(i[x].src) && !/youtube/.test(v)) {
v += 'youtube,';
}
// Limelight video
}
if(document.getElementsByClassName('LimelightEmbeddedPlayer')) {
v += 'limelight,';
}
return v.length ? v.slice(0, -1) : v;
/*} catch(e) {
dataLayer.push({
'event': 'error',
'action': 'GTM',
'label': '713-Video Type:' + e.message
});
}*/
}