[IPFS Tutorial #4] - Upload and Stream Videos via IPFS

in utopian-io •  7 years ago  (edited)

source

Repository

https://github.com/ipfs/ipfs

What Will I Learn?

  • You will learn how to upload a video to IPFS
  • You will learn how to stream a video from IPFS
  • You will learn how to build a NodeJS app to stream videos via IPFS

Requirements

Difficulty

  • Intermediate/Advanced

Uploading Videos to IPFS

In the previous tutorial I showed how to upload images or videos to IPFS. You can upload it by following the tutorial.
To upload a file to your IPFS server, you must make an HTTP POST request to the server. a key whose value is a video file in the body of request must be defined.
image.png

Now I will upload Utopian.io - How to Contribute video to my IPFS server with Postman.

image.png

Successfully uploaded!

https://steemia.net/ipfs/QmPfeq2wm79gS5Ho4Jyasu5TLSoSewfs41kxLpGKiSRr6w

Streaming Videos from IPFS

When you send an HTTP POST request, it will return the HASH of the file. When you send an HTTP POST request, it will return the HASH of the file. With this Hash you can access video via IPFS Gateway.

https://gateway.ipfs.io/ipfs/HASH

image.png

Streaming Videos from IPFS with video.js Library

You can create an interactive video player with the video.js library to play the videos. Video.js is an extendable library around the native video element.

image.png

  • How does it look now?

image.png

Build a NodeJS app to View Videos

Let's start by creating an application with NodeJS starter pack.
Once you have created a NodeJS app, you will create two html pages for homepage and video review page. On the Index page, the user will enter the video hash and the video will be opened in a new page with the VideoJS player.

index.js

image.png

index.html

image.png

video.html to render videos

image.png

Synopsis

When you open to Home, an input will ask for Video hash. When you submit a video hash, you will access the video via the ipfs gateway, and video.js will be triggered to play the video.

I also deployed this nodejs application so you can easily test it. I uploaded Utopian Contribution Tutorial video to IPFS. You can use it to test video-ipfs app.

QmPfeq2wm79gS5Ho4Jyasu5TLSoSewfs41kxLpGKiSRr6w

https://ipfs-tutorial.herokuapp.com


gif

Curriculum

Proof of Work Done

https://github.com/hsynterkr/video-ipfs

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Thank you for your contribution.

  • The tutorial is all badly formatted, I don´t understand anything!
  • Please follow the template of the tutorial category Link

Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]

Ughhh, I see your posted it from Busy, why did the format appear like this?

You just received a Tier 0 upvote! Looking for bigger rewards? Click here and learn how to get them or visit us on Discord

Thank you for your contribution.
As this issue was beyond your control, we have reviewed your post again.
Overall I like the work you did. Suggestions for your future work:

  • always include the code also in 'code' format within the post, and not just screenshots of the code.
  • provide more detailed explanations about the code, as well as enough comments.

Your contribution has been evaluated according to Utopian rules and guidelines, as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post,Click here


Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]

Sure, I will consider 🙂👍

Hey @hsynterkr
Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!

Contributing on Utopian
Learn how to contribute on our website or by watching this tutorial on Youtube.

Want to chat? Join us on Discord https://discord.gg/h52nFrV.

Vote for Utopian Witness!

No such app ... on your heroku link