/ndc-2013-streams

ndc-2013-streams

Primary LanguageJavaScript

#Overview

Piping, Streams, Video. HOTNESS.

Video Link : http://vimeo.com/68236538 Found here on goog groups: https://groups.google.com/forum/#!topic/baconjs/-epQIO_d8_Y

// consider putting this in client.config('general:navdata demo', 'FALSE');

This is the outline for the code for the node.js/NodeCopter part at my NDC 2013 talk

Pipe video to player

Pipe from file to player

Prerecorded, no slides since it's so obvious. Stress that streams are chunks, so you don't have to read the entire file into memory etc. Stream could just as well be from http, streamed over the internet. Possible demonstrate that with the httpMovieStream.js Play from file (ytdl.mp4)

videoStream.pipe(player.stdin);

Pipe video from drone to player

Play from droneVideoStream

videoStream.pipe(player.stdin);

Show that droneVideoStream is a stream made of streams Stress the point here that this is an infinite series, the drone has not yet produced the video test slide

Pipe video to file

Show slide Play back video if time (but not so important, as it's the same as the previous, except possibly corrupt in the end since it's not closed properly test slide

Pipe navdata to a database as well

Show the droneDataStream.js Using logdata.js test slide

Play back again if time using playDroneData.js

No slides, just piping data out again

videoStream.pipe(player.stdin);
db.createReadStream().pipe(process.stdout);

Consider using a slowpipe for piping slowly.

videoStream.pipe(player.stdin);
db.createReadStream().pipe(new Slowstream()).pipe(process.stdout);

Show facedetection stream

Show slide Stress that streams, though "normally" are buffers and strings, can be JSON objects etc. Very much like an eventemitter with objects (but with pause and buffering etc) test slide

Notice how streams are introduced

pipe That is it.

Introduce Rx

Can pipe this object-type stream into Rx for processing (this will break things as buffering and backpressure, this is just a hack I'm doing) Especially when writing from Rx back into a pipe.... Hopefully someone smart does this one day in a robust way.

test slide

test slide

Thanks you's and the like

I've learned a lot from here: https://github.com/substack/stream-handbook

Isaacs, bnoordhuis and ningu helped me out getting some of the new streams to work as intended.

And felixge for putting the nodecopter module out there.