Skip to content

Commit

Permalink
fix: poster image for raw URLs (#573)
Browse files Browse the repository at this point in the history
  • Loading branch information
tsi authored Mar 7, 2024
1 parent 4fe8dfc commit a24d584
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/plugins/cloudinary/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,10 @@ class CloudinaryContext {

const refresh = () => {
const src = this.source();
const { posterColor } = this.player.cloudinary.posterOptions();
if (posterColor) {
this.disablePoster(posterColor);
const posterOptions = Object.assign({}, this.player.cloudinary.posterOptions(), src.getInitOptions().poster);

if (posterOptions.posterColor) {
this.disablePoster(posterOptions.posterColor);
} else if (src.poster()) {
this.player.poster(src.poster().url());
}
Expand Down Expand Up @@ -298,14 +299,13 @@ class CloudinaryContext {

const posterOptionsForCurrent = () => {
const opts = assign({}, this.posterOptions());
if (opts.transformation) {
if ((opts.transformation.width || opts.transformation.height) && !opts.transformation.crop) {
opts.transformation.crop = 'scale';
}
}

opts.transformation = opts.transformation || {};

if ((opts.transformation.width || opts.transformation.height) && !opts.transformation.crop) {
opts.transformation.crop = 'scale';
}

// Set poster dimensions to player actual size.
// (unless they were explicitly set via `posterOptions`)
const playerEl = this.player.el();
Expand Down
4 changes: 4 additions & 0 deletions src/plugins/cloudinary/models/video-source/video-source.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,10 @@ class VideoSource extends BaseSource {

({ publicId, options } = normalizeOptions(publicId, options, { tolerateMissingId: true }));

if (!publicId && this.isRawUrl) {
return null;
}

if (!publicId) {
publicId = this.publicId();
options = assign({}, options, DEFAULT_POSTER_PARAMS);
Expand Down

0 comments on commit a24d584

Please sign in to comment.