1
0
mirror of https://github.com/videojs/video.js.git synced 2025-07-03 00:57:02 +02:00

Restore the original video tag attributes on a tech change

set attributes of video tag and not only values

add unsupported attribute to the video tag - test failing

helper to set attributes on an element from a map of values

dummy compare of html content with a sort of the attributes

ignore html attributes order for comparition

save original tag attributes

restore original tag attributes n creation and overwrite if required by settings

replace object.keys with vjs.obj.each for ie<9

fix spacing

API consistency, getAttributeValues renamed to getElementAttributes

clear variable naming

move setElementAttributes close to getElementAttributes
This commit is contained in:
Steve Heffernan
2014-08-04 15:12:17 -07:00
parent 403afcf57d
commit b3bbb17dd4
6 changed files with 98 additions and 18 deletions

View File

@ -81,10 +81,13 @@ vjs.Html5.prototype.createEl = function(){
el = clone;
player.tag = null;
} else {
el = vjs.createEl('video', {
id:player.id() + '_html5_api',
className:'vjs-tech'
});
el = vjs.createEl('video', {});
vjs.setElementAttributes(el,
vjs.obj.merge(player.tagAttributes||{}, {
id:player.id() + '_html5_api',
'class':'vjs-tech'
})
);
}
// associate the player with the new tag
el['player'] = player;
@ -93,12 +96,14 @@ vjs.Html5.prototype.createEl = function(){
}
// Update specific tag settings, in case they were overridden
var attrs = ['autoplay','preload','loop','muted'];
for (var i = attrs.length - 1; i >= 0; i--) {
var attr = attrs[i];
if (player.options_[attr] !== null) {
el[attr] = player.options_[attr];
var settingsAttrs = ['autoplay','preload','loop','muted'];
for (var i = settingsAttrs.length - 1; i >= 0; i--) {
var attr = settingsAttrs[i];
var overwriteAttrs = {};
if (typeof player.options_[attr] !== 'undefined') {
overwriteAttrs[attr] = player.options_[attr];
}
vjs.setElementAttributes(el, overwriteAttrs);
}
return el;