The `h264-profile-level-id` package is a TypeScript utility designed to accurately process H.264 `profile-level-id` values, which are critical in WebRTC SDP negotiation. It is based on the robust C++ implementation found in Google's `libwebrtc` project, ensuring compatibility and correctness with widely used WebRTC stacks. Currently at version `2.3.2`, the library maintains active development, aligning with updates in the WebRTC ecosystem. Its primary differentiator is its direct lineage from `libwebrtc`, providing a reliable, type-safe API for parsing, serializing, and comparing H.264 profile and level identifiers, including specialized functions for SDP parameter handling. It supports Node.js environments `>=20` and ships with comprehensive TypeScript types, making it suitable for modern JavaScript and TypeScript projects that interact with H.264 video codecs.
npm install h264-profile-level-idVerified import paths — ran on the pinned version, not inferred.
Demonstrates creating, converting, parsing, and comparing H264 profile-level-id values, including SDP parameter handling.
Use conditional checks (e.g., `if (parsedId) { ... }`) or nullish coalescing operators (`??`) to handle potential `undefined` return values.Explicitly check for the presence of the `'profile-level-id'` key if distinguishing between missing and invalid input is critical. Always check for `undefined` return.
Ensure your project is configured for ESM (`"type": "module"` in `package.json`) and use `import` statements. For CJS, dynamic `import()` or transpilation might be required, but it's not the primary intended usage.
Always check the return value of parsing functions before attempting to access its properties, as they return `undefined` for invalid inputs. For example: `const parsed = parseProfileLevelId(str); if (parsed) { console.log(parsed.profile); }`Configure your project to use ES Modules by adding `"type": "module"` to your `package.json`, or if strictly in a CJS file, use dynamic `import('h264-profile-level-id').then(...)`.No dependency data recorded yet.