Closed feross closed 8 years ago
Hm, now that the file length isn't a required field, not sure this is easy to fix. Thoughts?
This isn't an issue for me anymore, since render-media
doesn't ever pass .mp3 file data into videostream
, but is there a way to detect that it's not a valid mp4 file?
Also, I'm curious, how does videostream
avoid calling createReadStream()
with invalid offsets? Pretty sure an invalid end
value (i.e. too big) will cause webtorrent to throw an exception.
I just fixed webtorrent to handle a really big end
value more graceully, by clamping to the torrent.length - 1
.
If you give videostream a file of the wrong type (like .mp3) it passes it to mp4box.js which doesn't realize that the file is not an MP4. It then asks for a crazy huge offset way bigger than the actual file length, which gets passed through to
file.createReadStream({ start: xxx, end: xxx })
and fails.Not a hugely important issue, since I shouldn't be giving it an .mp3, but just sharing since it would be nice if it was handled better.