Skip to content

Commit e89ef41

Browse files
committed
Fix formatting issue on generate_key_request.ts
1 parent bc2ab3d commit e89ef41

1 file changed

Lines changed: 28 additions & 25 deletions

File tree

‎src/compat/eme/generate_key_request.ts‎

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -144,31 +144,34 @@ export default function generateKeyRequest(
144144
}
145145
const initDataType = initializationDataType ?? "";
146146
log.debug("DRM", "Calling generateRequest on the MediaKeySession");
147-
return session.generateRequest(initDataType, patchedInit).catch((error) => {
148-
if (initDataType !== "" || !(error instanceof TypeError)) {
149-
throw error;
150-
}
147+
return session
148+
.generateRequest(initDataType, patchedInit)
149+
.catch((error) => {
150+
if (initDataType !== "" || !(error instanceof TypeError)) {
151+
throw error;
152+
}
151153

152-
// On newer EME versions of the specification, the initialization data
153-
// type given to generateRequest cannot be an empty string (it returns
154-
// a rejected promise with a TypeError in that case).
155-
// Retry with a default "cenc" value for initialization data type if
156-
// we're in that condition.
157-
log.warn(
158-
"DRM",
159-
"error while calling `generateRequest` with an empty " +
160-
'initialization data type. Retrying with a default "cenc" value.',
161-
error,
154+
// On newer EME versions of the specification, the initialization data
155+
// type given to generateRequest cannot be an empty string (it returns
156+
// a rejected promise with a TypeError in that case).
157+
// Retry with a default "cenc" value for initialization data type if
158+
// we're in that condition.
159+
log.warn(
160+
"DRM",
161+
"error while calling `generateRequest` with an empty " +
162+
'initialization data type. Retrying with a default "cenc" value.',
163+
error,
164+
);
165+
return session.generateRequest("cenc", patchedInit);
166+
})
167+
.then(
168+
(result) => {
169+
log.debug("DRM", "generateRequest succeeded");
170+
return result;
171+
},
172+
(error: unknown) => {
173+
log.debug("DRM", "generateRequest failed");
174+
throw error;
175+
},
162176
);
163-
return session.generateRequest("cenc", patchedInit);
164-
}).then(
165-
(result) => {
166-
log.debug("DRM", "generateRequest succeeded");
167-
return result;
168-
},
169-
(error: unknown) => {
170-
log.debug("DRM", "generateRequest failed");
171-
throw error;
172-
},
173-
);
174177
}

0 commit comments

Comments
 (0)