Store Video Asset on IPFS
This guide provides you the instructions to store a video asset on IPFS from the Livepeer Studio Dashboard or through the Livepeer API.
The Livepeer API allows you to send video files to Livepeer and get them ready for optimized playback. Videos can be provided either by you (static content) or your users, given your application offers an interface for them to do so.
Caveats
- Currently assets cannot be deleted from the default Livepeer Studio storage. You can customize any additional storage though.
- Only IPFS is supported as an additional storage provider. We're currently working on adding additional storage providers. If you have requirements for a particular storage provider, please reach out to us at help@livepeer.studio.
Step 1: Get the asset.id
of an existing asset
Get the asset.id
of an existing asset. An asset.id
can be found in the
response object of any API call working with assets. If you haven't created an
asset yet, you can follow the
upload a video asset guide to do so.
Step 2: Store the asset on IPFS
Once you have an asset.id
, you can make a request to update the asset's
storage location.
- Livepeer.js
- Fetch
import { useUpdateAsset } from '@livepeer/react';
function App() {
const { mutate: updateAsset } = useUpdateAsset({
assetId,
storage: { ipfs: true }
});
}
const storeAssetOnIPFS = await fetch("https://livepeer.studio/api/asset/{id}", {
method: "PATCH",
headers: {
Authorization: `Bearer ${process.env.API_TOKEN}`,
"Content-Type": "application/json",
},
body: {
storage: {
ipfs: true,
},
},
});