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

Add <audio> tag streaming support for mp3 files #245

Merged
merged 1 commit into from Jan 16, 2015
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -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

This comment has been minimized.

Copy link
@feross

feross Jan 16, 2015

Member

The if statement should be dst && (dst.nodeName === 'VIDEO' || dst.nodeName === 'AUDIO') because of order of operations and dst could be undefined. I'll fix.

This comment has been minimized.

Copy link
@mathiasvr

mathiasvr Jan 16, 2015

Author Contributor

Yes you are right! 👍

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)
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.