Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions src/content/docs/stream/uploading-videos/upload-via-link.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@ import {
LinkButton,
} from "~/components"

If you have videos stored in a cloud storage bucket, you can pass a HTTP link for the file, and Stream will fetch the file on your behalf.
If you have videos stored in a cloud storage bucket (R2, S3, GCS) or hosted by a service that exposes a download link, you can pass its URL. Stream will fetch the file on your behalf.

:::note

Google Drive share links are _not_ recommended for this purpose. They are prone to rate limiting and access restrictions imposed by Google that may prevent Stream from downloading the file.

:::

<Tabs>
<TabItem label="REST API">
Expand All @@ -25,7 +31,7 @@ If you have videos stored in a cloud storage bucket, you can pass a HTTP link fo
Make a `POST` request to the Stream API using the link to your video.
```bash
curl \
--data '{"url":"https://storage.googleapis.com/zaid-test/Watermarks%20Demo/cf-ad-original.mp4","meta":{"name":"My First Stream Video"}}' \
--data '{"url":"https://pub-2da57dbfcf5f4369863991d59747d686.r2.dev/acadia.mp4","meta":{"name":"My First Stream Video"}}' \
--header "Authorization: Bearer <API_TOKEN>" \
https://api.cloudflare.com/client/v4/accounts/{account_id}/stream/copy
```
Expand All @@ -39,7 +45,7 @@ If you have videos stored in a cloud storage bucket, you can pass a HTTP link fo

const video = await client.stream.copy.create({
account_id: '<ACCOUNT_ID>',
url: 'https://storage.googleapis.com/zaid-test/Watermarks%20Demo/cf-ad-original.mp4',
url: 'https://pub-2da57dbfcf5f4369863991d59747d686.r2.dev/acadia.mp4',
});
```
</TabItem>
Expand All @@ -56,7 +62,7 @@ export default {
async fetch(request, env, ctx): Promise<Response> {
// upload a video with a link
const videoDetails = await env.STREAM.upload(
"https://storage.googleapis.com/zaid-test/Watermarks%20Demo/cf-ad-original.mp4",
"https://pub-2da57dbfcf5f4369863991d59747d686.r2.dev/acadia.mp4",
// (optional) attach metadata
{ meta: { name: "My First Stream Video" } }
);
Expand Down Expand Up @@ -117,7 +123,7 @@ You can optionally use [webhooks](/stream/manage-video-library/using-webhooks/)
"state": "downloading"
},
"meta": {
"downloaded-from": "https://storage.googleapis.com/zaid-test/Watermarks%20Demo/cf-ad-original.mp4",
"downloaded-from": "https://pub-2da57dbfcf5f4369863991d59747d686.r2.dev/acadia.mp4",
"name": "My First Stream Video"
},
"created": "2020-10-16T20:20:17.872170843Z",
Expand Down Expand Up @@ -149,4 +155,4 @@ You can optionally use [webhooks](/stream/manage-video-library/using-webhooks/)

After the video is uploaded, you can use the video `uid` shown in the example response above to play the video using the [Stream video player](/stream/viewing-videos/using-the-stream-player/).

If you are using your own player or rendering the video in a mobile app, refer to [using your own player](/stream/viewing-videos/using-the-stream-player/using-the-player-api/).
If you are using your own player or rendering the video in a mobile app, refer to [using your own player](/stream/viewing-videos/using-the-stream-player/using-the-player-api/).