@tsparticles/plugin-export-video 4.0.0-alpha.2 → 4.0.0-alpha.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/500.min.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";(this.webpackChunk_tsparticles_plugin_export_video=this.webpackChunk_tsparticles_plugin_export_video||[]).push([[500],{500(e,t,i){i.d(t,{ExportVideoPlugin:()=>n});class n{id="export-video";async getPlugin(e){let{ExportVideoPluginInstance:t}=await i.e(867).then(i.bind(i,867));return new t(e)}loadOptions(){}needsPlugin(){return!0}}}}]);
package/867.min.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";(this.webpackChunk_tsparticles_plugin_export_video=this.webpackChunk_tsparticles_plugin_export_video||[]).push([[867],{867(e,t,p){p.d(t,{ExportVideoPluginInstance:()=>a});var s=p(303);let o=["webm","ogg","mp4","x-matroska"],r=["vp9","vp9.0","vp8","vp8.0","avc1","av1","h265","h.265","h264","h.264","opus","pcm","aac","mpeg","mp4a"];class a{_container;_supportedTypes=[];constructor(e){this._container=e,this._supportedTypes=function(){let e=[];return o.forEach(t=>{let p=`video/${t}`;r.forEach(t=>{[`${p};codecs=${t}`,`${p};codecs=${t.toUpperCase()}`].forEach(t=>{MediaRecorder.isTypeSupported(t)&&e.push(t)})}),MediaRecorder.isTypeSupported(p)&&e.push(p)}),e}()}async export(e,t){let p={supported:!1};return"video"===e&&(p.supported=!0,p.blob=await this._exportVideo(t)),p}_exportVideo=async e=>{let t=this._container.canvas.element;if(t)return new Promise(p=>{let o=t.captureStream(e.fps??this._container.actualOptions.fpsLimit),r=e.mimeType??this._supportedTypes[0],a=new MediaRecorder(o,{mimeType:r}),i=[];a.addEventListener("dataavailable",e=>{i.push(e.data)}),a.addEventListener("stop",()=>{p(new Blob(i,{type:r}))}),a.start(),setTimeout(()=>{a.stop()},e.duration??5*s.millisecondsToSeconds)})}}}}]);
@@ -1,10 +1,8 @@
1
- import { ExportVideoInstance } from "./ExportVideoInstance.js";
2
1
  export class ExportVideoPlugin {
3
- constructor() {
4
- this.id = "export-video";
5
- }
6
- getPlugin(container) {
7
- return Promise.resolve(new ExportVideoInstance(container));
2
+ id = "export-video";
3
+ async getPlugin(container) {
4
+ const { ExportVideoPluginInstance } = await import("./ExportVideoPluginInstance.js");
5
+ return new ExportVideoPluginInstance(container);
8
6
  }
9
7
  loadOptions() {
10
8
  }
@@ -36,30 +36,10 @@ function getVideoSupportedMimeTypes() {
36
36
  });
37
37
  return supported;
38
38
  }
39
- export class ExportVideoInstance {
39
+ export class ExportVideoPluginInstance {
40
+ _container;
41
+ _supportedTypes = [];
40
42
  constructor(container) {
41
- this._supportedTypes = [];
42
- this._exportVideo = async (data) => {
43
- const element = this._container.canvas.element;
44
- if (!element) {
45
- return;
46
- }
47
- return new Promise(resolve => {
48
- const stream = element.captureStream(data.fps ?? this._container.actualOptions.fpsLimit), firstIndex = 0, mimeType = data.mimeType ?? this._supportedTypes[firstIndex], recorder = new MediaRecorder(stream, {
49
- mimeType,
50
- }), chunks = [], defaultDuration = 5;
51
- recorder.addEventListener("dataavailable", (event) => {
52
- chunks.push(event.data);
53
- });
54
- recorder.addEventListener("stop", () => {
55
- resolve(new Blob(chunks, { type: mimeType }));
56
- });
57
- recorder.start();
58
- setTimeout(() => {
59
- recorder.stop();
60
- }, data.duration ?? defaultDuration * millisecondsToSeconds);
61
- });
62
- };
63
43
  this._container = container;
64
44
  this._supportedTypes = getVideoSupportedMimeTypes();
65
45
  }
@@ -75,4 +55,25 @@ export class ExportVideoInstance {
75
55
  }
76
56
  return res;
77
57
  }
58
+ _exportVideo = async (data) => {
59
+ const element = this._container.canvas.element;
60
+ if (!element) {
61
+ return;
62
+ }
63
+ return new Promise(resolve => {
64
+ const stream = element.captureStream(data.fps ?? this._container.actualOptions.fpsLimit), firstIndex = 0, mimeType = data.mimeType ?? this._supportedTypes[firstIndex], recorder = new MediaRecorder(stream, {
65
+ mimeType,
66
+ }), chunks = [], defaultDuration = 5;
67
+ recorder.addEventListener("dataavailable", (event) => {
68
+ chunks.push(event.data);
69
+ });
70
+ recorder.addEventListener("stop", () => {
71
+ resolve(new Blob(chunks, { type: mimeType }));
72
+ });
73
+ recorder.start();
74
+ setTimeout(() => {
75
+ recorder.stop();
76
+ }, data.duration ?? defaultDuration * millisecondsToSeconds);
77
+ });
78
+ };
78
79
  }
package/browser/index.js CHANGED
@@ -1,6 +1,6 @@
1
- export function loadExportVideoPlugin(engine) {
2
- engine.checkVersion("4.0.0-alpha.2");
3
- engine.register(async (e) => {
1
+ export async function loadExportVideoPlugin(engine) {
2
+ engine.checkVersion("4.0.0-alpha.21");
3
+ await engine.register(async (e) => {
4
4
  const { ExportVideoPlugin } = await import("./ExportVideoPlugin.js");
5
5
  e.addPlugin(new ExportVideoPlugin());
6
6
  });
@@ -1,10 +1,8 @@
1
- import { ExportVideoInstance } from "./ExportVideoInstance.js";
2
1
  export class ExportVideoPlugin {
3
- constructor() {
4
- this.id = "export-video";
5
- }
6
- getPlugin(container) {
7
- return Promise.resolve(new ExportVideoInstance(container));
2
+ id = "export-video";
3
+ async getPlugin(container) {
4
+ const { ExportVideoPluginInstance } = await import("./ExportVideoPluginInstance.js");
5
+ return new ExportVideoPluginInstance(container);
8
6
  }
9
7
  loadOptions() {
10
8
  }
@@ -36,30 +36,10 @@ function getVideoSupportedMimeTypes() {
36
36
  });
37
37
  return supported;
38
38
  }
39
- export class ExportVideoInstance {
39
+ export class ExportVideoPluginInstance {
40
+ _container;
41
+ _supportedTypes = [];
40
42
  constructor(container) {
41
- this._supportedTypes = [];
42
- this._exportVideo = async (data) => {
43
- const element = this._container.canvas.element;
44
- if (!element) {
45
- return;
46
- }
47
- return new Promise(resolve => {
48
- const stream = element.captureStream(data.fps ?? this._container.actualOptions.fpsLimit), firstIndex = 0, mimeType = data.mimeType ?? this._supportedTypes[firstIndex], recorder = new MediaRecorder(stream, {
49
- mimeType,
50
- }), chunks = [], defaultDuration = 5;
51
- recorder.addEventListener("dataavailable", (event) => {
52
- chunks.push(event.data);
53
- });
54
- recorder.addEventListener("stop", () => {
55
- resolve(new Blob(chunks, { type: mimeType }));
56
- });
57
- recorder.start();
58
- setTimeout(() => {
59
- recorder.stop();
60
- }, data.duration ?? defaultDuration * millisecondsToSeconds);
61
- });
62
- };
63
43
  this._container = container;
64
44
  this._supportedTypes = getVideoSupportedMimeTypes();
65
45
  }
@@ -75,4 +55,25 @@ export class ExportVideoInstance {
75
55
  }
76
56
  return res;
77
57
  }
58
+ _exportVideo = async (data) => {
59
+ const element = this._container.canvas.element;
60
+ if (!element) {
61
+ return;
62
+ }
63
+ return new Promise(resolve => {
64
+ const stream = element.captureStream(data.fps ?? this._container.actualOptions.fpsLimit), firstIndex = 0, mimeType = data.mimeType ?? this._supportedTypes[firstIndex], recorder = new MediaRecorder(stream, {
65
+ mimeType,
66
+ }), chunks = [], defaultDuration = 5;
67
+ recorder.addEventListener("dataavailable", (event) => {
68
+ chunks.push(event.data);
69
+ });
70
+ recorder.addEventListener("stop", () => {
71
+ resolve(new Blob(chunks, { type: mimeType }));
72
+ });
73
+ recorder.start();
74
+ setTimeout(() => {
75
+ recorder.stop();
76
+ }, data.duration ?? defaultDuration * millisecondsToSeconds);
77
+ });
78
+ };
78
79
  }
package/cjs/index.js CHANGED
@@ -1,6 +1,6 @@
1
- export function loadExportVideoPlugin(engine) {
2
- engine.checkVersion("4.0.0-alpha.2");
3
- engine.register(async (e) => {
1
+ export async function loadExportVideoPlugin(engine) {
2
+ engine.checkVersion("4.0.0-alpha.21");
3
+ await engine.register(async (e) => {
4
4
  const { ExportVideoPlugin } = await import("./ExportVideoPlugin.js");
5
5
  e.addPlugin(new ExportVideoPlugin());
6
6
  });
@@ -0,0 +1,30 @@
1
+ /*!
2
+ * Author : Matteo Bruni
3
+ * MIT license: https://opensource.org/licenses/MIT
4
+ * Demo / Generator : https://particles.js.org/
5
+ * GitHub : https://www.github.com/matteobruni/tsparticles
6
+ * How to use? : Check the GitHub README
7
+ * v4.0.0-alpha.21
8
+ */
9
+ "use strict";
10
+ /*
11
+ * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
12
+ * This devtool is neither made for production nor for readable output files.
13
+ * It uses "eval()" calls to create a separate source file in the browser devtools.
14
+ * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
15
+ * or disable the default devtool with "devtool: false".
16
+ * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
17
+ */
18
+ (this["webpackChunk_tsparticles_plugin_export_video"] = this["webpackChunk_tsparticles_plugin_export_video"] || []).push([["dist_browser_ExportVideoPluginInstance_js"],{
19
+
20
+ /***/ "./dist/browser/ExportVideoPluginInstance.js"
21
+ /*!***************************************************!*\
22
+ !*** ./dist/browser/ExportVideoPluginInstance.js ***!
23
+ \***************************************************/
24
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
25
+
26
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ExportVideoPluginInstance: () => (/* binding */ ExportVideoPluginInstance)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n\nconst videoTypes = [\n \"webm\",\n \"ogg\",\n \"mp4\",\n \"x-matroska\"\n], codecs = [\n \"vp9\",\n \"vp9.0\",\n \"vp8\",\n \"vp8.0\",\n \"avc1\",\n \"av1\",\n \"h265\",\n \"h.265\",\n \"h264\",\n \"h.264\",\n \"opus\",\n \"pcm\",\n \"aac\",\n \"mpeg\",\n \"mp4a\"\n];\nfunction getVideoSupportedMimeTypes() {\n const isSupported = (type)=>MediaRecorder.isTypeSupported(type), supported = [];\n videoTypes.forEach((type)=>{\n const mimeType = `video/${type}`;\n codecs.forEach((codec)=>{\n [\n `${mimeType};codecs=${codec}`,\n `${mimeType};codecs=${codec.toUpperCase()}`\n ].forEach((variation)=>{\n if (isSupported(variation)) {\n supported.push(variation);\n }\n });\n });\n if (isSupported(mimeType)) {\n supported.push(mimeType);\n }\n });\n return supported;\n}\nclass ExportVideoPluginInstance {\n _container;\n _supportedTypes = [];\n constructor(container){\n this._container = container;\n this._supportedTypes = getVideoSupportedMimeTypes();\n }\n async export(type, data) {\n const res = {\n supported: false\n };\n switch(type){\n case \"video\":\n res.supported = true;\n res.blob = await this._exportVideo(data);\n break;\n }\n return res;\n }\n _exportVideo = async (data)=>{\n const element = this._container.canvas.element;\n if (!element) {\n return;\n }\n return new Promise((resolve)=>{\n const stream = element.captureStream(data.fps ?? this._container.actualOptions.fpsLimit), firstIndex = 0, mimeType = data.mimeType ?? this._supportedTypes[firstIndex], recorder = new MediaRecorder(stream, {\n mimeType\n }), chunks = [], defaultDuration = 5;\n recorder.addEventListener(\"dataavailable\", (event)=>{\n chunks.push(event.data);\n });\n recorder.addEventListener(\"stop\", ()=>{\n resolve(new Blob(chunks, {\n type: mimeType\n }));\n });\n recorder.start();\n setTimeout(()=>{\n recorder.stop();\n }, data.duration ?? defaultDuration * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.millisecondsToSeconds);\n });\n };\n}\n\n\n//# sourceURL=webpack://@tsparticles/plugin-export-video/./dist/browser/ExportVideoPluginInstance.js?\n}");
27
+
28
+ /***/ }
29
+
30
+ }]);
@@ -4,7 +4,7 @@
4
4
  * Demo / Generator : https://particles.js.org/
5
5
  * GitHub : https://www.github.com/matteobruni/tsparticles
6
6
  * How to use? : Check the GitHub README
7
- * v4.0.0-alpha.2
7
+ * v4.0.0-alpha.21
8
8
  */
9
9
  "use strict";
10
10
  /*
@@ -17,23 +17,13 @@
17
17
  */
18
18
  (this["webpackChunk_tsparticles_plugin_export_video"] = this["webpackChunk_tsparticles_plugin_export_video"] || []).push([["dist_browser_ExportVideoPlugin_js"],{
19
19
 
20
- /***/ "./dist/browser/ExportVideoInstance.js"
21
- /*!*********************************************!*\
22
- !*** ./dist/browser/ExportVideoInstance.js ***!
23
- \*********************************************/
24
- (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
25
-
26
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ExportVideoInstance: () => (/* binding */ ExportVideoInstance)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n\nconst videoTypes = [\"webm\", \"ogg\", \"mp4\", \"x-matroska\"],\n codecs = [\"vp9\", \"vp9.0\", \"vp8\", \"vp8.0\", \"avc1\", \"av1\", \"h265\", \"h.265\", \"h264\", \"h.264\", \"opus\", \"pcm\", \"aac\", \"mpeg\", \"mp4a\"];\nfunction getVideoSupportedMimeTypes() {\n const isSupported = type => MediaRecorder.isTypeSupported(type),\n supported = [];\n videoTypes.forEach(type => {\n const mimeType = `video/${type}`;\n codecs.forEach(codec => {\n [`${mimeType};codecs=${codec}`, `${mimeType};codecs=${codec.toUpperCase()}`].forEach(variation => {\n if (isSupported(variation)) {\n supported.push(variation);\n }\n });\n });\n if (isSupported(mimeType)) {\n supported.push(mimeType);\n }\n });\n return supported;\n}\nclass ExportVideoInstance {\n constructor(container) {\n this._supportedTypes = [];\n this._exportVideo = async data => {\n const element = this._container.canvas.element;\n if (!element) {\n return;\n }\n return new Promise(resolve => {\n const stream = element.captureStream(data.fps ?? this._container.actualOptions.fpsLimit),\n firstIndex = 0,\n mimeType = data.mimeType ?? this._supportedTypes[firstIndex],\n recorder = new MediaRecorder(stream, {\n mimeType\n }),\n chunks = [],\n defaultDuration = 5;\n recorder.addEventListener(\"dataavailable\", event => {\n chunks.push(event.data);\n });\n recorder.addEventListener(\"stop\", () => {\n resolve(new Blob(chunks, {\n type: mimeType\n }));\n });\n recorder.start();\n setTimeout(() => {\n recorder.stop();\n }, data.duration ?? defaultDuration * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.millisecondsToSeconds);\n });\n };\n this._container = container;\n this._supportedTypes = getVideoSupportedMimeTypes();\n }\n async export(type, data) {\n const res = {\n supported: false\n };\n switch (type) {\n case \"video\":\n res.supported = true;\n res.blob = await this._exportVideo(data);\n break;\n }\n return res;\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-export-video/./dist/browser/ExportVideoInstance.js?\n}");
27
-
28
- /***/ },
29
-
30
20
  /***/ "./dist/browser/ExportVideoPlugin.js"
31
21
  /*!*******************************************!*\
32
22
  !*** ./dist/browser/ExportVideoPlugin.js ***!
33
23
  \*******************************************/
34
24
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
35
25
 
36
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ExportVideoPlugin: () => (/* binding */ ExportVideoPlugin)\n/* harmony export */ });\n/* harmony import */ var _ExportVideoInstance_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ExportVideoInstance.js */ \"./dist/browser/ExportVideoInstance.js\");\n\nclass ExportVideoPlugin {\n constructor() {\n this.id = \"export-video\";\n }\n getPlugin(container) {\n return Promise.resolve(new _ExportVideoInstance_js__WEBPACK_IMPORTED_MODULE_0__.ExportVideoInstance(container));\n }\n loadOptions() {}\n needsPlugin() {\n return true;\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-export-video/./dist/browser/ExportVideoPlugin.js?\n}");
26
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ExportVideoPlugin: () => (/* binding */ ExportVideoPlugin)\n/* harmony export */ });\nclass ExportVideoPlugin {\n id = \"export-video\";\n async getPlugin(container) {\n const { ExportVideoPluginInstance } = await __webpack_require__.e(/*! import() */ \"dist_browser_ExportVideoPluginInstance_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./ExportVideoPluginInstance.js */ \"./dist/browser/ExportVideoPluginInstance.js\"));\n return new ExportVideoPluginInstance(container);\n }\n loadOptions() {}\n needsPlugin() {\n return true;\n }\n}\n\n\n//# sourceURL=webpack://@tsparticles/plugin-export-video/./dist/browser/ExportVideoPlugin.js?\n}");
37
27
 
38
28
  /***/ }
39
29
 
@@ -1,10 +1,8 @@
1
- import { ExportVideoInstance } from "./ExportVideoInstance.js";
2
1
  export class ExportVideoPlugin {
3
- constructor() {
4
- this.id = "export-video";
5
- }
6
- getPlugin(container) {
7
- return Promise.resolve(new ExportVideoInstance(container));
2
+ id = "export-video";
3
+ async getPlugin(container) {
4
+ const { ExportVideoPluginInstance } = await import("./ExportVideoPluginInstance.js");
5
+ return new ExportVideoPluginInstance(container);
8
6
  }
9
7
  loadOptions() {
10
8
  }
@@ -36,30 +36,10 @@ function getVideoSupportedMimeTypes() {
36
36
  });
37
37
  return supported;
38
38
  }
39
- export class ExportVideoInstance {
39
+ export class ExportVideoPluginInstance {
40
+ _container;
41
+ _supportedTypes = [];
40
42
  constructor(container) {
41
- this._supportedTypes = [];
42
- this._exportVideo = async (data) => {
43
- const element = this._container.canvas.element;
44
- if (!element) {
45
- return;
46
- }
47
- return new Promise(resolve => {
48
- const stream = element.captureStream(data.fps ?? this._container.actualOptions.fpsLimit), firstIndex = 0, mimeType = data.mimeType ?? this._supportedTypes[firstIndex], recorder = new MediaRecorder(stream, {
49
- mimeType,
50
- }), chunks = [], defaultDuration = 5;
51
- recorder.addEventListener("dataavailable", (event) => {
52
- chunks.push(event.data);
53
- });
54
- recorder.addEventListener("stop", () => {
55
- resolve(new Blob(chunks, { type: mimeType }));
56
- });
57
- recorder.start();
58
- setTimeout(() => {
59
- recorder.stop();
60
- }, data.duration ?? defaultDuration * millisecondsToSeconds);
61
- });
62
- };
63
43
  this._container = container;
64
44
  this._supportedTypes = getVideoSupportedMimeTypes();
65
45
  }
@@ -75,4 +55,25 @@ export class ExportVideoInstance {
75
55
  }
76
56
  return res;
77
57
  }
58
+ _exportVideo = async (data) => {
59
+ const element = this._container.canvas.element;
60
+ if (!element) {
61
+ return;
62
+ }
63
+ return new Promise(resolve => {
64
+ const stream = element.captureStream(data.fps ?? this._container.actualOptions.fpsLimit), firstIndex = 0, mimeType = data.mimeType ?? this._supportedTypes[firstIndex], recorder = new MediaRecorder(stream, {
65
+ mimeType,
66
+ }), chunks = [], defaultDuration = 5;
67
+ recorder.addEventListener("dataavailable", (event) => {
68
+ chunks.push(event.data);
69
+ });
70
+ recorder.addEventListener("stop", () => {
71
+ resolve(new Blob(chunks, { type: mimeType }));
72
+ });
73
+ recorder.start();
74
+ setTimeout(() => {
75
+ recorder.stop();
76
+ }, data.duration ?? defaultDuration * millisecondsToSeconds);
77
+ });
78
+ };
78
79
  }
package/esm/index.js CHANGED
@@ -1,6 +1,6 @@
1
- export function loadExportVideoPlugin(engine) {
2
- engine.checkVersion("4.0.0-alpha.2");
3
- engine.register(async (e) => {
1
+ export async function loadExportVideoPlugin(engine) {
2
+ engine.checkVersion("4.0.0-alpha.21");
3
+ await engine.register(async (e) => {
4
4
  const { ExportVideoPlugin } = await import("./ExportVideoPlugin.js");
5
5
  e.addPlugin(new ExportVideoPlugin());
6
6
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsparticles/plugin-export-video",
3
- "version": "4.0.0-alpha.2",
3
+ "version": "4.0.0-alpha.21",
4
4
  "description": "tsParticles export video plugin",
5
5
  "homepage": "https://particles.js.org",
6
6
  "repository": {
@@ -100,7 +100,7 @@
100
100
  "./package.json": "./package.json"
101
101
  },
102
102
  "dependencies": {
103
- "@tsparticles/engine": "4.0.0-alpha.2"
103
+ "@tsparticles/engine": "4.0.0-alpha.21"
104
104
  },
105
105
  "publishConfig": {
106
106
  "access": "public"