项目作者: doriclaudino

项目描述 :
record and export p5js canvas as webm, mp4, gif
高级语言: JavaScript
项目地址: git://github.com/doriclaudino/p5.recorder.git
创建时间: 2020-04-20T00:37:58Z
项目社区:https://github.com/doriclaudino/p5.recorder

开源协议:MIT License

下载


p5.recorder

NPM


npm version

styled with prettier
contributions welcome

Install (CDN)

  1. <!--jsdelivr-->
  2. <script src="https://cdn.jsdelivr.net/npm/p5.recorder@0.0.7/dist/p5.recorder.js"></script>

Install (NPM)

  1. npm install p5.drawer
  2. or
  3. yarn install p5.drawer

Example using default options:

  1. let rec = new p5.Recorder();
  2. rec.start();
  3. //stop after some time
  4. rec.stop();

Example using custom options:

  1. let autoDownloadFile = false
  2. //set to no download at the end
  3. let rec = new p5.Recorder(autoDownloadFile);
  4. let options = {
  5. filename: "my_custom_name_output.webm",
  6. recordAudio: true,
  7. audioBitRate: 128000,
  8. videoBitRate: 100000000 , //10 megabits
  9. fps: 45,
  10. }
  11. //passing custom configs
  12. rec.start(options);
  13. //stop after some time
  14. rec.stop();
  15. /**
  16. * contains current status
  17. * status: {
  18. * frames: 0,
  19. * progress: 0,
  20. * state: undefined,
  21. * time: undefined,
  22. * }
  23. */
  24. rec.status;
  25. //download the file after stop
  26. rec.download();


default options start() method:

name value
filename “p5.recorder.canvas.webm”
recordAudio true
audioBitRate 128000
videoBitRate 120000000
fps 60

enable audio

Don’t forget to CHECK enable audio (we are trying a better approach to capture audio-context on p5js-sound):

Image description

commands

  • yarn dev
  • yarn build

still in development

only support .webm for now

for future reference

https://editor.p5js.org/doriclaudino/sketches/LgLw5UaBr