WebTorrent can now play audio
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
module.exports = {
|
||||
isPlayable: isPlayable
|
||||
isPlayable,
|
||||
isVideo,
|
||||
isAudio
|
||||
}
|
||||
|
||||
var path = require('path')
|
||||
@@ -8,6 +10,15 @@ var path = require('path')
|
||||
* Determines whether a file in a torrent is audio/video we can play
|
||||
*/
|
||||
function isPlayable (file) {
|
||||
var extname = path.extname(file.name)
|
||||
return ['.mp4', '.m4v', '.webm', '.mov', '.mkv'].indexOf(extname) !== -1
|
||||
return isVideo(file) || isAudio(file)
|
||||
}
|
||||
|
||||
function isVideo (file) {
|
||||
var ext = path.extname(file.name)
|
||||
return ['.mp4', '.m4v', '.webm', '.mov', '.mkv'].indexOf(ext) !== -1
|
||||
}
|
||||
|
||||
function isAudio (file) {
|
||||
var ext = path.extname(file.name)
|
||||
return ['.mp3', '.aac', '.ogg', '.wav'].indexOf(ext) !== -1
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user