etro 0.8.2 → 0.8.3

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/CHANGELOG.md CHANGED
@@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](http://keepachangelog.com/)
6
6
  and this project adheres to [Semantic Versioning](http://semver.org/).
7
7
 
8
+ ## [0.8.3] - 2022-01-18
9
+ ### Fixed
10
+ - Recording not respecting the `type` option.
11
+ - Effects throwing 'empty canvas' errors when the target's width or height is 0.
12
+
8
13
  ## [0.8.2] - 2021-07-08
9
14
  ### Fixed
10
15
  - `GaussianBlur` effect throwing a `TypeError` when applied to a movie or layer (the problem persisted).
@@ -188,6 +193,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
188
193
  - Gaussian blur
189
194
  - Transform
190
195
 
196
+ [0.8.3]: https://github.com/etro-js/etro/compare/v0.8.2...v0.8.3
191
197
  [0.8.2]: https://github.com/etro-js/etro/compare/v0.8.1...v0.8.2
192
198
  [0.8.1]: https://github.com/etro-js/etro/compare/v0.8.0...v0.8.1
193
199
  [0.8.0]: https://github.com/etro-js/etro/compare/v0.7.0...v0.8.0
package/README.md CHANGED
@@ -10,7 +10,7 @@
10
10
  Etro is a typescript framework for programmatically editing videos. Similar
11
11
  to GUI-based video-editing software, it lets you layer media and other
12
12
  content on a timeline. Audio, image, video and other tracks are supported,
13
- along with powerful video effectts for existing tracks. Being very flexible
13
+ along with powerful video effects for existing tracks. Being very flexible
14
14
  and extendable, you can choose to only use the core components or define your
15
15
  own.
16
16
 
package/dist/etro-cjs.js CHANGED
@@ -903,6 +903,11 @@ var Visual = /** @class */ (function (_super) {
903
903
  * Render visual output
904
904
  */
905
905
  Visual.prototype.render = function () {
906
+ // Prevent empty canvas errors if the width or height is 0
907
+ var width = val(this, 'width', this.currentTime);
908
+ var height = val(this, 'height', this.currentTime);
909
+ if (width === 0 || height === 0)
910
+ return;
906
911
  this.beginRender();
907
912
  this.doRender();
908
913
  this.endRender();
@@ -8909,6 +8914,9 @@ var Movie = /** @class */ (function () {
8909
8914
  throw new Error('Both video and audio cannot be disabled');
8910
8915
  if (!this.paused)
8911
8916
  throw new Error('Cannot record movie while already playing or recording');
8917
+ var mimeType = options.type || 'video/webm';
8918
+ if (MediaRecorder && MediaRecorder.isTypeSupported && !MediaRecorder.isTypeSupported(mimeType))
8919
+ throw new Error('Please pass a valid MIME type for the exported video');
8912
8920
  return new Promise(function (resolve, reject) {
8913
8921
  var canvasCache = _this.canvas;
8914
8922
  // Record on a temporary canvas context
@@ -8936,7 +8944,8 @@ var Movie = /** @class */ (function () {
8936
8944
  publish(_this, 'movie.audiodestinationupdate', { movie: _this, destination: audioDestination });
8937
8945
  }
8938
8946
  var stream = new MediaStream(tracks);
8939
- var mediaRecorder = new MediaRecorder(stream, options.mediaRecorderOptions);
8947
+ var mediaRecorderOptions = __assign(__assign({}, (options.mediaRecorderOptions || {})), { mimeType: mimeType });
8948
+ var mediaRecorder = new MediaRecorder(stream, mediaRecorderOptions);
8940
8949
  mediaRecorder.ondataavailable = function (event) {
8941
8950
  // if (this._paused) reject(new Error("Recording was interrupted"));
8942
8951
  if (event.data.size > 0)
@@ -8951,7 +8960,7 @@ var Movie = /** @class */ (function () {
8951
8960
  _this._mediaRecorder = null;
8952
8961
  // Construct the exported video out of all the frame blobs.
8953
8962
  resolve(new Blob(recordedChunks, {
8954
- type: options.type || 'video/webm'
8963
+ type: mimeType
8955
8964
  }));
8956
8965
  };
8957
8966
  mediaRecorder.onerror = reject;
package/dist/etro-iife.js CHANGED
@@ -904,6 +904,11 @@ var etro = (function () {
904
904
  * Render visual output
905
905
  */
906
906
  Visual.prototype.render = function () {
907
+ // Prevent empty canvas errors if the width or height is 0
908
+ var width = val(this, 'width', this.currentTime);
909
+ var height = val(this, 'height', this.currentTime);
910
+ if (width === 0 || height === 0)
911
+ return;
907
912
  this.beginRender();
908
913
  this.doRender();
909
914
  this.endRender();
@@ -8910,6 +8915,9 @@ var etro = (function () {
8910
8915
  throw new Error('Both video and audio cannot be disabled');
8911
8916
  if (!this.paused)
8912
8917
  throw new Error('Cannot record movie while already playing or recording');
8918
+ var mimeType = options.type || 'video/webm';
8919
+ if (MediaRecorder && MediaRecorder.isTypeSupported && !MediaRecorder.isTypeSupported(mimeType))
8920
+ throw new Error('Please pass a valid MIME type for the exported video');
8913
8921
  return new Promise(function (resolve, reject) {
8914
8922
  var canvasCache = _this.canvas;
8915
8923
  // Record on a temporary canvas context
@@ -8937,7 +8945,8 @@ var etro = (function () {
8937
8945
  publish(_this, 'movie.audiodestinationupdate', { movie: _this, destination: audioDestination });
8938
8946
  }
8939
8947
  var stream = new MediaStream(tracks);
8940
- var mediaRecorder = new MediaRecorder(stream, options.mediaRecorderOptions);
8948
+ var mediaRecorderOptions = __assign(__assign({}, (options.mediaRecorderOptions || {})), { mimeType: mimeType });
8949
+ var mediaRecorder = new MediaRecorder(stream, mediaRecorderOptions);
8941
8950
  mediaRecorder.ondataavailable = function (event) {
8942
8951
  // if (this._paused) reject(new Error("Recording was interrupted"));
8943
8952
  if (event.data.size > 0)
@@ -8952,7 +8961,7 @@ var etro = (function () {
8952
8961
  _this._mediaRecorder = null;
8953
8962
  // Construct the exported video out of all the frame blobs.
8954
8963
  resolve(new Blob(recordedChunks, {
8955
- type: options.type || 'video/webm'
8964
+ type: mimeType
8956
8965
  }));
8957
8966
  };
8958
8967
  mediaRecorder.onerror = reject;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "etro",
3
- "version": "0.8.2",
3
+ "version": "0.8.3",
4
4
  "description": "An extendable video-editing framework for the browser and Node",
5
5
  "browser": "dist/etro-cjs.js",
6
6
  "types": "dist/index.d.ts",
@@ -28,8 +28,6 @@
28
28
  "ev": "0.0.7",
29
29
  "http-server": "^0.12.3",
30
30
  "jasmine": "^3.4.0",
31
- "jsdoc": "^3.6.3",
32
- "jsdoc-export-default-interop": "^0.3.1",
33
31
  "karma": "^6.1.1",
34
32
  "karma-chrome-launcher": "^3.1.0",
35
33
  "karma-es6-shim": "^1.0.0",
@@ -83,6 +83,12 @@ class Visual extends Base {
83
83
  * Render visual output
84
84
  */
85
85
  render (): void {
86
+ // Prevent empty canvas errors if the width or height is 0
87
+ const width = val(this, 'width', this.currentTime)
88
+ const height = val(this, 'height', this.currentTime)
89
+ if (width === 0 || height === 0)
90
+ return
91
+
86
92
  this.beginRender()
87
93
  this.doRender()
88
94
  this.endRender()
package/src/movie.ts CHANGED
@@ -255,6 +255,10 @@ export class Movie {
255
255
  if (!this.paused)
256
256
  throw new Error('Cannot record movie while already playing or recording')
257
257
 
258
+ const mimeType = options.type || 'video/webm'
259
+ if (MediaRecorder && MediaRecorder.isTypeSupported && !MediaRecorder.isTypeSupported(mimeType))
260
+ throw new Error('Please pass a valid MIME type for the exported video')
261
+
258
262
  return new Promise((resolve, reject) => {
259
263
  const canvasCache = this.canvas
260
264
  // Record on a temporary canvas context
@@ -285,7 +289,11 @@ export class Movie {
285
289
  )
286
290
  }
287
291
  const stream = new MediaStream(tracks)
288
- const mediaRecorder = new MediaRecorder(stream, options.mediaRecorderOptions)
292
+ const mediaRecorderOptions = {
293
+ ...(options.mediaRecorderOptions || {}),
294
+ mimeType
295
+ }
296
+ const mediaRecorder = new MediaRecorder(stream, mediaRecorderOptions)
289
297
  mediaRecorder.ondataavailable = event => {
290
298
  // if (this._paused) reject(new Error("Recording was interrupted"));
291
299
  if (event.data.size > 0)
@@ -303,7 +311,7 @@ export class Movie {
303
311
  // Construct the exported video out of all the frame blobs.
304
312
  resolve(
305
313
  new Blob(recordedChunks, {
306
- type: options.type || 'video/webm'
314
+ type: mimeType
307
315
  })
308
316
  )
309
317
  }