Poster image fix (fixes #1763)
This commit is contained in:
@ -38,14 +38,12 @@ const media = {
|
||||
// Wrap the video in a container
|
||||
wrap(this.media, this.elements.wrapper);
|
||||
|
||||
// Faux poster container
|
||||
if (this.isEmbed) {
|
||||
this.elements.poster = createElement('div', {
|
||||
class: this.config.classNames.poster,
|
||||
});
|
||||
// Poster image container
|
||||
this.elements.poster = createElement('div', {
|
||||
class: this.config.classNames.poster,
|
||||
});
|
||||
|
||||
this.elements.wrapper.appendChild(this.elements.poster);
|
||||
}
|
||||
this.elements.wrapper.appendChild(this.elements.poster);
|
||||
}
|
||||
|
||||
if (this.isHTML5) {
|
||||
|
@ -114,10 +114,10 @@ const vimeo = {
|
||||
// Inject the package
|
||||
const { poster } = player;
|
||||
if (premium) {
|
||||
iframe.setAttribute('poster', poster);
|
||||
iframe.setAttribute('data-poster', poster);
|
||||
player.media = replaceElement(iframe, player.media);
|
||||
} else {
|
||||
const wrapper = createElement('div', { class: player.config.classNames.embedContainer, poster });
|
||||
const wrapper = createElement('div', { class: player.config.classNames.embedContainer, 'data-poster': poster });
|
||||
wrapper.appendChild(iframe);
|
||||
player.media = replaceElement(wrapper, player.media);
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ const youtube = {
|
||||
// Get poster, if already set
|
||||
const { poster } = player;
|
||||
// Replace media element
|
||||
const container = createElement('div', { id, poster });
|
||||
const container = createElement('div', { id, 'data-poster': poster });
|
||||
player.media = replaceElement(container, player.media);
|
||||
|
||||
// Id to poster wrapper
|
||||
|
@ -886,7 +886,7 @@ class Plyr {
|
||||
return null;
|
||||
}
|
||||
|
||||
return this.media.getAttribute('poster');
|
||||
return this.media.getAttribute('poster') || this.media.getAttribute('data-poster');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -170,12 +170,7 @@ const ui = {
|
||||
}
|
||||
|
||||
// Set property synchronously to respect the call order
|
||||
this.media.setAttribute('poster', poster);
|
||||
|
||||
// HTML5 uses native poster attribute
|
||||
if (this.isHTML5) {
|
||||
return Promise.resolve(poster);
|
||||
}
|
||||
this.media.setAttribute('data-poster', poster);
|
||||
|
||||
// Wait until ui is ready
|
||||
return (
|
||||
|
Reference in New Issue
Block a user