Skip to content

Commit

Permalink
fix(FEC-11695,FEC-11698): player thumbnail stripe URL changes accordi…
Browse files Browse the repository at this point in the history
…ng to player size (#507)

build the thumbnail url from provider response before the poster manipulation

Solves FEC-11695, FEC-11698
  • Loading branch information
yairans authored Nov 17, 2021
1 parent aad1d32 commit 50a02b0
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/kaltura-player.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,15 +165,15 @@ class KalturaPlayer extends FakeEventTarget {
Object.keys(this._pluginsConfig).forEach(name => {
playerConfig.plugins[name] = playerConfig.plugins[name] || {};
});
if (!hasYoutubeSource(sources)) {
this._thumbnailManager = new ThumbnailManager(this, this.config.ui, mediaConfig);
}
addKalturaPoster(sources, mediaConfig.sources, this._localPlayer.dimensions);
addKalturaParams(this, {...playerConfig, sources});
const playback = maybeSetStreamPriority(this, sources);
if (playback) {
playerConfig.playback = playback;
}
if (!hasYoutubeSource(sources)) {
this._thumbnailManager = new ThumbnailManager(this, this.config.ui, mediaConfig);
}
this.configure({...playerConfig, sources});
}

Expand Down
52 changes: 52 additions & 0 deletions test/src/common/thumbnail-manager.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import {MediaType} from '@playkit-js/playkit-js';
import {DefaultThumbnailConfig, ThumbnailManager} from '../../../src/common/thumbnail-manager';
import * as TestUtils from '../utils/test-utils';
import {setup} from '../../../src';

describe('ThumbnailManager', () => {
let thumbnailManager, fakePlayer, fakeMediaConfig, sandbox;
Expand Down Expand Up @@ -149,4 +151,54 @@ describe('ThumbnailManager', () => {
config.thumbsSlices.should.equal(200);
config.thumbsWidth.should.equal(300);
});

describe('Poster Integration', function () {
const targetId = 'player-placeholder_ovp/thumbnail.spec';

let config, kalturaPlayer;
const myCustomPosterUrl = 'https://www.elastic.co/assets/bltada7771f270d08f6/enhanced-buzz-1492-1379411828-15.jpg';
const entryId = '0_wifqaipd';
const partnerId = 1091;
const env = {
cdnUrl: 'http://qa-apache-php7.dev.kaltura.com/',
serviceUrl: 'http://qa-apache-php7.dev.kaltura.com/api_v3'
};

before(function () {
TestUtils.createElement('DIV', targetId);
});

beforeEach(function () {
config = {
targetId: targetId,
provider: {
partnerId: partnerId,
env: env
},
sources: {}
};
});

afterEach(function () {
kalturaPlayer.destroy();
TestUtils.removeVideoElementsFromTestPage();
});

after(function () {
TestUtils.removeElement(targetId);
});

it('should create thumbnail url from provider poster not from configured poster', function (done) {
config.sources.poster = myCustomPosterUrl;
kalturaPlayer = setup(config);
kalturaPlayer.loadMedia({entryId: entryId}).then(() => {
try {
kalturaPlayer.getThumbnail().should.be.exist;
done();
} catch (e) {
done(e);
}
});
});
});
});

0 comments on commit 50a02b0

Please sign in to comment.