diff --git a/src/BlobBuffer.js b/src/BlobBuffer.js index f92ec90..7bfa87d 100644 --- a/src/BlobBuffer.js +++ b/src/BlobBuffer.js @@ -220,7 +220,7 @@ }; if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports = BlobBuffer(require('fs')); + module.exports = BlobBuffer; } else { window.BlobBuffer = BlobBuffer(null); } diff --git a/src/WebMWriter.js b/src/WebMWriter.js index 169357b..80d5468 100644 --- a/src/WebMWriter.js +++ b/src/WebMWriter.js @@ -920,7 +920,7 @@ }; if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { - module.exports = WebMWriter(require("./ArrayBufferDataStream"), require("./BlobBuffer")); + module.exports = WebMWriter; } else { window.WebMWriter = WebMWriter(window.ArrayBufferDataStream, window.BlobBuffer); } diff --git a/src/browser.js b/src/browser.js new file mode 100644 index 0000000..e98351d --- /dev/null +++ b/src/browser.js @@ -0,0 +1 @@ +module.exports = require("./WebMWriter")(require("./ArrayBufferDataStream"), require("./BlobBuffer")(null)); \ No newline at end of file diff --git a/src/main.js b/src/main.js new file mode 100644 index 0000000..8f561e1 --- /dev/null +++ b/src/main.js @@ -0,0 +1 @@ +module.exports = require("./WebMWriter")(require("./ArrayBufferDataStream"), require("./BlobBuffer")(require('fs'))); \ No newline at end of file diff --git a/src/package.json b/src/package.json index 796bf52..1264345 100644 --- a/src/package.json +++ b/src/package.json @@ -2,7 +2,8 @@ "name": "webm-writer", "version": "0.3.0", "description": "Render WebM videos from Canvas frames", - "main": "WebMWriter.js", + "main": "main.js", + "browser": "browser.js", "scripts": { "test": "electron-mocha --renderer" }, diff --git a/src/test/BlobBuffer.js b/src/test/BlobBuffer.js index 5cd78dd..04501d7 100644 --- a/src/test/BlobBuffer.js +++ b/src/test/BlobBuffer.js @@ -1,5 +1,5 @@ const - BlobBuffer = require("../BlobBuffer"); + BlobBuffer = require("../BlobBuffer")(require('fs')); function assert(test, message) { if (!test) { diff --git a/src/test/empty-video.js b/src/test/empty-video.js index 53fc5e5..315cf8e 100644 --- a/src/test/empty-video.js +++ b/src/test/empty-video.js @@ -1,5 +1,5 @@ const - WebMWriter = require("../WebMWriter"); + WebMWriter = require("../main"); describe("WebMWriter", function() { it("Doesn't crash when rendering a video with zero frames", function() {