Upload via link
If you have videos stored in a cloud storage bucket, you can simply pass a HTTP link for the file. Stream will fetch the file and make it available for streaming.
By using webhooks you can receive a notification when the video is ready to be played or if it errors.
Step 1: Make an API call with the link
Make a HTTP request to the Stream API with the URL of the video.
curl \-X POST \-d '{"url":"https://storage.googleapis.com/zaid-test/Watermarks%20Demo/cf-ad-original.mp4","meta":{"name":"My First Stream Video"}}' \-H "Authorization: Bearer $TOKEN" \https://api.cloudflare.com/client/v4/accounts/$ACCOUNT/stream/copy{  "result": {    "uid": "4544715edbe00808d89aec0a3a765c40",    "thumbnail": "https://videodelivery.net/4544715edbe00808d89aec0a3a765c40/thumbnails/thumbnail.jpg",    "thumbnailTimestampPct": 0,    "readyToStream": false,    "status": {      "state": "downloading"    },    "meta": {      "downloaded-from": "https://storage.googleapis.com/zaid-test/Watermarks%20Demo/cf-ad-original.mp4",      "name": "My First Stream Video"    },    "created": "2020-10-16T20:20:17.872170843Z",    "modified": "2020-10-16T20:20:17.872170843Z",    "size": 9032701,    "preview": "https://watch.cloudflarestream.com/4544715edbe00808d89aec0a3a765c40",    "allowedOrigins": [],    "requireSignedURLs": false,    "uploaded": "2020-10-16T20:20:17.872170843Z",    "uploadExpiry": null,    "maxSizeBytes": 0,    "maxDurationSeconds": 0,    "duration": -1,    "input": {      "width": -1,      "height": -1    },    "playback": {      "hls": "https://videodelivery.net/4544715edbe00808d89aec0a3a765c40/manifest/video.m3u8",      "dash": "https://videodelivery.net/4544715edbe00808d89aec0a3a765c40/manifest/video.mpd"    },    "watermark": null  },  "success": true,  "errors": [],  "messages": []
}
Step 2: Poll the API or wait for a webhook
Because Stream must download and encode the video, the video might not be available for a few seconds to a few minutes depending on the length of your video. You should poll the Stream API until readyToStream is true, or use webhooks to be notified when a video is ready for streaming.
Step 3: View the video
The uid of the video can be used refer to the video after uploading and can be used to play it using the Stream video player
.
If you’re using your own player or rendering the video in a mobile app, view information on using your own player
.