sc0ttj / component

A tiny library for isomorphic JavaScript components
MIT License
2 stars 1 forks source link

Feature: a `useVideo()` addon #66

Open sc0ttj opened 2 years ago

sc0ttj commented 2 years ago

Create a useVideo addon that returns a video object that can be filtered, cropped, edited, etc.

It should extend Ctx canvas module, adding the extra methods needed for video editing:

Keep it small & simple:

Example:

const myVideo = useVideo({
  src: 'path/to/file.mp4',   // could also be a stream, File blob, <video> Element, webcam device, etc
  name: 'myVideo',
  container: canvasElem, // if not given, create an off-screen canvas to use instead
  startOffset: 0,
  endOffset: 0,
  filters: { 
    // ...filters and their settings here
  },
});

myVideo.play();

myVideo.settings({
  // ...change any settings defined above
});

myVideo.toElement(videoElem => { ... })

myVideo.saveAs('filename.mp4'); // raises the browsers "save file" dialog

Notes:

Further reading:

Other projects:

sc0ttj commented 2 years ago

Also may be useful:

sc0ttj commented 2 years ago