From 27196c2f9fc6ec46a569f6375710509b53c6df24 Mon Sep 17 00:00:00 2001 From: Raphael Date: Thu, 27 Jul 2017 03:13:35 +0200 Subject: [PATCH] docs update to topics/voice playFile example (#1716) * Update voice.md * Update voice.md * fixed my grammar * added requested spaces --- docs/topics/voice.md | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/docs/topics/voice.md b/docs/topics/voice.md index dc70eb0e9..c7e88d04b 100644 --- a/docs/topics/voice.md +++ b/docs/topics/voice.md @@ -46,11 +46,17 @@ have obtained a voice connection, we can start streaming audio to it. The follow file: **Playing a file:** + ```js -// To play a file, we need to give an absolute path to it +// Use an absolute path const dispatcher = connection.playFile('C:/Users/Discord/Desktop/myfile.mp3'); ``` +```js +// Or an dynamic path +const dispatcher = connection.playFile('./myfile.mp3'); +``` + Your file doesn't have to be just an mp3; ffmpeg can convert videos and audios of many formats. The `dispatcher` variable is an instance of a `StreamDispatcher`, which manages streaming a specific resource to a voice @@ -84,8 +90,7 @@ this can also be used: ```js connection.playStream(myReadableStream); -// If you don't want to use absolute paths, you can use -// fs.createReadStream to circumvent it +// You can use fs.createReadStream to create an ReadableStream const fs = require('fs'); const stream = fs.createReadStream('./test.mp3');