{"action":"created","issue":{"url":"https://api.github.com/repos/fluent-ffmpeg/node-fluent-ffmpeg/issues/475","labels_url":"https://api.github.com/repos/fluent-ffmpeg/node-fluent-ffmpeg/issues/475/labels{/name}","comments_url":"https://api.github.com/repos/fluent-ffmpeg/node-fluent-ffmpeg/issues/475/comments","events_url":"https://api.github.com/repos/fluent-ffmpeg/node-fluent-ffmpeg/issues/475/events","html_url":"https://github.com/fluent-ffmpeg/node-fluent-ffmpeg/issues/475","id":119951264,"number":475,"title":"Overlapping Playback","user":{"login":"chrisjandrade","id":3063835,"avatar_url":"https://avatars.githubusercontent.com/u/3063835?v=3","gravatar_id":"","url":"https://api.github.com/users/chrisjandrade","html_url":"https://github.com/chrisjandrade","followers_url":"https://api.github.com/users/chrisjandrade/followers","following_url":"https://api.github.com/users/chrisjandrade/following{/other_user}","gists_url":"https://api.github.com/users/chrisjandrade/gists{/gist_id}","starred_url":"https://api.github.com/users/chrisjandrade/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrisjandrade/subscriptions","organizations_url":"https://api.github.com/users/chrisjandrade/orgs","repos_url":"https://api.github.com/users/chrisjandrade/repos","events_url":"https://api.github.com/users/chrisjandrade/events{/privacy}","received_events_url":"https://api.github.com/users/chrisjandrade/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/fluent-ffmpeg/node-fluent-ffmpeg/labels/Feedback%20needed","name":"Feedback needed","color":"02d7e1"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-12-02T14:19:37Z","updated_at":"2015-12-03T08:59:45Z","closed_at":null,"body":"Not sure if fluent-ffmpeg was intended to be used this way, but its worth a shot to see if there's a way to do this.  Or I'm going about this completely wrong.\r\n\r\nI am using fluent-ffmpeg, and node-speaker to allow the user to select some file, and then playback that file. For example\r\n    \r\n    this._passThru = stream.PassThrough();\r\n\r\n    this._cmd = ffmpeg(uri).\r\n       format('s16le').\r\n       pipe(this._passThru);\r\n\r\n\r\n    // some time later the user may choose to seek somewhere and start playing\r\n    this._cmd.seek(10).run();\r\n    this._passThru.pipe(new Speaker());\r\n\r\nsound plays, but the previous command is still pushing data through ```this._passThru``` so you'll hear the last command you execute playing, and the most recent command.  Basically, just hear the audio playing twice overlapping each other.\r\n\r\nAny ideas for dealing with this? I'm thinking I can just connect my PassThrough stream to some sink, that just consumes all the data.\r\n\r\n    var sink = new Writable();\r\n    sink._write = function (chunk, enc, next) {\r\n      next();\r\n    };\r\n    sink.on('finish', function () {\r\n      // start new command here.\r\n    });\r\n\r\nOr is it possible to SWITCH the stream I'm currently piping to?\r\n"},"comment":{"url":"https://api.github.com/repos/fluent-ffmpeg/node-fluent-ffmpeg/issues/comments/161556581","html_url":"https://github.com/fluent-ffmpeg/node-fluent-ffmpeg/issues/475#issuecomment-161556581","issue_url":"https://api.github.com/repos/fluent-ffmpeg/node-fluent-ffmpeg/issues/475","id":161556581,"user":{"login":"njoyard","id":127842,"avatar_url":"https://avatars.githubusercontent.com/u/127842?v=3","gravatar_id":"","url":"https://api.github.com/users/njoyard","html_url":"https://github.com/njoyard","followers_url":"https://api.github.com/users/njoyard/followers","following_url":"https://api.github.com/users/njoyard/following{/other_user}","gists_url":"https://api.github.com/users/njoyard/gists{/gist_id}","starred_url":"https://api.github.com/users/njoyard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/njoyard/subscriptions","organizations_url":"https://api.github.com/users/njoyard/orgs","repos_url":"https://api.github.com/users/njoyard/repos","events_url":"https://api.github.com/users/njoyard/events{/privacy}","received_events_url":"https://api.github.com/users/njoyard/received_events","type":"User","site_admin":false},"created_at":"2015-12-03T08:59:45Z","updated_at":"2015-12-03T08:59:45Z","body":"Oh, it must have already converted the data then.\r\n\r\nYou'll need to find a way to break the passthrough stream, I think, and hope that Speaker only pops data from the passthrough when actually reading the audio (ie. does not buffer the audio too long, in which case you'll have to look at a way to break the Speaker instance...)"}}