Goal
Process and deliver native video through StackShift without legacy download-token playback.Prerequisites
- An uploaded video in an Assets space you may access, with its asset ID and current source-version ID.
- An Assets token on a trusted backend: assets:read for workspace/session reads, assets:process for encoding, assets:admin for video review.
Workflow
1
Upload through the existing Assets upload flow and retain the returned asset ID and current version ID.
2
Read the video workspace. Check source scan/review state and admission_enabled before requesting processing.
3
Start processing for that exact version. Poll workspace/package/job state; 202 is not playback readiness.
4
Wait for an active ready or degraded package, then create a playback session and pass its returned URLs to the shared player.
5
Keep the existing active package playing during replacement. Request a new session when you intentionally switch to the replacement package.
Edit footage before packaging
For step-by-step dashboard instructions, open edit footage before packaging. This reference continues with the underlying resource lifecycle, API fields and SDK examples.Use the video workspace
Open Assets → Library, select a video and open its video workspace. The header identifies the asset and visibility; the preview keeps the complete frame, including portrait footage. Use More asset tools for the existing non-video asset operations. The workspace follows current server state. An upload can be queued, scanning or encoding before playback is available. If a replacement is processing while an older package is ready, the preview identifies that the previous version is playing. Do not interpret the preview as proof that the replacement has finished. When the current source needs processing and the action is available, select Process current source in Preview. A clean scan is required. In Security, administrators record a Review reason before Approve or Reject; that decision applies only to the current source version.- Preview shows media details and playback analytics; no events is an empty-data state.
- Renditions lists only outputs available from the published package. A missing height is not a broken quality control when the source is smaller or that rendition failed validation.
- Captions uploads/attaches language tracks to the selected source version. Caption replacement does not re-encode the video.
- Embed previews supported options and generates JavaScript/React integration snippets. For private videos, supply a host-backend session callback rather than storing a private URL permanently.
- Versions compares the active package with pending replacement work. Security distinguishes native validation from optional human content review.
Availability and compatibility
The workspace reports admission_enabled for this installation. If new processing is disabled, the source is retained and existing ready packages remain deliverable. Ask the space/platform owner about availability; the player cannot enable processing. Native video processing, storage, authorization, player code and telemetry use StackShift infrastructure. 3D product rendering is a separate governed workflow for validated model sources. Legacy videoUrl(assetId, kind, profile) helpers address a different output path. Do not extract a generic signed-download token for the native player. Existing video URLs are not migrated or backfilled by these stages.Read the workspace
GET /api/v1/assets/{assetID}/video returns a success/data envelope. The JavaScript SDK unwraps data through assets.video.workspace(assetId).active: the package currently selected for playback; it can belong to the previous source version while replacement work proceeds.pending: replacement/current processing package when present. A package includes id, version_id, source_checksum_sha256, recipe_hash, processor_revision, status, phase, progress_percent, job_id and failure_code.source: current source version_id, scan_status, review_status and review_reason. Scan values are pending/clean/infected/failed; review values are not_required/pending/approved/rejected.renditions: available output records with package_id, kind, profile, dimensions, byte size, MIME type and status. Use these records instead of assuming the full ladder exists.admission_enabled: whether this installation admits new native encodes.
Package states and presentation
queued: admitted durable work waiting for a claim; do not invent a percentage for unknown totals.processing: inspect phase and progress_percent; scanning, encoding and review are separate concerns. Player presentation also has scanning, encoding and awaiting_review states.ready: required validated outputs are available and package promotion succeeded.degraded: required playback outputs succeeded but one or more additional renditions failed. Show only available renditions.failed: inspect failure_code and job information. Fix the input or failed dependency before requesting another attempt.cancelled: the cancelled attempt cannot publish. Use the existing durable-job controls for supported cancellation; there is no separate native-video cancel route in this contract.- Playback phases such as loading, buffering, paused, ended, expired and revoked are player states, not persisted package status values.
Outputs, source identity and replacement
Packages are immutable and bind asset space, asset, source version/checksum, recipe and processor revision. Renewable job leases and fenced publication prevent an obsolete worker attempt from activating a stale source version. The encoder produces H.264/AAC fast-start MP4 and HLS with six-second segments. The configured default ladder is 240p/360p/480p/720p/1080p; it preserves aspect ratio, normalizes rotation/timestamps and avoids upscaling. Silent sources do not require a synthetic audio track. Promotion requires a valid MP4 and at least one valid HLS rendition, validated references/checksums/durations and required replication. Only successful renditions enter the master playlist. Last-ready delivery remains active while a replacement is processing. A playback session remains attached to its original package after renewal. A newly ready replacement does not silently retarget existing sessions. Active and session-referenced packages are retained by the lifecycle rules.Validation is not human content review
Native malware scanning and media validation are required for this path. External AI moderation is not a prerequisite for native video approval; a filename/text moderation result must not be presented as a review of the video content. The content-policy field require_video_review controls optional version-specific human review. When required, approve/reject the exact version with assets:admin and a nonempty reason of at most 2,000 bytes. Replacing the source does not carry its approval forward. Asset-wide deletion, quarantine, visibility and revocation remain separate delivery controls.Playback sessions and URLs
Authenticated creation: POST /api/v1/assets/{assetID}/playback-sessions. Public creation: POST /playback/assets/{assetID}/sessions, without the /api/v1 prefix; it cannot authorize private assets. Both return HTTP 201 with a grant in data. A grant contains session, credential, hls, mp4, optional poster, has_audio and captions. Treat the whole response as sensitive and no-store. Credentials are random bearer values stored hashed by the server, not permanent API keys. Sessions default to 30 minutes with a 24-hour absolute maximum. POST /playback/sessions/renew uses Authorization: Bearer <credential>; renewal preserves the credential and package. At the absolute limit, authorize a new session. Canonical resource paths contain /assets/{assetID}/versions/{versionID}/video/{packageID}/hls/master.m3u8; private paths start /private/assets/. Use returned URLs. The server explicitly authorizes and rewrites child references; browsers must not assume query parameters inherit into playlist children. Private resources and session-bearing manifests use no-store. Delivery supports HEAD and byte ranges. Origin and edge must enforce current access policy; deletion, quarantine and withdrawal deny subsequent requests, but cannot recall downloaded or buffered bytes.Management route and scope reference
GET /assets/{assetID}/video: assets:read; workspace.POST /assets/{assetID}/versions/{versionID}/video: assets:process; 202 package/job admission.POST /assets/{assetID}/playback-sessions: assets:read; 201 grant.DELETE /assets/{assetID}/playback-sessions/{sessionID}: assets:write; returns revoked=true.POST /assets/{assetID}/versions/{versionID}/video/review: assets:admin; decision and reason; returns reviewed=true.- These management paths are relative to /api/v1. Playback renewal/events/public creation are absolute /playback paths.
- CLI names: video, video-process, playback-create, playback-renew, playback-revoke and video-review under stackshift asset. Playback grants contain credentials: do not stream them into CI logs.
Billing and recovery
Encoding admission is persisted so retrying an admitted source across a monthly boundary does not consume a second allowance. Completion usage is recorded once. Client playback telemetry is not a billing input; previously completed media remains readable after subscription expiry, subject to delivery authorization.- 401 during playback: expired/invalid credential; renew while allowed or request a newly authorized session.
- 403: revoked/private/unavailable access. Do not switch to a public URL or MP4 to bypass denial.
- 503 or resource failures: investigate origin, replica and worker readiness; preserve identifiers for diagnostics.
- Replacement failed: show the failed pending package while retaining authorized active playback. Do not delete the active package as a retry strategy.
- Admission disabled: an operator explicitly disabled new processing; the default is enabled. Repeated process requests do not change configuration.
Go, Python and PHP: submit a version and wait for its active package
Pass the version ID returned by upload completion or the current workspace source. These backend examples submit that exact version and check the returned package ID, so an older active package cannot be mistaken for the new result. They stop for human review, processing failure, cancellation, replacement or timeout. Use this waiting procedure in a background task, not inside a long-running browser HTTP request. A dashboard can run the same checks after each workspace refresh. The five-minute polling budget belongs to the example; it does not cancel the durable encoding job. On timeout, retain the package ID and resume status reads instead of submitting another source. Once the returned package is active, your authorized session endpoint can call createSession/CreateSession/create_session. Keep any earlier package playing while the replacement is pending. Do not silently switch a viewer to a different source after the version-change error.HTTP operations for this workflow
Management requests use Authorization: Bearer with your server-side Assets credential and X-Asset-Space-ID for the selected space. API-key scopes and space/collection permissions both apply. Successful JSON responses use {success: true, data: …}; the SDK methods return the unwrapped data. Paths shown outside /api/v1 use their dedicated short-lived credential.
For If-Match, quote the revision number, for example If-Match: “7”. On 412 assets.revision_conflict, reload the relevant resource and reconcile the edit before retrying. Use the revision of the resource being changed: asset, collaborator, schema, publication or gallery. A bucket-policy save instead places its current revision in the JSON body.
Expected result
The active package remains playable during replacement; new packages become visible only after validation, authorization and required review, and playback credentials remain tied to one package.
Common failures
Related guides
Edit videos in Video Studio
Trim, crop, resize, overlay, extract audio and create poster frames before packaging video for delivery.
Video player, captions and analytics
Install the shared player, implement public/private session callbacks, upload immutable WebVTT tracks, and interpret session-scoped telemetry.
Upload, validate and publish 3D models
Prepare supported GLB and supplied USDZ files, inspect validation reports, add posters, review the model and launch authorized device AR.
Operator reference: Assets deployment and rollback
Configure Assets services, build images, run deployment checks, and roll back processing admission without interrupting existing delivery.
Assets SDKs: JavaScript, Go, Python and PHP
Configure space-scoped clients and use native video, governed DAM, model rendering, galleries and CMS capabilities in all four SDKs.