diff --git a/.eslintrc b/.eslintrc index b518529..1723a0b 100644 --- a/.eslintrc +++ b/.eslintrc @@ -15,6 +15,7 @@ "rules": { "max-len": ["error", { "code": 150, "ignoreComments": true, "ignoreStrings": true, "ignoreTemplateLiterals": true }], "@typescript-eslint/explicit-module-boundary-types": "off", - "@typescript-eslint/ban-ts-comment": "off" + "@typescript-eslint/ban-ts-comment": "off", + "no-constant-condition": "warn" } } diff --git a/src/anvato/AnvatoDrmFairplayContentProtectionIntegration.ts b/src/anvato/AnvatoDrmFairplayContentProtectionIntegration.ts index 1da183b..2b3188b 100644 --- a/src/anvato/AnvatoDrmFairplayContentProtectionIntegration.ts +++ b/src/anvato/AnvatoDrmFairplayContentProtectionIntegration.ts @@ -50,7 +50,7 @@ export class AnvatoDrmFairplayContentProtectionIntegration implements ContentPro return request; } - onLicenseResponse?(response: LicenseResponse): MaybeAsync { + onLicenseResponse(response: LicenseResponse): MaybeAsync { const responseObject = fromUint8ArrayToObject(response.body); return fromBase64StringToUint8Array(responseObject.ckc); } diff --git a/src/anvato/AnvatoDrmFairplayContentProtectionIntegration.web.ts b/src/anvato/AnvatoDrmFairplayContentProtectionIntegration.web.ts index c2d3aaf..aae3cfc 100644 --- a/src/anvato/AnvatoDrmFairplayContentProtectionIntegration.web.ts +++ b/src/anvato/AnvatoDrmFairplayContentProtectionIntegration.web.ts @@ -84,7 +84,7 @@ export class AnvatoDrmFairplayContentProtectionIntegration implements ContentPro } } - onLicenseResponse?(response: LicenseResponse): MaybeAsync { + onLicenseResponse(response: LicenseResponse): MaybeAsync { throw new AnvatoError('Error during FairPlay license request', 'Response already processed', response.url); } @@ -106,16 +106,12 @@ async function readStreamAsArrayBuffer(readable: ReadableStream): Pr const chunks: Uint8Array[] = []; let totalLength = 0; - async function readNextChunk() { + while (true) { const { done, value } = await reader.read(); - if (done) return; + if (done) break; chunks.push(value); totalLength += value.length; - - // Read the next chunk - await readNextChunk(); } - await readNextChunk(); // Concatenate all chunks into a single Uint8Array const result = new Uint8Array(totalLength); diff --git a/src/anvato/AnvatoDrmWidevineContentProtectionIntegration.ts b/src/anvato/AnvatoDrmWidevineContentProtectionIntegration.ts index adebaa8..c8e3c83 100644 --- a/src/anvato/AnvatoDrmWidevineContentProtectionIntegration.ts +++ b/src/anvato/AnvatoDrmWidevineContentProtectionIntegration.ts @@ -38,7 +38,7 @@ export class AnvatoDrmWidevineContentProtectionIntegration implements ContentPro return request; } - onLicenseResponse?(response: LicenseResponse): MaybeAsync { + onLicenseResponse(response: LicenseResponse): MaybeAsync { const responseObject = fromUint8ArrayToObject(response.body); return fromBase64StringToUint8Array(responseObject.ckc); } diff --git a/src/verimatrixcoredrm/VerimatrixCoreDrmFairplayContentProtectionIntegration.ts b/src/verimatrixcoredrm/VerimatrixCoreDrmFairplayContentProtectionIntegration.ts index a99d26e..bcdc233 100644 --- a/src/verimatrixcoredrm/VerimatrixCoreDrmFairplayContentProtectionIntegration.ts +++ b/src/verimatrixcoredrm/VerimatrixCoreDrmFairplayContentProtectionIntegration.ts @@ -28,7 +28,7 @@ export class VerimatrixCoreDrmFairplayContentProtectionIntegration implements Co return request; } - onLicenseResponse?(response: LicenseResponse): MaybeAsync { + onLicenseResponse(response: LicenseResponse): MaybeAsync { const responseObject = fromUint8ArrayToObject(response.body); return fromBase64StringToUint8Array(responseObject.ckc); }