mirror of
https://github.com/videojs/video.js.git
synced 2025-02-16 12:23:54 +02:00
Merge pull request #426 from dmlap/feature/poster-attribute
Do not remove poster attribute when creating the player
This commit is contained in:
commit
496fa982e0
@ -131,8 +131,6 @@ vjs.Player.prototype.createEl = function(){
|
||||
// Original tag settings stored in options
|
||||
// now remove immediately so native controls don't flash.
|
||||
tag.removeAttribute('controls');
|
||||
// Poster will be handled by a manual <img>
|
||||
tag.removeAttribute('poster');
|
||||
// Remove width/height attrs from tag so CSS can make it 100% width/height
|
||||
tag.removeAttribute('width');
|
||||
tag.removeAttribute('height');
|
||||
|
@ -22,6 +22,10 @@ vjs.MediaFaker.prototype.createEl = function(){
|
||||
var el = goog.base(this, 'createEl', 'div', {
|
||||
className: 'vjs-tech'
|
||||
});
|
||||
if (this.player().poster()) {
|
||||
// transfer the poster image to mimic HTML
|
||||
el.poster = this.player().poster();
|
||||
}
|
||||
|
||||
vjs.insertFirst(el, this.player_.el());
|
||||
|
||||
|
@ -181,6 +181,21 @@ test('should accept options from multiple sources and override in correct order'
|
||||
player.dispose();
|
||||
});
|
||||
|
||||
test('should transfer the poster attribute unmodified', function(){
|
||||
var tag, fixture, poster, player;
|
||||
poster = 'http://example.com/poster.jpg';
|
||||
tag = PlayerTest.makeTag();
|
||||
tag.setAttribute('poster', poster);
|
||||
fixture = document.getElementById('qunit-fixture');
|
||||
|
||||
fixture.appendChild(tag);
|
||||
player = new vjs.Player(tag, {
|
||||
'techOrder': ['mediaFaker']
|
||||
});
|
||||
|
||||
equal(player.tech.el().poster, poster, 'the poster attribute should not be removed');
|
||||
});
|
||||
|
||||
test('should load a media controller', function(){
|
||||
var player = PlayerTest.makePlayer({
|
||||
preload: 'none',
|
||||
|
Loading…
x
Reference in New Issue
Block a user