Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/webtorrent/webtorrent.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormathiasvr <mathiasvr@gmail.com>2015-01-16 04:32:20 +0300
committermathiasvr <mathiasvr@gmail.com>2015-01-16 04:32:20 +0300
commit891373f485e3d13167ca925ea8ad4c5d7da952a8 (patch)
tree699ec787f76a406291a6a8f021bc5b414d735db2
parent6cbfa8c68a7222494426df0f560506ac0aff1a3d (diff)
Add <audio> tag streaming support for mp3 files
-rw-r--r--lib/file-stream.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/file-stream.js b/lib/file-stream.js
index cbf1319..9ca77ce 100644
--- a/lib/file-stream.js
+++ b/lib/file-stream.js
@@ -99,12 +99,15 @@ FileStream.prototype.pipe = function (dst) {
var self = this
var pipe = stream.Readable.prototype.pipe
- if (dst && dst.nodeName === 'VIDEO') { // <video> tag
+ if (dst && dst.nodeName === 'VIDEO' || dst.nodeName === 'AUDIO') { // <video> and <audio> tag
var type = self._extname === '.webm'
? 'video/webm; codecs="vorbis,vp8"'
: self._extname === '.mp4'
? 'video/mp4; codecs="avc1.42c01e,mp4a.40.2"'
- : undefined
+ : self._extname === '.mp3'
+ ? 'audio/mpeg'
+ : undefined
+ // TODO: consider renaming VideoStream to MediaStream, since it supports audio as well.
return pipe.call(self, new VideoStream(dst, { type: type }))
} else
return pipe.call(self, dst)