Skip to content

endpoints open fiels api hosted on the edge using r2 d1 and custom intagrated digital ocean backend

License

Notifications You must be signed in to change notification settings

syonfox/filesv3

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🎥 Cloudflare Stream Upload Demo

Demo

Background

From Cloudflare

Cloudflare Stream is a live streaming and on-demand video platform, which can ingest, encode, record, and play videos from one unified product.

Cloudflare Stream will handle the heavy lifting when it comes to video. Cloudflare manages authenticated streams, encoding, live streaming, storage and more all through their simple API or easy to use web dashboard.

What is tus?

Historically it stood for Transloadit Upload Server, later repurposed to The Upload Server. tus provides a universal spec for how resumable uploads and large file uploads should work. tus is built on top of HTTP/HTTPS, making it widely available on most platforms we use today.

tus is great if you:

  • Need to handle large file uploads
  • Have users with potentially unreliable network connections
  • Want to provide pause and resume capabilities to your users

What Are Creator Uploads?

Cloudflare Stream offers many ways to upload videos. Of these methods available, creator uploads is one of the most unique and useful methods.

From Cloudflare Docs:

Direct creator uploads allow users to upload videos without API tokens. A common place to use Direct creator uploads is on web apps, client side applications, or on mobile apps where users upload content directly to Stream.

Getting Started

This repo leverages the following tools:

Running Cloudflare Worker Locally

  1. Login to your Cloudflare account with wrangler login
  2. cd server && npm i
  3. wrangler dev --port 5500
  4. Your endpoint is now available on http:https://localhost:5500

Note: There are two secrets used in this repository. You can view these secrets in wrangler.toml

To add a secret to Cloudflare using wrangler, you can run the following:

wrangler secret put ACCOUNT_ID_DEMO
wrangler secret put TOKEN_DEMO

Deploying To The Web

Deployment to the world-wide-web is simple.

  1. cd server && npm i
  2. wrangler publish

Running The Client

This demo intentionally uses vanilla Javascript to keep things simple. Everything can be loaded by simply opening the index.html file in your browser.

About

endpoints open fiels api hosted on the edge using r2 d1 and custom intagrated digital ocean backend

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 36.9%
  • HTML 29.3%
  • JavaScript 28.3%
  • CSS 5.5%