Skip to content

Commit

Permalink
fix(SUP-45003): [IKEA Ingka] - past scheduled embedded entries will s…
Browse files Browse the repository at this point in the history
…how a wrong error message for V7 player (#245)

Issue:
There is no error message to scheduling error.

Fix:
The scheduling error doesn't return from BE with kalturaAccessControlBlockAction. there is not action only message. so in case there is no block action but there is schedule message, will throw scheduling message error.

Part of kaltura/playkit-js#805, kaltura/playkit-js-ui#970, kaltura/kaltura-player-js#897

Resolves SUP-45003
  • Loading branch information
Tzipi-kaltura authored Dec 25, 2024
1 parent aa19a38 commit 0a77464
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 15 deletions.
4 changes: 4 additions & 0 deletions src/k-provider/ovp/provider-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,10 @@ class OVPProviderParser {
return response.playBackContextResult.getBlockAction();
}

public static hasScheduledRestriction(response: OVPMediaEntryLoaderResponse): boolean {
return response.playBackContextResult.hasScheduledRestriction();
}

public static getErrorMessages(response: OVPMediaEntryLoaderResponse): Array<KalturaAccessControlMessage> {
return response.playBackContextResult.getErrorMessages();
}
Expand Down
5 changes: 5 additions & 0 deletions src/k-provider/ovp/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,11 @@ export default class OVPProvider extends BaseProvider<OVPProviderMediaInfoObject
messages: OVPProviderParser.getErrorMessages(response)
});
}
else if (OVPProviderParser.hasScheduledRestriction(response)) {
throw new Error(Error.Severity.CRITICAL, Error.Category.SERVICE, Error.Code.SCHEDULED_RESTRICTED, {
messages: OVPProviderParser.getErrorMessages(response)
});
}
const mediaEntry = OVPProviderParser.getMediaEntry(this.isAnonymous ? '' : this.ks, this.partnerId, this.uiConfId, response);
Object.assign(mediaConfig.sources, this._getSourcesObject(mediaEntry));
this._verifyMediaStatus(mediaEntry);
Expand Down
4 changes: 4 additions & 0 deletions src/k-provider/ovp/response-types/kaltura-playback-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ export class KalturaPlaybackContext extends ServiceResult {
return this.actions.find(action => action.type === KalturaRuleAction.Type.BLOCK);
}

public hasScheduledRestriction(): boolean {
return this.messages.some(message => message.code === KalturaRuleAction.Type.SCHEDULED_RESTRICTED);
}

public getErrorMessages(): Array<KalturaAccessControlMessage> {
return this.messages;
}
Expand Down
3 changes: 2 additions & 1 deletion src/k-provider/ovp/response-types/kaltura-rule-action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ export class KalturaRuleAction {
LIMIT_DELIVERY_PROFILES: 5,
SERVE_FROM_REMOTE_SERVER: 6,
REQUEST_HOST_REGEX: 7,
LIMIT_THUMBNAIL_CAPTURE: 8
LIMIT_THUMBNAIL_CAPTURE: 8,
SCHEDULED_RESTRICTED: 'SCHEDULED_RESTRICTED'
};

/**
Expand Down
5 changes: 5 additions & 0 deletions src/util/error/code.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ const Code: CodeType = {
*/
MEDIA_STATUS_NOT_READY: 2002,

/**
* The server responded with a scheduled restricted code
*/
SCHEDULED_RESTRICTED: 2003,

/**
* The provider is missing mandatory parameter/s
*/
Expand Down
16 changes: 2 additions & 14 deletions test/src/k-provider/ovp/be-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,13 +274,7 @@ const AnonymousMocEntryWithoutUIConfNoDrmData = {
}
],
actions: [],
messages: [
{
message: "Out of scheduling\nWe're sorry, this content is currently unavailable.",
code: 'SCHEDULED_RESTRICTED',
objectType: 'KalturaAccessControlMessage'
}
],
messages: [],
objectType: 'KalturaPlaybackContext'
},
{
Expand Down Expand Up @@ -957,13 +951,7 @@ const EntryWithUIConfNoDrmData = {
}
],
actions: [],
messages: [
{
message: "Out of scheduling\nWe're sorry, this content is currently unavailable.",
code: 'SCHEDULED_RESTRICTED',
objectType: 'KalturaAccessControlMessage'
}
],
messages: [],
objectType: 'KalturaPlaybackContext'
},
{
Expand Down

0 comments on commit 0a77464

Please sign in to comment.