Streaming video using js-ipfs in the Browser #965
Description
- Version: 0.25.2
- Platform: macOS 10.12.6 Chrome 60.0.3112.113
- Subsystem: Not sure?
Type:
Question
Severity:
High / Critical (sometimes)
Description:
I cannot seem to get js-ipfs communicating with go-ipfs... I get cryptic errors, and I'm not quite sure is that even supposed to work. My code is this:
const ipfs = new Ipfs({
init: true,
start: true,
repo: 'ipfs-testing-' + window.reqID,
config: {
Swarm: [
"/dns4/milankragujevic.com/tcp/9999/ws",
"/libp2p-webrtc-star/dns4/star-signal.cloud.ipfs.team/wss"
],
Bootstrap: [
"/dns4/ams-1.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLer265NRgSp2LA3dPaeykiS1J6DifTC88f5uVQKNAd",
//"/dns4/sfo-1.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLju6m7xTh3DuokvT3886QRYqxAzb1kShaanJgW36yx",
"/dns4/lon-1.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLMeWqB7YGVLJN3pNLQpmmEk35v6wYtsMGLzSr5QBU3",
//"/dns4/sfo-2.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLnSGccFuZQJzRadHn95W2CrSFmZuTdDWP8HXaHca9z",
//"/dns4/sfo-3.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLPppuBtQSGwKDZT2M73ULpjvfd3aZ6ha4oFGL1KrGM",
"/dns4/sgp-1.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLSafTMBsPKadTEgaXctDQVcqN88CNLHXMkTNwMKPnu",
"/dns4/nyc-1.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLueR4xBeUbY9WZ9xGUUxunbKWcrNFTDAadQJmocnWm",
"/dns4/nyc-2.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLV4Bbm51jM9C4gDYZQ9Cy3U6aXMJDAbzgu2fzaDs64"
]
}
})
ipfs.on('error', (err) => {
console.error(err)
})
ipfs.on('ready', () => {
ipfs.files.cat('QmcPZGXSyaQSnDVEtJrgtp2EyxhENiBdpGa8pfs5rMBCWr').then((data) => {
window.VideoStream(data, document.getElementsByTagName('video')[0])
})
})
I built the latest 0.25.2 version with gulp and set it up but it doesn't seem to work, I usually get no response or this:
Error: Stream ended prematurely
You can see it in action here at the link below.
I'm trying to stream Sintel.mp4 from WebTorrent, which I know for a fact should work, using the package videostream, as WebTorrent uses, and this usually works with HTTP-storage and a custom API for loading data via AJAX, or via vanilla WebTorrent, but doesn't seem to work with js-ipfs. I'm not sure whether the problem is with videostream or with js-ipfs, but I'm leaning more on the js-ipfs, because it seems to never even try to execute videostream.
Thanks!