Skip to content

Commit 20a8e60

Browse files
authored
Merge pull request #2 from rkreich/master
NPM Support
2 parents 5c40043 + 5f8cd84 commit 20a8e60

File tree

2 files changed

+33
-3
lines changed

2 files changed

+33
-3
lines changed

fix-webm-duration.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1-
(function() {
1+
(function (name, definition) {
2+
if (typeof define === 'function' && define.amd) { // RequireJS / AMD
3+
define(definition);
4+
} else if (typeof module !== 'undefined' && module.exports) { // CommonJS / Node.js
5+
module.exports = definition();
6+
} else { // Direct include
7+
window.ysFixWebmDuration = definition();
8+
}
9+
})('fix-webm-duration', function () {
210
/*
311
* This is the list of possible WEBM file sections by their IDs.
412
* Possible types: Container, Binary, Uint, Int, String, Float, Date
@@ -457,7 +465,7 @@
457465
return new Blob([ this.source.buffer ], { type: 'video/webm' });
458466
};
459467

460-
window.ysFixWebmDuration = function(blob, duration, callback) {
468+
return function(blob, duration, callback) {
461469
try {
462470
var reader = new FileReader();
463471
reader.onloadend = function() {
@@ -476,4 +484,4 @@
476484
callback(blob);
477485
}
478486
};
479-
})();
487+
});

package.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"name": "fix-webm-duration",
3+
"version": "1.0.0",
4+
"description": "navigator.mediaDevices.getUserMedia + MediaRecorder create WEBM files without duration metadata. This library appends missing metadata section right to the file blob.",
5+
"main": "./fix-webm-duration.js",
6+
"scripts": {},
7+
"files": [
8+
"fix-webm-duration.js"
9+
],
10+
"repository": {
11+
"type": "git",
12+
"url": "git+https://github.com/yusitnikov/fix-webm-duration.git"
13+
},
14+
"keywords": [],
15+
"author": "Yuri Sitnikov <https://github.com/yusitnikov>",
16+
"license": "MIT",
17+
"bugs": {
18+
"url": "https://github.com/yusitnikov/fix-webm-duration/issues"
19+
},
20+
"homepage": "https://github.com/yusitnikov/fix-webm-duration",
21+
"devDependencies": {}
22+
}

0 commit comments

Comments
 (0)