Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Playback example #21

Open
pschroen opened this issue Apr 25, 2016 · 5 comments
Open

Playback example #21

pschroen opened this issue Apr 25, 2016 · 5 comments

Comments

@pschroen
Copy link
Contributor

Feature request for either built-in playback support, or a Wiki with examples.

Here's one that handles both lossless and high quality with fluent-ffmpeg and speaker:

api.getStreamURL({id:22560696}, function (data) {
  var url = quality === 'lossless' ? data.url : 'rtmp://'+data.url;
  ffmpeg(url).format('wav').pipe(new Speaker(), {end:true}).on('finish', function () {
    console.log('track finished');
  });
});
@0xVasconcelos
Copy link
Owner

0xVasconcelos commented Apr 25, 2016

I'll think about the native playback method, but you're right about the Wiki. I'll try make something this week. 👍

Thanks friend!

@pschroen
Copy link
Contributor Author

Improved example with wav to avoid the pop at the beginning.

api.getStreamURL({id:22560696}, function (data) {
  var reader = new wav.Reader();
  reader.on('format', function (format) {
    reader.pipe(new Speaker(format));
  });
  var url = quality === 'lossless' ? data.url : 'rtmp://'+data.url,
  ffmpeg(url).format('wav').pipe(reader, {end:true}).on('finish', function () {
    console.log('track finished');
  });
});

@gyurobenjamin
Copy link
Contributor

Is it still working example? I can play any wav song via http(s) with this example, but not the tidal url what this plugin provide.

Error: ffmpeg exited with code 1: http://audio-enc.tidal.com/v2/0/baf5111593e2f509567fa2901941b6e4_26.flac?__token__=exp=1503781950~hmac=ef36e4ff2c2ec32881b54e73141ef856052440c355d88df26a08f2a6fbe8c849: Invalid data found when processing input

    at ChildProcess.<anonymous> (/../tidal/node_modules/fluent-ffmpeg/lib/processor.js:182:22)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:192:7)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)

Don't we need to do anything with the encryptionKey?

@gyurobenjamin
Copy link
Contributor

AAC / High quality version works well via rtmp. But lossless/high-res doesn't with FLAC. I downloaded the FLAC file and can't do anything with that.

Any idea?

@gyurobenjamin
Copy link
Contributor

Token was wrong. With some token the file will be encrypted. Check some possibilities here. https://github.com/arnesongit/plugin.audio.tidal2/blob/d633fc9b2d25acf728111460c796e405aece522a/resources/lib/koditidal.py#L733

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants