UNPKG

@svta/common-media-library

Version:
27 lines 865 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.toBigEndianKeyId = toBigEndianKeyId; /** * Converts a 16-byte key ID from little-endian to big-endian format. * * @param keyId - The little-endian key ID to convert. * @returns The big-endian representation of the key ID. * * @group DRM * @beta * * @example * {@includeCode ../../../test/drm/playready/toBigEndianKeyId.test.ts#example} */ function toBigEndianKeyId(keyId) { if (keyId.byteLength !== 16) { return keyId; } const buffer = keyId.slice(0); const dataView = new DataView(buffer); dataView.setUint32(0, dataView.getUint32(0, true), false); dataView.setUint16(4, dataView.getUint16(4, true), false); dataView.setUint16(6, dataView.getUint16(6, true), false); return buffer; } //# sourceMappingURL=toBigEndianKeyId.js.map