5.0.0 • Published 2 years ago

pyramid-webcam v5.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years 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

2 years ago

3.0.1

2 years ago

5.0.0

2 years ago

3.0.0

2 years ago

4.0.1

2 years ago

4.0.0

2 years ago

4.0.3

2 years ago

2.0.9

2 years ago

4.0.2

2 years ago

2.0.8

2 years ago

2.0.7

3 years ago

2.0.6

3 years ago

2.0.5

3 years ago

2.0.4

3 years ago

2.0.3

3 years ago

2.0.2

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

1.0.0

3 years ago