Learn how to Build a decentralized video application with FVM and Livepeer
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.
A smart contract is a decentralized program that responds to events by executing business logic.To quickly create and deploy a contract, you can use Remix - a browser-based IDE developed by the Ethereum Foundation. Here’s how you can get started:
.workspace
directory.landing
inside of the pages
folder and create a new file inside of it named index.js. This file will have
the code for the landing page in our application, which will also allow users to
connect their wallets.
Erase everything inside of index.js
in the page directory and inside import
the Landing
file to the file. Here is what your index.js file should look
like.
upload
and add a file named
index.js
. Inside the file add the below code.
utils
,
and inside of it create a file named getContract
. This file will be used to
interact with your contract on the upload page. Add the below code to it and
make sure to replace the contract address and artifacts.
livepeer.js
and add the below code to initialize a React client.
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.
upload.js
.
index.js
inside of a new folder named home
. And for
now you can add the below code to the file.
Make sure to upload a few videos so you can see the above outputCreate a folder named
components
, and then create a new file named Video.js
inside of it. Add the below code to the file. It is a very basic video component.
Player
and add the below code
to it. We are using Livepeer player to create a video player component.
VideoContainer
. Imagine this
component as the left side of the youtube video page, which contains a player,
video title, upload date, and description. Add the below code to the file.
pages
directory and
create a new file index.js
of it. For now, you can add the following code to
the file.