Skip to content

Commit

Permalink
fix(FEC-14248): shouldAddKs to be based on if the session contains ks (
Browse files Browse the repository at this point in the history
…#916)

### Description of the Changes

shouldAddKs to be based on if the session contains ks instead of
session.isAnonymous === false

Related PR: kaltura/playkit-js-providers#259

[FEC-14248](https://kaltura.atlassian.net/browse/FEC-14248)


[FEC-14248]:
https://kaltura.atlassian.net/browse/FEC-14248?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

---------

Co-authored-by: Roee Dean <[email protected]>
  • Loading branch information
roeedean and Roee Dean authored Feb 10, 2025
1 parent 2fd2887 commit de71d11
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
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

0 comments on commit de71d11

Please sign in to comment.