REPOSITORY CODING · MEDIUM
Implement the remaining playout cue sheet after an interruption
The receipt store works, but the cue builder returns no items. Build source offsets, contiguous timings, budget flags and overrun without replaying completed frames.
Repository ImplementationBroadcast playout rehearsal
Work through a real codebase.
Choose an environment, investigate the existing implementation and use the tests to check your change. Sign in to open a workspace; execution and Ono usage follow your plan’s allowances.
Task requirements and environments
Go · 60 minute session
- This service rehearses a rundown after a playout interruption. It does not send media to a transmitter. Segments stay in the supplied order. Each segment uses source-frame offsets [in, out), inside its asset frame count.
- FPS is an integer from 1 to 120. Convert cumulative remaining frame boundaries to milliseconds with floor(frames * 1000 / fps). Do not round each segment independently. The time budget is a nonnegative millisecond count; retain over-budget cues and mark fits false.
- Receipts contain absolute frames already played within the trimmed segment. Select the greatest sequence per segment, independent of arrival order. Identical redelivery is allowed; conflicting values for the same sequence are an error. A later correction may reduce the played count.
- Build each remaining cue with sourceIn = in + played, unchanged sourceOut, contiguous start/end times and fits = end <= budget. Completely played segments have no cue and appear in complete, in rundown order. A partially played segment is not complete.
- Duration is the final remaining cue end, or zero. Overrun is max(0, duration - budget). IDs must be unique; reject unknown receipts, out-of-range progress, invalid trims, FPS and budgets. Arrays remain arrays when empty.