mafintosh / torrent-stream

The low level streaming torrent engine that peerflix uses
MIT License
1.94k stars 228 forks source link

pausing the stream works improperly #104

Open acceptable-security opened 9 years ago

acceptable-security commented 9 years ago

Trying to pause the read stream will not only not happen instantly but also sometimes it'll keep reading and resuming the buffer will start later in the stream.

mafintosh commented 9 years ago

Can you share the code you use to pause it?

acceptable-security commented 9 years ago
stopSound: function (player, buffer, decoder) {
    buffer.pause();
    buffer.unpipe(decoder);
    decoder.unpipe(player);
    decoder.end();
    // player.end();
}

where player is a writable stream, decoder is a read and writable stream, and buffer is a readable stream. (the buffer streams into decoder which streams into player). buffer is the torrent-stream.