Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(FEC-8298): SOURCE_SELECTED event triggered before the UI ready when the source provided manually #129

Merged
merged 2 commits into from
Jan 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/kaltura-player.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,16 @@ class KalturaPlayer extends FakeEventTarget {
constructor(options: KPOptionsObject) {
super();
this._eventManager = new EventManager();
this._localPlayer = loadPlayer(options);
const {sources} = options;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what happens if sources doesn't exist? what is the value?

Copy link
Contributor Author

@yairans yairans Jan 24, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have default sources object

const noSourcesOptions = Utils.Object.mergeDeep({}, options, {sources: null});
this._localPlayer = loadPlayer(noSourcesOptions);
this._logger = getLogger('KalturaPlayer' + Utils.Generator.uniqueId(5));
this._uiWrapper = new UIWrapper(this, options);
this._provider = new Provider(options.provider, __VERSION__);
this._playlistManager = new PlaylistManager(this, options);
this._playlistManager.configure(options.playlist);
Object.values(CoreEventType).forEach(coreEvent => this._eventManager.listen(this._localPlayer, coreEvent, e => this.dispatchEvent(e)));
this._localPlayer.configure({sources});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check if sources exist, don't call if it's null/undefined

}

loadMedia(mediaInfo: ProviderMediaInfoObject): Promise<*> {
Expand Down
19 changes: 19 additions & 0 deletions test/src/setup.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,23 @@ describe('setup', function() {
kalturaPlayer = setup(config);
kalturaPlayer.textStyle.should.deep.equal(textStyle);
});

it('should configure sources', function(done) {
const url = 'http://cfvod.kaltura.com/pd/p/2196781/sp/219678100/serveFlavor/entryId/1_afvj3z0u/v/1/flavorId/1_vpmhfzgl/name/a.mp4';
config.sources = {
progressive: [
{
id: 'id',
mimetype: 'video/mp4',
url
}
]
};
kalturaPlayer = setup(config);
kalturaPlayer.load();
kalturaPlayer.ready().then(() => {
kalturaPlayer.src.should.equal(url);
done();
});
});
});