After uploading a large file, poll this endpoint to verify the upload completed successfully:
Copy
async function waitForAssetReady(assetId: string, maxAttempts = 10) { for (let i = 0; i < maxAttempts; i++) { const asset = await getAsset(assetId); if (asset.state === 'ready') { return asset; } if (asset.state === 'failed') { throw new Error('Asset upload failed'); } await new Promise(r => setTimeout(r, 2000)); // Wait 2s } throw new Error('Asset not ready after maximum attempts');}
Verify asset before using in project
Before referencing an asset in your video project, verify it exists and is accessible: