Add encoding jobs live command#9
Conversation
Add `bitmovin encoding jobs live <id>` to fetch live encoding details
(encoder IP, stream key, application) from
GET /v1/encoding/encodings/{id}/live. This is the single most-asked
question of a running live encoding (you need the encoder IP to point
your contribution encoder at it for SRT/RTMP push), and previously
required hand-rolling a curl call.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds a new CLI subcommand to retrieve live encoding connection details (encoder IP, stream key, application) for a running Bitmovin encoding via the GET /v1/encoding/encodings/{id}/live endpoint.
Changes:
- Introduces
bitmovin encoding jobs live <id>with human-readable output and--jsonsupport. - Adds Vitest coverage for normal output, the “no encoder IP yet” fallback, and JSON mode.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/commands/encoding/jobs/live.ts |
Implements the new encoding jobs live command and output formatting (human + JSON). |
test/commands/encoding-job.test.ts |
Extends the mocked API and adds tests for the new command’s output modes and fallback behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Useful command. A few notes:
|
lukaskroepfl
left a comment
There was a problem hiding this comment.
All three points addressed cleanly:
- Error matching robustness — the new
mentionsUnavailableLiveDetailsregex (\b(?:unavailable|not\s+(?:yet\s+)?available)\bplus a "live + details" predicate) plus theerrorCode/message normalization ([_-]+→ space, lowercase) widens the safety net considerably. Notably it now catches bothLIVE_ENCODING_DETAILS_UNAVAILABLEerrorCodes and "Live details … are unavailable" wording, with a regression test for the alternate-wording case. Still text-based rather than keyed on a stable numeric code, but the surface that has to break for this to silently regress is much smaller. outputDataadoption — display object built with placeholders,--fieldsfiltering test added, preamble routed viathis.log(which lands on stderr under--json). ✅- SDK typed return —
LiveEncodingfrom@bitmovin/api-sdkimported, cast removed from the call site. ✅
One small thing for follow-up (not blocking): in JSON mode, queued encodings now serialize the human placeholders ("encoderIp": "(not yet running)") into the JSON. Scripts that key off data.encoderIp truthiness used to get undefined for unavailable; now they get a non-empty string. If you'd rather have null in JSON and the placeholder only in the table render, you'd need to branch on jsonMode when building output. Up to you — the unified shape is also a defensible choice.
Approving.
|
Very nice! Ty! |
CMThF
left a comment
There was a problem hiding this comment.
Dug a little deeper through it and tried it in my skills. we still have gaps for live:
- redundantRtmp: stream keys live on staticIngestPoints, exposed via live.stream_keys.list?assignedEncodingId=…, not live.get.
- SRT: needs to walk streams.list → inputs.srt.get to surface mode/host/port/path.
can we add those quickly?
Stream keys for redundant RTMP encodings live on static ingest points and are not returned by live.get. Fetch them via streamKeys.list?assignedEncodingId so all keys are surfaced. For SRT, walk streams.list to inputs.srt.get to expose mode/host/port/path. Output now uses streamKeys[] and srtInputs[] for a consistent JSON shape. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Match the prior naming and have LiveDetails extend LiveEncoding so its encoderIp/application/streamKey fields are inherited rather than re-declared. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Quick note: my earlier approval was on
Neither is a blocker if intentional — but #1 is a regression I'd want to fix before merge. |
Address lukaskroepfl review follow-up: JSON consumers that key off
truthiness would treat the human placeholder strings ("(not yet
running)" / "(unknown)") as real values. Branch on jsonMode so
encoderIp/application come back as null in JSON when the live
encoder has not started, while keeping the friendly placeholders
in the table render.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
A 5xx, 403, or other transient error from streamKeys.list, streams.list, or inputs.type/.srt.get used to bubble through Promise.all and surface as "API error: ..." even when live.get already returned the encoder IP. Catch errors inside the auxiliary fetchers, return empty arrays, and emit a stderr warning describing the underlying failure. Live.get errors still propagate (except the existing "details unavailable" 400). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Earlier iterations of the live command exposed streamKey as a single string. The redundant-RTMP fix replaced it with streamKeys[]. Restore a streamKey alias that mirrors streamKeys[0]?.value so consumers reading data.streamKey keep working, and clarify in the CHANGELOG that redundant RTMP callers should read streamKeys[] for every per-ingest-point key. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
I applied your feedback @lukaskroepfl
|
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
lukaskroepfl
left a comment
There was a problem hiding this comment.
All three points addressed cleanly:
- Auxiliary fetcher error handling —
fetchAssignedStreamKeysandfetchSrtInputsnow returnFetchResult<T>and degrade to empty arrays + athis.warn(...)to stderr on failure. So a transient 5xx on stream-key listing or SRT enumeration no longer kills the command — the user still sees the encoder IP.describeApiErrorformats the error with httpStatusCode + developerMessage, which is the right amount of detail. streamKeybackward-compat alias — singularstreamKeyis preserved on the output asstreamKeys[0]?.value, with a clear inline comment about why and a CHANGELOG note explaining the shape evolution. Redundant-RTMP test asserts the alias points to the first key. ✅- Bonus —
nullinstead of(not yet running)placeholder strings in JSON output addresses the non-blocking note from the earlier review. JSON consumers can now do truthiness checks cleanly.
Re-approving on a80a4de4 so the review state on this PR reflects the current scope rather than the smaller f0fb222c it was on before.
- Per-input tolerance in fetchSrtInputs: a transient failure on one inputs.type.get/inputs.srt.get now drops only that input rather than collapsing every other valid SRT endpoint, with a single combined warn line summarising the failures. - Add bitmovin encoding jobs live to README.md and src/commands/skill.ts inventories so users and AI tooling that scan the documented command list can find the new command. - Replace the generic outputData() rendering for the default (non-JSON) output with a status.ts-style summary: friendly Encoder IP / Application / Stream Key labels, a Stream Keys list for redundant RTMP, and an SRT Inputs section for SRT encodings. Tests assert the exact human-readable layout. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Summary
Add
bitmovin encoding jobs live <id>to fetch live encoding details (encoder IP, stream key, application) fromGET /v1/encoding/encodings/{id}/live.Why
This is the single most-asked question of a running live encoding: once
encoding templates startreturns, the user needs the encoder's public IP to point their contribution encoder (ffmpeg, OBS, hardware encoder) at it for SRT/RTMP push. Previously this required hand-rolling acurlcall against the API.Output Examples
Default (human-readable):
JSON:
{ "streamKey": "test", "encoderIp": "192.0.2.10", "application": "live" }When the encoder is still queued/spinning up and the live details endpoint reports that details are not available yet, the command exits successfully and shows:
JSON for that state:
{ "available": false, "message": "Live encoding details are not available yet. The encoder may still be queued or spinning up." }Tests
--jsonmode.Test plan
bitmovin encoding jobs live <id>returns encoder detailsbitmovin encoding jobs live <id> --jsonreturns JSONAPI error: 400