tav-media
Version:
Cross platform media editing framework
24 lines (23 loc) • 813 B
JavaScript
import { MediaReader } from './media-reader';
export class AudioReader {
constructor(filePath, bytesOffset, length) {
this.filePath = '';
this.bytesOffset = 0;
this.length = 0;
this.filePath = filePath;
this.bytesOffset = bytesOffset;
this.length = length;
}
makeReader() {
const videoTypeList = ['mp4', 'm2v', 'mkv', 'rmvb', 'wmv', 'avi', 'flv', 'mov', 'm4v'];
if (this.filePath === '') {
return MediaReader.MakeFromBytes(this.bytesOffset, this.length);
}
const words = this.filePath.split('.');
const type = words[words.length - 1];
if (videoTypeList.indexOf(type) > -1) {
return MediaReader.Make(this.filePath);
}
return MediaReader.Make(this.filePath);
}
}