-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: IPFS-based video support #16
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 38d9420 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
f80a9d4
to
0d85d8e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
almost there
const [hasStartedPlaying, setHasStartedPlaying] = | ||
React.useState<boolean>(false); | ||
|
||
const pollUrl = useCallback( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice addition
return null; | ||
} | ||
|
||
// TODO: Generate thumbnail if image/video |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would be nice to include this
return NextResponse.json( | ||
{ | ||
message: "Took too long to upload. Try a smaller file", | ||
// TODO: Cache this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think livepeer automatically caches this - if you request via an IPFS cid it doesn't re-upload if it's been uploaded to livepeer previously. Worth confirming we're doing it correctly to get this benefit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just noticing that their API is returning a different playbackId
for each request. Can we check with them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok will do
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could it be this:
For IPFS HTTP gateway URLs, the API currently only supports
“path style” URLs and does not support “subdomain style” URLs. The API will support both styles of URLs in a future update.
https://docs.livepeer.org/reference/api#upload-an-asset
I think the IPFS url uses our subdomain gateway as it stands
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I haven't asked them yet)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
try upload to web3.storage instead of infura for our gateway
fa6bc2a
to
52dbe8f
Compare
52dbe8f
to
a9f4247
Compare
92bc21d
to
4e8c95f
Compare
4e8c95f
to
2071ec1
Compare
} | ||
// Exchange for livepeer url | ||
const cid = url.replace("ipfs://", ""); | ||
const gatewayUrl = `${process.env.IPFS_DEFAULT_GATEWAY}/${cid}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tried it, still no caching
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok will try emailing them again
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stephancill can you try ipfs://{CID}
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting - it uploads fine without specifying a gateway, but still no caching (returns a different asset id each time it uploads)
c632f93
to
38d9420
Compare
Adds support for videos on IPFS via the
livepeer-video
andvideo-render
Mods.Uploading is done via the Infura IPFS API, which also pins the file.
When a video on IPFS is detected, the
video-render
mod tries to load the video directly via the IPFS gateway, but also makes a request to the/livepeer-video
endpoint to upload and transcode the video to the livepeer servers via IPFS. This endpoint returns the livepeer asset ID which is then used to poll the/livepeer-video/<asset-id>
endpoint to see if the streaming URL is ready. Once it is ready, it switches out the IPFS gateway video source for the HLS stream via Livepeer for a more performant streaming experience.This PR introduces a few changes to mod packages to make this possible
retryTimeout
andretryCount
available in theModManifest
typemimeType
alongsidevideoSrc
for thevideo
componentreplaceInlineContext
commands syntax + tests:split
(splits a string)index
selects an item at the specified index in an array e.g.Todo:
onload
is called excessively)