5.0.0 • Published 12 months ago

pyramid-webcam v5.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
12 months ago

This is a react based webcam to open, close, record, download recorded video

Install

npm install pyramid-webcam

Usage

import {useRef} from 'react'
import usePyramidWebCam from 'pyramid-webcam'

export default function Home(){

  const streamRef = useRef();
  const downloadRef = useRef();

  const {
    openCam,
    closeCam,
    startRecording,
    stopRecording,
    downloadPyramidRecord,
    webCamStatus,
    recordedBlob,
  } = usePyramidWebCam(streamRef, "<fileExtension>")

  return (
      <>
        <div className='text-center mx-auto w-100'>
          <div className='mx-auto'>
            <p className='lead mx-4'>Status: {webCamStatus}</p>
            <button
              className='ms-2'
              type="primary"
              onClick={openCam}
            >
              Open Camera
            </button>

            <button
              className='ms-2'
              type="default"
              onClick={closeCam}
            >
              Close Camera
            </button>

            <button
              className='ms-2'
              type="primary"
              onClick={startRecording}
            >
              Start Recording
            </button>

            <button
              className='ms-2'
              type="primary"
              onClick={stopRecording}
            >
              Stop Recording
            </button>

            <a
              ref={downloadRef}
            >
              <button
                className='ms-2'
                type="primary"
                onClick={()=> downloadPyramidRecord(downloadRef, 'pyramid-record')}
              >
                Download
              </button>
            </a>
            <div>
              <video
                ref={streamRef}
                className=' border border-1 rounded mt-3'
                id="preview"
                width="500"
                height="375.5"
                autoPlay
                muted
              ></video>
            </div>

          </div>
        </div>
      </>
  )
}

Run tests

npm run test

Author

👤 youssef wael

Show your support

Give a ⭐️ if this project helped you!


This README was generated with ❤️ by readme-md-generator

3.0.2

12 months ago

3.0.1

12 months ago

5.0.0

12 months ago

3.0.0

12 months ago

4.0.1

12 months ago

4.0.0

12 months ago

4.0.3

12 months ago

2.0.9

12 months ago

4.0.2

12 months ago

2.0.8

12 months ago

2.0.7

1 year ago

2.0.6

1 year ago

2.0.5

1 year ago

2.0.4

1 year ago

2.0.3

1 year ago

2.0.2

1 year ago

2.0.1

1 year ago

2.0.0

1 year ago

1.0.0

1 year ago