mirror of
https://github.com/videojs/video.js.git
synced 2025-01-25 11:13:52 +02:00
Do not remove poster attribute when creating the player
We use a div with a background image to simulate the poster image so that we can use a single poster implementation for flash and html. It may be desirable on some platforms to use the native poster image, however. On iPhones for instance, the simulated poster image covers up the native play button and can make it difficult to figure out where to touch to initiate playback. By keeping the poster attribute on the underlying video element, you can hide the simulated poster to get a native look-and-feel on that platform.
This commit is contained in:
parent
6bd4651767
commit
99a973e529
@ -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