
Play a private Imagild API video through an application route that authenticates the viewer, authorizes the asset, and streams the owned result with the server-held key. Preserve byte-range semantics so seeking does not become a full-file download on every request. Do not expose the Bearer credential or present the private output_url as a public video link.
Key Takeaways
- The browser talks to your authorized media route; your backend talks to Imagild.
- Forward Range requests and preserve 200, 206, and 416 semantics.
- Stream the response rather than buffering every full video into memory.
Bind the player to an owned application asset
Your page can use a normal video element whose src points to a same-origin route you control. The application authenticates its user and loads an asset record that contains the known Imagild task ID and owning account.
Do not accept a browser-supplied arbitrary URL and forward your key to it. Construct the upstream task-content URL from the fixed API base after authorization. Keep upstream account credentials separate from your browser session.
The API console documents active membership and authenticated result delivery. Successful generation earlier does not bypass current credential or membership checks during playback.
Preserve what the browser requested
A player may request a byte range to start, inspect metadata, or seek. MDN's Range guide distinguishes full responses, partial responses, and unsatisfiable requests.
| Upstream result | Proxy behavior |
|---|---|
| 200 | Return a complete representation; do not label it partial |
| 206 | Preserve the partial body and matching Content-Range |
| 416 | Preserve unsatisfied-range status and total-size information |
| Authentication or other error | Return an application error, not a successful video response |
Forward the incoming single Range header to the task-content request. Do not invent multipart-range support or assume every request receives 206. Range support is a delivery capability, not proof that a video is valid or approved.
Stream a validated media response
This framework-neutral helper handles an already authorized upstream response. Your surrounding route must perform user/asset checks, build the fixed upstream URL, supply its key, and forward Range before calling it.
function copyPrivateVideoResponse(upstream) {
if (![200, 206, 416].includes(upstream.status)) {
throw new Error("Video delivery unavailable");
}
const type = upstream.headers.get("content-type")?.split(";")[0];
if (upstream.status !== 416 && type !== "video/mp4") {
throw new Error("Unexpected media response");
}
const headers = new Headers({
"Cache-Control": "private, no-store",
"X-Content-Type-Options": "nosniff"
});
for (const name of [
"Content-Type", "Content-Length", "Content-Range", "Accept-Ranges"
]) {
const value = upstream.headers.get(name);
if (value !== null) headers.set(name, value);
}
return new Response(upstream.body, { status: upstream.status, headers });
}
The helper assumes unchanged bytes: no transcoding, compression, or content transformation. If your runtime transforms the body, lengths and ranges must be recalculated or handled by an appropriate media layer. Propagate client disconnects to the upstream request so abandoned playback does not keep transferring unnecessarily.
Do not copy unrelated headers indiscriminately. In particular, never return your Authorization header to the browser.
Test playback and seeking independently
With an approved short clip, verify initial play, pause/resume, seeking, and a deliberately unsatisfiable range. Inspect network status and Content-Range rather than relying only on the first visible frame.
Then test an expired application session and a user who does not own the asset. Both should fail authorization without exposing private media. These are proposed acceptance checks, not a claimed production benchmark.
The poster-versus-first-frame guide helps distinguish a card preview issue from broken video delivery.
Recover access without paying for another clip
An access denial or proxy-header error should not trigger a new video generation. Preserve the existing task and inspect its current state. The failed-job guide separates generation outcomes from transport troubleshooting.
Review current models and points in the model market when deliberately approving new work. Private playback is an access-and-delivery task; generation, creative review, archival storage, and publication remain separate decisions.
Related tasks
- Why Does a Video Card Show a Black Image Before Playback?
- What Should You Check Before Retrying a Failed Image or Video Job?
Sources and scope
- Imagild API console: Private task content requires valid account access and active membership.
- Imagild model market: Current generation choices and prices remain separate from playback recovery.
- MDN HTTP Range requests: 200 versus206 versus416 semantics and Content-Range behavior.
Product instructions were checked against the current Imagild API contract and the public model catalog. Code, budgets and acceptance checks are illustrative; this article does not claim a new paid generation test, an uptime measurement, a search-volume study or a ranking of AI citations.
Prepared by Imagild Editorial, the company editorial team responsible for these guides. AI assisted research and drafting. This is documentation-based guidance with proposed examples, not a claim of hands-on testing or an independent product review. Report a correction.
Cover: Original Imagild product screenshot captured on 28 October 2026; model availability and prices may change. This image is not an API response or a performance benchmark.