cnpm install videostream --save
<video ref="myvideo" controls autoplay="autoplay" width="90%" ></video>
import VideoStream from 'videostream'
Play(hash){
//得到视频hash播放
let that = this
let stream
new VideoStream({
createReadStream: function createReadStream (opts) {
const start = opts.start
const end = opts.end ? start + opts.end + 1 : undefined
// If we've streamed before, clean up the existing stream
if (stream && stream.destroy) {
stream.destroy()
}
// This stream will contain the requested bytes
stream = that.ipfs.catReadableStream(hash, {
offset: start,
length: end && end - start})
stream.on('error', (error) => console.log(error))
return stream
}
}, that.$refs.myvideo)
},
RE: IPFS实用指南