etro-js / etro

Typescript video-editing framework for the browser
https://etrojs.dev
GNU General Public License v3.0
899 stars 86 forks source link

:bug: Only stop layers when they're active #201

Closed leanjunio closed 1 year ago

leanjunio commented 1 year ago

In Movie#pause, add a check to only stop a layer if its active property is set to true.

I also had to install canvas because I was getting an unfound module error:

➜  etro git:(b46da40) npm test 

> etro@0.9.1 test
> karma start

17 04 2023 06:47:54.289:INFO [compiler.karma-typescript]: Compiling project using Typescript 4.7.4
17 04 2023 06:47:56.417:INFO [compiler.karma-typescript]: Compiled 64 files in 2090 ms.
17 04 2023 06:47:56.960:ERROR [karma-server]: UncaughtException: Error: Unable to resolve module [canvas] from [/home/leanjunio/Documents/work/open-source/etro/node_modules/resemblejs/resemble.js]
{
  "basedir": "/home/leanjunio/Documents/work/open-source/etro",
  "extensions": [
    ".js",
    ".json",
    ".mjs",
    ".ts",
    ".tsx"
  ],
  "moduleDirectory": [
    "node_modules"
  ],
  "modules": {
    "assert": "/home/leanjunio/Documents/work/open-source/etro/node_modules/assert/build/assert.js",
    "buffer": "/home/leanjunio/Documents/work/open-source/etro/node_modules/buffer/index.js",
    "child_process": "/home/leanjunio/Documents/work/open-source/etro/node_modules/karma-typescript/dist/bundler/resolve/empty.js",
    "cluster": "/home/leanjunio/Documents/work/open-source/etro/node_modules/karma-typescript/dist/bundler/resolve/empty.js",
    "console": "/home/leanjunio/Documents/work/open-source/etro/node_modules/console-browserify/index.js",
    "constants": "/home/leanjunio/Documents/work/open-source/etro/node_modules/constants-browserify/constants.json",
    "crypto": "/home/leanjunio/Documents/work/open-source/etro/node_modules/crypto-browserify/index.js",
    "dgram": "/home/leanjunio/Documents/work/open-source/etro/node_modules/karma-typescript/dist/bundler/resolve/empty.js",
    "dns": "/home/leanjunio/Documents/work/open-source/etro/node_modules/karma-typescript/dist/bundler/resolve/empty.js",
    "domain": "/home/leanjunio/Documents/work/open-source/etro/node_modules/domain-browser/source/index.js",
    "events": "/home/leanjunio/Documents/work/open-source/etro/node_modules/events/events.js",
    "fs": "/home/leanjunio/Documents/work/open-source/etro/node_modules/karma-typescript/dist/bundler/resolve/empty.js",
    "http": "/home/leanjunio/Documents/work/open-source/etro/node_modules/stream-http/index.js",
    "https": "/home/leanjunio/Documents/work/open-source/etro/node_modules/https-browserify/index.js",
    "module": "/home/leanjunio/Documents/work/open-source/etro/node_modules/karma-typescript/dist/bundler/resolve/empty.js",
    "net": "/home/leanjunio/Documents/work/open-source/etro/node_modules/karma-typescript/dist/bundler/resolve/empty.js",
    "os": "/home/leanjunio/Documents/work/open-source/etro/node_modules/os-browserify/browser.js",
    "path": "/home/leanjunio/Documents/work/open-source/etro/node_modules/path-browserify/index.js",
    "punycode": "/home/leanjunio/Documents/work/open-source/etro/node_modules/punycode/punycode.js",
    "querystring": "/home/leanjunio/Documents/work/open-source/etro/node_modules/querystring-es3/index.js",
    "readline": "/home/leanjunio/Documents/work/open-source/etro/node_modules/karma-typescript/dist/bundler/resolve/empty.js",
    "repl": "/home/leanjunio/Documents/work/open-source/etro/node_modules/karma-typescript/dist/bundler/resolve/empty.js",
    "stream": "/home/leanjunio/Documents/work/open-source/etro/node_modules/stream-browserify/index.js",
    "_stream_duplex": "/home/leanjunio/Documents/work/open-source/etro/node_modules/readable-stream/lib/_stream_duplex.js",
    "_stream_passthrough": "/home/leanjunio/Documents/work/open-source/etro/node_modules/readable-stream/lib/_stream_passthrough.js",
    "_stream_readable": "/home/leanjunio/Documents/work/open-source/etro/node_modules/readable-stream/lib/_stream_readable.js",
    "_stream_transform": "/home/leanjunio/Documents/work/open-source/etro/node_modules/readable-stream/lib/_stream_transform.js",
    "_stream_writable": "/home/leanjunio/Documents/work/open-source/etro/node_modules/readable-stream/lib/_stream_writable.js",
    "string_decoder": "/home/leanjunio/Documents/work/open-source/etro/node_modules/string_decoder/lib/string_decoder.js",
    "sys": "/home/leanjunio/Documents/work/open-source/etro/node_modules/util/util.js",
    "timers": "/home/leanjunio/Documents/work/open-source/etro/node_modules/timers-browserify/main.js",
    "tls": "/home/leanjunio/Documents/work/open-source/etro/node_modules/karma-typescript/dist/bundler/resolve/empty.js",
    "tty": "/home/leanjunio/Documents/work/open-source/etro/node_modules/tty-browserify/index.js",
    "url": "/home/leanjunio/Documents/work/open-source/etro/node_modules/url/url.js",
    "util": "/home/leanjunio/Documents/work/open-source/etro/node_modules/util/util.js",
    "vm": "/home/leanjunio/Documents/work/open-source/etro/node_modules/vm-browserify/index.js",
    "zlib": "/home/leanjunio/Documents/work/open-source/etro/node_modules/browserify-zlib/lib/index.js",
    "_process": "/home/leanjunio/Documents/work/open-source/etro/node_modules/process/browser.js"
  },
  "filename": "",
  "paths": [
    "/home/leanjunio/.node_modules",
    "/home/leanjunio/.node_libraries"
  ]
}
Error: Cannot find module 'canvas' from '/home/leanjunio/Documents/work/open-source/etro/node_modules/resemblejs/resemble.js'
    at /home/leanjunio/Documents/work/open-source/etro/node_modules/karma-typescript/dist/bundler/resolve/resolver.js:185:27
    at /home/leanjunio/Documents/work/open-source/etro/node_modules/browser-resolve/index.js:265:24
    at /home/leanjunio/Documents/work/open-source/etro/node_modules/resolve/lib/async.js:148:17
    at processDirs (/home/leanjunio/Documents/work/open-source/etro/node_modules/resolve/lib/async.js:299:39)
    at isdir (/home/leanjunio/Documents/work/open-source/etro/node_modules/resolve/lib/async.js:306:32)
    at /home/leanjunio/Documents/work/open-source/etro/node_modules/resolve/lib/async.js:34:69
    at FSReqCallback.oncomplete (node:fs:207:21)
17 04 2023 06:47:56.960:ERROR [karma-server]: Error: Unable to resolve module [canvas] from [/home/leanjunio/Documents/work/open-source/etro/node_modules/resemblejs/resemble.js]
{
  "basedir": "/home/leanjunio/Documents/work/open-source/etro",
  "extensions": [
    ".js",
    ".json",
    ".mjs",
    ".ts",
    ".tsx"
  ],
  "moduleDirectory": [
    "node_modules"
  ],
  "modules": {
    "assert": "/home/leanjunio/Documents/work/open-source/etro/node_modules/assert/build/assert.js",
    "buffer": "/home/leanjunio/Documents/work/open-source/etro/node_modules/buffer/index.js",
    "child_process": "/home/leanjunio/Documents/work/open-source/etro/node_modules/karma-typescript/dist/bundler/resolve/empty.js",
    "cluster": "/home/leanjunio/Documents/work/open-source/etro/node_modules/karma-typescript/dist/bundler/resolve/empty.js",
    "console": "/home/leanjunio/Documents/work/open-source/etro/node_modules/console-browserify/index.js",
    "constants": "/home/leanjunio/Documents/work/open-source/etro/node_modules/constants-browserify/constants.json",
    "crypto": "/home/leanjunio/Documents/work/open-source/etro/node_modules/crypto-browserify/index.js",
    "dgram": "/home/leanjunio/Documents/work/open-source/etro/node_modules/karma-typescript/dist/bundler/resolve/empty.js",
    "dns": "/home/leanjunio/Documents/work/open-source/etro/node_modules/karma-typescript/dist/bundler/resolve/empty.js",
    "domain": "/home/leanjunio/Documents/work/open-source/etro/node_modules/domain-browser/source/index.js",
    "events": "/home/leanjunio/Documents/work/open-source/etro/node_modules/events/events.js",
    "fs": "/home/leanjunio/Documents/work/open-source/etro/node_modules/karma-typescript/dist/bundler/resolve/empty.js",
    "http": "/home/leanjunio/Documents/work/open-source/etro/node_modules/stream-http/index.js",
    "https": "/home/leanjunio/Documents/work/open-source/etro/node_modules/https-browserify/index.js",
    "module": "/home/leanjunio/Documents/work/open-source/etro/node_modules/karma-typescript/dist/bundler/resolve/empty.js",
    "net": "/home/leanjunio/Documents/work/open-source/etro/node_modules/karma-typescript/dist/bundler/resolve/empty.js",
    "os": "/home/leanjunio/Documents/work/open-source/etro/node_modules/os-browserify/browser.js",
    "path": "/home/leanjunio/Documents/work/open-source/etro/node_modules/path-browserify/index.js",
    "punycode": "/home/leanjunio/Documents/work/open-source/etro/node_modules/punycode/punycode.js",
    "querystring": "/home/leanjunio/Documents/work/open-source/etro/node_modules/querystring-es3/index.js",
    "readline": "/home/leanjunio/Documents/work/open-source/etro/node_modules/karma-typescript/dist/bundler/resolve/empty.js",
    "repl": "/home/leanjunio/Documents/work/open-source/etro/node_modules/karma-typescript/dist/bundler/resolve/empty.js",
    "stream": "/home/leanjunio/Documents/work/open-source/etro/node_modules/stream-browserify/index.js",
    "_stream_duplex": "/home/leanjunio/Documents/work/open-source/etro/node_modules/readable-stream/lib/_stream_duplex.js",
    "_stream_passthrough": "/home/leanjunio/Documents/work/open-source/etro/node_modules/readable-stream/lib/_stream_passthrough.js",
    "_stream_readable": "/home/leanjunio/Documents/work/open-source/etro/node_modules/readable-stream/lib/_stream_readable.js",
    "_stream_transform": "/home/leanjunio/Documents/work/open-source/etro/node_modules/readable-stream/lib/_stream_transform.js",
    "_stream_writable": "/home/leanjunio/Documents/work/open-source/etro/node_modules/readable-stream/lib/_stream_writable.js",
    "string_decoder": "/home/leanjunio/Documents/work/open-source/etro/node_modules/string_decoder/lib/string_decoder.js",
    "sys": "/home/leanjunio/Documents/work/open-source/etro/node_modules/util/util.js",
    "timers": "/home/leanjunio/Documents/work/open-source/etro/node_modules/timers-browserify/main.js",
    "tls": "/home/leanjunio/Documents/work/open-source/etro/node_modules/karma-typescript/dist/bundler/resolve/empty.js",
    "tty": "/home/leanjunio/Documents/work/open-source/etro/node_modules/tty-browserify/index.js",
    "url": "/home/leanjunio/Documents/work/open-source/etro/node_modules/url/url.js",
    "util": "/home/leanjunio/Documents/work/open-source/etro/node_modules/util/util.js",
    "vm": "/home/leanjunio/Documents/work/open-source/etro/node_modules/vm-browserify/index.js",
    "zlib": "/home/leanjunio/Documents/work/open-source/etro/node_modules/browserify-zlib/lib/index.js",
    "_process": "/home/leanjunio/Documents/work/open-source/etro/node_modules/process/browser.js"
  },
  "filename": "",
  "paths": [
    "/home/leanjunio/.node_modules",
    "/home/leanjunio/.node_libraries"
  ]
}
Error: Cannot find module 'canvas' from '/home/leanjunio/Documents/work/open-source/etro/node_modules/resemblejs/resemble.js'
    at /home/leanjunio/Documents/work/open-source/etro/node_modules/karma-typescript/dist/bundler/resolve/resolver.js:185:27
    at /home/leanjunio/Documents/work/open-source/etro/node_modules/browser-resolve/index.js:265:24
    at /home/leanjunio/Documents/work/open-source/etro/node_modules/resolve/lib/async.js:148:17
    at processDirs (/home/leanjunio/Documents/work/open-source/etro/node_modules/resolve/lib/async.js:299:39)
    at isdir (/home/leanjunio/Documents/work/open-source/etro/node_modules/resolve/lib/async.js:306:32)
    at /home/leanjunio/Documents/work/open-source/etro/node_modules/resolve/lib/async.js:34:69
    at FSReqCallback.oncomplete (node:fs:207:21)

Let me know if this is a less than optimal way to circumvent this error

leanjunio commented 1 year ago

Hi, two small things. Can you make canvas a dev dependency? Also, the changes from #191 are still there, so please revert those. If you can just push those as two more commits, I'll squash them with the existing commits.

should be the case by the latest commit now, lmk if it's what you need

clabe45 commented 1 year ago

Hey, sorry I'm new to merging PRs. It looks like if I rebased your commtis into two, the PR won't be marked as completed. Do you mind squashing these changes into two commits and force pushing? One for the dependency fix and the other for the code change.

clabe45 commented 1 year ago

Also next time these could be two PRs

leanjunio commented 1 year ago

Just decided to re-create them into two separate PRs if that works