Socket
Socket
Sign inDemoInstall

@kettek/mediastream-gifrecorder

Package Overview
Dependencies
Maintainers
0
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kettek/mediastream-gifrecorder

GIF MediaRecorder for MediaStreams


Version published
Maintainers
0
Created
Source

MediaStream-GifRecorder

This library provides an implementation of the MediaRecorder interface for recording MediaStreams, such as those from a webcam or desktop capture, to GIFs.

Basic Usage

The following will record a 5 seconds GIF at 5 frames per second.

navigator.mediaDevices.getUserMedia({ video: true })
.then((stream) => {
  document.getElementById('preview-video').srcObject = stream

  let recorder = new GifRecorder(stream, {
    videoFramesPerSecond: 5,
    videoQuality: 10,
    videoDithering: false,

    // optional source and destination rectangles
    sx: 200,
    sy: 50,
    swidth: 1920,
    sheight: 1080,
    dx: 0,
    dy: 0,
    dwidth: 1080,
    dheight: 720,
  })

  recorder.addEventListener('dataavailable', (e) => {
    document.getElementById('preview-gif').src = URL.createObjectURL(e.data)
  })

  recorder.start()

  setTimeout(() => {
    recorder.stop()
  }, 5000)
})
.catch((err) => {
  console.log(err)
}

Keywords

FAQs

Package last updated on 25 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc