node v6- (depened on buffer-v6-pollify)
- Video: only AVC
- Audio: only AAC
cd test && node index.js
const FlvDemux = require('flv-demux');
let decoder = new FlvDemux.Decoder();
decoder.on('header', header => {
// get flv header info
});
decoder.on('tag', tag => {
switch(tag.type){
case FlvDemux.DataTag.TYPE:
// get onMetaData info
break;
case FlvDemux.AudioTag.TYPE:
// get audio info
break;
case FlvDemux.VideoTag.TYPE:
// get video info
break;
}
});
// you can decode buffer again
decoder.decode(buffer);
setTimeout(()=>{
decoder.destroy();
}, 5000);