-
-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changed audio-frame-header-bug test file into test-code-file for gene…
…ric MP3 parsing tests. Related to #64
- Loading branch information
Showing
1 changed file
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import {} from "mocha"; | ||
import {assert} from 'chai'; | ||
import * as mm from '../src'; | ||
import * as path from 'path'; | ||
|
||
const t = assert; | ||
|
||
describe("Parse MP3 files", () => { | ||
|
||
it("should handle audio-frame-header-bug", function() { | ||
|
||
this.timeout(15000); // It takes a long time to parse | ||
|
||
const filePath = path.join(__dirname, 'samples', 'audio-frame-header-bug.mp3'); | ||
|
||
return mm.parseFile(filePath, {duration: true}).then(result => { | ||
// FooBar: 3:20.556 (8.844.527 samples); 44100 Hz => 200.5561678004535 seconds | ||
// t.strictEqual(result.format.duration, 200.59591666666665); // previous | ||
// t.strictEqual(result.format.duration, 200.5561678004535); // FooBar | ||
|
||
// If MPEG Layer II is accepted, it will give back third frame with a different frame length; | ||
// therefore it start counting actual parsable frames ending up on ~66.86 | ||
t.strictEqual(result.format.duration, 66.8647619047619); | ||
}); | ||
}); | ||
|
||
}); |