Skip to content
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

<video> tag streaming #144

Closed
feross opened this issue Oct 7, 2014 · 5 comments
Closed

<video> tag streaming #144

feross opened this issue Oct 7, 2014 · 5 comments

Comments

@feross
Copy link
Member

@feross feross commented Oct 7, 2014

This is a primitive - this should be easier to do, preferably built-in.

@feross

This comment has been minimized.

Copy link
Member Author

@feross feross commented Oct 7, 2014

For those who want to play around with this without waiting, it's already implemented here: https://github.com/feross/webrtc-whiteboard/blob/master/client/index.js#L287 for webrtc-whiteboard.

@feross

This comment has been minimized.

Copy link
Member Author

@feross feross commented Oct 20, 2014

This is implemented now.

Stream into a video tag like this:

var WebTorrent = require('webtorrent')

var client = new WebTorrent()

client.download(magnet_uri, function (torrent) {
  // Got torrent metadata!
  console.log('Torrent info hash:', torrent.infoHash)

  // Let's say the first file is a webm (vp8) or mp4 (h264) video...
  var file = torrent.files[0]

  // Create a video element
  var video = document.createElement('video')
  video.controls = true
  document.body.appendChild(video)

  // Stream the video into the video tag
  file.createReadStream().pipe(video)
})
@feross feross closed this in a0d3ba2 Oct 20, 2014
@feross

This comment has been minimized.

Copy link
Member Author

@feross feross commented Oct 20, 2014

Published as webtorrent 0.10.0.

@iShift

This comment has been minimized.

Copy link
Contributor

@iShift iShift commented Oct 21, 2014

iw would be good if you add working example of this on instant.io

@feross

This comment has been minimized.

Copy link
Member Author

@feross feross commented Oct 21, 2014

I have. It only works on chrome because firefox has mediasource behind an
about:config flag. You can enable the mediasource flag to test in firefox.

On Tuesday, October 21, 2014, iShift notifications@github.com wrote:

iw would be good if you add working example of this on instant.io


Reply to this email directly or view it on GitHub
#144 (comment).

Feross | blog http://feross.org/ | webtorrent http://webtorrent.io/ |
studynotes http://www.apstudynotes.org/

@lock lock bot locked as resolved and limited conversation to collaborators May 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.