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-14248): shouldAddKs to be based on if the session contains ks #916

Merged
merged 2 commits into from
Feb 10, 2025
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
2 changes: 1 addition & 1 deletion src/kaltura-player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ export class KalturaPlayer extends FakeEventTarget {
}

public shouldAddKs(mediaConfig?: KPMediaConfig): boolean {
return !!(this.config?.provider?.loadThumbnailWithKs && (mediaConfig || this.config)?.session?.isAnonymous === false);
return !!(this.config?.provider?.loadThumbnailWithKs && (mediaConfig || this.config)?.session?.ks);
}

public getMediaInfo(): ProviderMediaInfoObject {
Expand Down
16 changes: 13 additions & 3 deletions tests/e2e/kaltura-player.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,16 +251,26 @@ describe('kaltura player api', () => {
kalturaPlayer.shouldAddKs().should.equals(false);
});
});
describe('anonymous session', () => {
it('should return false for anonymous session when called without mediaConfig parameter', () => {
describe('session without ks', () => {
it('should return false for session without ks when called without mediaConfig parameter', () => {
kalturaPlayer.setMedia(MediaMockData.MediaConfig['0_wifqaipd']);
kalturaPlayer.shouldAddKs().should.equals(false);
});
it('should return false for anonymous session when called with mediaConfig parameter', () => {
it('should return false for session without ks when called with mediaConfig parameter', () => {
kalturaPlayer.setMedia(mediaWithUserSession);
kalturaPlayer.shouldAddKs(MediaMockData.MediaConfig['0_wifqaipd']).should.equals(false);
});
});
describe('session with ks', () => {
it('should return true for session with ks when called without mediaConfig parameter', () => {
kalturaPlayer.setMedia(MediaMockData.MediaConfig['0_nwkp7jtx']);
kalturaPlayer.shouldAddKs().should.equals(true);
});
it('should return true for session with ks when called with mediaConfig parameter', () => {
kalturaPlayer.setMedia(mediaWithUserSession);
kalturaPlayer.shouldAddKs(MediaMockData.MediaConfig['0_nwkp7jtx']).should.equals(true);
});
});
describe('user session', () => {
it('should return true for user session when called without mediaConfig parameter', () => {
kalturaPlayer.setMedia(mediaWithUserSession);
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/mock-data/media.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const MediaConfig = {
isAnonymous: true,
partnerId: 1091,
uiConfId: 15215933,
ks: 'OGViNDhkZGI4ZTM1ODAzYWVhYTk0OTZlMzcwMmZmZjUzMjZkNGFkMnwxMDkxOzEwOTE7MTU0NDY5MTMwODswOzE1NDQ2MDQ5MDguNTg4NDswO3ZpZXc6Kix3aWRnZXQ6MTs7'
ks: ''
},
sources: {
hls: [
Expand Down