Learn how to upload and stream videos from Arweave using Bundlr and Livepeer
@livepeer/react
, @bundlr-network/client
,
filereader-stream
libraries which we will use to integrate Livepeer, Bundlr
Network and stream the file respectively:
tailwindcss
, postcss
, and autoprefixer
dependencies. These dependencies are
necessary for TailwindCSS to work properly in a Next.js app.
Run the following command to install them:
tailwind.config.js
and
postcss.config.js
. These files contain the configuration for Tailwind CSS and
PostCSS, respectively. Next, open the tailwind.config.js
file in code editor
of your choice and replace its contents with the following code:
./styles/globals.css
file.
pages/index.js
file, with below code.
npm run dev
to start the next.js app and you should see
a similar page.
client
in
the root directory, and add the following code to livepeer.js
YOUR_API_KEY
with the key which you just copied from
the Livepeer dashboard. And also replace the code inside of _app.js
in the
page directory with the below code.
client
directory, create a new file named bundlr.js
and add the below
code inside of it.
index.js
file in the pages
directory, create two states,
one for the video file and the other for the Arweave ID:
uploadVideo
function when clicked.
Add the following function to handle the uploading of the video: