Skip to content

Commit

Permalink
feat: removed publish validation check if a video is DRM protected
Browse files Browse the repository at this point in the history
[AB#45197]
  • Loading branch information
AxTrusov authored and yohanAnushka committed Aug 13, 2024
1 parent 0c43d43 commit cdabe86
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 55 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ export async function validateChannel(
publishDto.placeholder_video_id
? [{ videoId: publishDto.placeholder_video_id }]
: [],
publishDto.is_drm_protected,
true,
),
isManagedServiceEnabled(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ export async function validatePlaylist(
config.videoServiceBaseUrl,
jwtToken,
selectedVideos,
channel.is_drm_protected,
false,
),
isManagedServiceEnabled(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ describe('getValidationAndVideos', () => {
authToken,
[],
true,
true,
);

// Assert
Expand All @@ -88,7 +87,6 @@ describe('getValidationAndVideos', () => {
endpoint,
authToken,
[],
true,
false,
);

Expand All @@ -113,7 +111,6 @@ describe('getValidationAndVideos', () => {
authToken,
[{ videoId: videoId1 }],
true,
true,
);

// Assert
Expand Down Expand Up @@ -141,7 +138,6 @@ describe('getValidationAndVideos', () => {
authToken,
[{ videoId: videoId1 }],
true,
true,
);

// Assert
Expand All @@ -163,7 +159,6 @@ describe('getValidationAndVideos', () => {
authToken,
[{ videoId: videoId1 }, { videoId: videoId2 }],
false,
false,
);

// Assert
Expand All @@ -183,13 +178,7 @@ describe('getValidationAndVideos', () => {

// Act
const error = await rejectionOf(
getValidationAndVideos(
endpoint,
authToken,
[{ videoId: '1' }],
false,
true,
),
getValidationAndVideos(endpoint, authToken, [{ videoId: '1' }], true),
);

// Assert
Expand Down Expand Up @@ -218,13 +207,7 @@ describe('getValidationAndVideos', () => {

// Act
const error = await rejectionOf(
getValidationAndVideos(
endpoint,
authToken,
[{ videoId: '1' }],
false,
true,
),
getValidationAndVideos(endpoint, authToken, [{ videoId: '1' }], true),
);

// Assert
Expand Down Expand Up @@ -252,13 +235,7 @@ describe('getValidationAndVideos', () => {

// Act
const error = await rejectionOf(
getValidationAndVideos(
endpoint,
authToken,
[{ videoId: '1' }],
false,
true,
),
getValidationAndVideos(endpoint, authToken, [{ videoId: '1' }], true),
);

// Assert
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ export const getValidationAndVideos = async (
videoServiceBaseUrl: string,
authToken: string,
selectedVideos: SelectedVideo[],
isDrmEnabled: boolean,
exactlyOneVideo: boolean,
): Promise<{
videos: DetailedVideo[];
Expand Down Expand Up @@ -67,32 +66,19 @@ export const getValidationAndVideos = async (
continue;
}

if (gqlVideo.isProtected) {
if (isDrmEnabled) {
if (
gqlVideo.videoStreams.nodes
.filter(
(s) => s.type !== 'SUBTITLE' && s.type !== 'CLOSED_CAPTION',
)
.find((s) => !s.keyId)
) {
validations.push(
createValidationError(
`Video "${gqlVideo.title}" with ID ${gqlVideo.id} is protected but no key ids were found.`,
'VIDEOS',
source,
),
);
}
} else {
validations.push(
createValidationError(
`Video "${gqlVideo.title}" with ID ${gqlVideo.id} is DRM protected.`,
'VIDEOS',
source,
),
);
}
if (
gqlVideo.isProtected &&
gqlVideo.videoStreams.nodes
.filter((s) => s.type !== 'SUBTITLE' && s.type !== 'CLOSED_CAPTION')
.find((s) => !s.keyId)
) {
validations.push(
createValidationError(
`Video "${gqlVideo.title}" with ID ${gqlVideo.id} is protected but no key ids were found.`,
'VIDEOS',
source,
),
);
}

if (gqlVideo.outputFormat !== 'CMAF') {
Expand Down

0 comments on commit cdabe86

Please sign in to comment.