Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upIssues dealing with createObjectURL(file) to stream video #423
Comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
You can get the BlobURL by calling the The file object returned by WebTorrent is very different from the native JavaScript File object. Example: var client = new window.WebTorrent()
var magnetUri = 'magnet:?xt=urn:btih:2d009baa395c94f6ad30375cfbae87c8cf0e5fff&dn=New+Zealand+in+4K+(Ultra+HD).mp4&tr=wss%3A%2F%2Ftracker.webtorrent.io'
client.add(magnetUri, function (torrent) {
console.log('Client is downloading:', torrent.infoHash)
torrent.files.forEach(function (file) {
file.getBlobURL(function (err, url) {
if (err) throw err
console.log(url)
})
})
})You can check out the source: https://github.com/feross/webtorrent/blob/f1d966c24739d982128e247e48cc41f2a82ee30a/lib/file.js#L109-L121 |
This comment has been minimized.
This comment has been minimized.
|
Alright i’m a fucktard.
|
This comment has been minimized.
This comment has been minimized.
|
I am struggling with something like this with audio. Is it possible to wrap a previously created video/audio element with file.appendTo() to use streaming? How could we do it in other way? |
This comment has been minimized.
This comment has been minimized.
|
@insanux it's possible to append to a buffer while it's set as the source of something, but it's not easy and codecs needs to line up and it's strange. I am doing it here: (built) with videos, it works under certain circumstances and not with others. It's still something I am playing a lot with for a video streaming setup I want to create. |
This comment has been minimized.
This comment has been minimized.
|
@theocousin Any updates? The Blob URL is only returned once fully loaded. Append-to can stream things using other deps like MediaSourceStream, you could simulate it. Check https://github.com/feross/webtorrent/blob/master/lib/append-to.js |
This comment has been minimized.
This comment has been minimized.
|
You can use So, if you're using some third-party video player, you need to get the DOM file.renderTo(videoTag)And the video should start to stream before it's fully downloaded. |
This comment has been minimized.
This comment has been minimized.
|
This thread has been automatically locked because it has not had recent activity. To discuss futher, please open a new issue. |
Hi there i'm stuck on this issue using Blob.
I'm trying to stream videos using webtorrent and an external video player.
For now i'm using flowplayer as player.
The problem is that it requires a source to load and play the video.
Here is the thing, i want to stream the video using webtorrent (this part works fine) as its more efficient for high definition streaming and maybe 4K.
But the problem with that is that i got no direct path to the server, and i would like to use the blob path stored on the browser.
But i cant find out why this isnt working for me.
On every browser the createObjectURL doesn't work. I've been trying with "objectURL = URL.createObjectURL(blob);" but same issues.
Hope i've been clear enough and hope you guys will take time to help me fix this problem.