Giter Club home page Giter Club logo

react-video-recorder's Introduction

react-video-recorder

Installation

yarn add react-video-recorder

# Note: this project has react, react-dom, prop-types & styled-components as peerDependencies,
#       so if you're starting from scratch run this instead:
yarn add react-video-recorder react react-dom prop-types styled-components

Typescript

If using Typescript, typing is available via:

yarn add -D @types/react-video-recorder

Usage

Basic usage (edit in stakblitz):

import React from 'react'
import { render } from 'react-dom'
import VideoRecorder from 'react-video-recorder'

const App = () => (
  <VideoRecorder
    onRecordingComplete={(videoBlob) => {
      // Do something with the video...
      console.log('videoBlob', videoBlob)
    }}
  />
)

render(<App />, document.getElementById('root'))

Also check the Storybook for more demos and usage examples.

Note: if you click the "Show info" button in the top-right corner, you should be able to see a table with the supported prop-types.

Modifying the UI

All the UI can be customized by passing the following props:

renderDisconnectedView

View that's rendered before the user enables the camera access.

Default value: () => <DisconnectedView />

See <DisconnectedView /> source here.

renderLoadingView

View that's rendered while the camera is initializing.

() => <LoadingView />

See <LoadingView /> source here.

renderVideoInputView

View that's rendered when the browser does not support inline recording but allows opening the native camera (mainly iOS).

Default value: ({ videoInput }) => <Fragment>{videoInput}</Fragment/>

renderUnsupportedView

View that's rendered when the browser does not support recording video.

Default value: () => <UnsupportedView />

See <UnsupportedView /> source here.

renderErrorView

View that's rendered an unexpected error occurs.

Default value: () => <ErrorView />

See <ErrorView /> source here.

renderActions

Overlay that's rendered on top of the views and that contains the elements like the buttons, the timer or the countdown.

See the default implementation here.

Development

Requirements

node version ">=8.3"

Install packages

yarn install

Run the storybook demo

yarn start

Committing

To commit run yarn start then commit. We use Husky to verify before committing.

react-video-recorder's People

Contributors

alexisglez avatar asiniy avatar bastienctr avatar biddano avatar damechen avatar davesnx avatar dependabot[bot] avatar dmcallis avatar fbaiodias avatar gabrielcartier avatar georgejordanov avatar jackcompass avatar james-lukensow avatar jsavinash avatar kevinfluegel avatar mdomarus avatar paulincai avatar salsao avatar suchk avatar swapnil256 avatar vlidou avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

react-video-recorder's Issues

Start Recording manually

Is there any way we can start recording using our own interface or button? We want to remove the big red button used to start and stop recording.

How to use guide

Could you add something in the README on how to use the component?

The automated release is failing 🚨

🚨 The automated release from the master branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you could benefit from your bug fixes and new features.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can resolve this 💪.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit the master branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here is some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


Invalid npm token.

The npm token configured in the NPM_TOKEN environment variable must be a valid token allowing to publish to the registry https://registry.npmjs.org/.

If you are using Two-Factor Authentication, make configure the auth-only level is supported. semantic-release cannot publish with the default auth-and-writes level.

Please make sure to set the NPM_TOKEN environment variable in your CI with the exact value of the npm token.


Good luck with your project ✨

Your semantic-release bot 📦🚀

Video gets flipped in preview.

Hi,

  1. While recording I need it to be like a mirror.
  2. After recording, it must play exactly what I recorded and not flip just like we have normally in our smartphones while making videos.

onRecordingComplete not calling any function

I am using this library for recording the video as well as audio along with webRTC. I am successfully able to connect two peers using webRTC. I want to do that when two peers are connected recording should be started!!

<VideoRecorder onStartRecording={this.actionHandler} onRecordingComplete={videoBlob => { alert("recording complete"); console.log("videoBlob", videoBlob); }} />

actionHandler = () => { alert("fn called"); console.log("fn called"); };

Not even alert nor log is appering when the two peers are connected!! Please help me out..

Video sound is not coming by default

When I complete my video recording I am not able to hear the sound by default. I have to click over the video to toggle the sound. Is there any prop I can pass to make the volume on by default?

Support pausing timer on handlePauseRecording call

The pause/resume recording features (triggered using component refs) are poorly supported, for instance, the timer keeps counting even after pausing the recording, and currently there is no way to manipulate the recording timer outside of the react-video-recorder component so I can bypass the problem, after quickly checking the source code it seems that the pause recording functionality isn't being considered at all, the component just keeps incrementing when it exists and it will disappear when isRecording is falsy.
I will try to check this problem and maybe open a PR when I get some free time.

How to save the video blob in nodejs?

Im trying to post the video blob to my nextjs api, to save it on the server. Unfortunately I cannot get it to work. Does anyone know the solution?
<VideoRecorder onRecordingComplete={(videoBlob) => { // Do something with the video... fetch("/api/video", { method: "post", body: videoBlob, }) .then(function (response) { console.log("done"); return response; }) .catch(function (err) { console.log('error', err); }); }} />

and on the server side:
fs.writeFile('test', req.body, function (err) { if (err) return console.log(err); console.log('video saved'); } );

How to change Video type mp4

Hi i have configure react-video-recorder in my project but i can't play recording video in safari browser can you please give me the solution or how to change from video file webm to mp4 in react-video-recorder npm package

Failed to execute 'drawImage' on 'CanvasRenderingContext2D'

TypeError: Failed to execute 'drawImage' on 'CanvasRenderingContext2D': The provided value is not of type '(CSSImageValue or HTMLImageElement or SVGImageElement or HTMLVideoElement or HTMLCanvasElement or ImageBitmap or OffscreenCanvas)

renderActions

Hey, I basically want to remove the option or maybe customize useAnotherVideo option, please could you help me out how to perfectly use renderActions module?

get-video-info.js Line 35

Hi,
just wanted to reconfirm that line 35/36 is correct cause I don't find any reference of 'remoteEventListener' but this place would be a very good place to remove the listener so I am wondering whether that is a typo:

 videoTag.remoteEventListener &&
        videoTag.remoteEventListener('loadeddata', handleLoadedData)

Its not an issue but I want to switch camera from user mode to other

Hi there. I am really happy to see your work and yes its really worthy. But i tried to look around your code but i didn't find out how can i switch user camera mode.

For example i want to switch camera from user face-mode to other mode (environment).
Can you please let me know how can i do that?

Trigger record action externally

There is a option to trigger de function that record-button does?

Something like a prop equal true...


Hay alguna manera de ejecutar la función de grabar externamente, quizá a traves de una prop?

Preload video

This isnt a bug. i just need help. I know its probably a basic question but i need guidance on how i can pass a url (or a video blob) to the video component.
I am able to save video to my server but do not know how to play back the video on the component. I know about this props useVideoInput which presents a button through which you can load a video but this doesnt solve my problem. I need to be able to auto load a video when the component loads and not via some action triggered by the user.

On Android the camera recorder is mirrored

When I tried to record a video with an Android phone the video is reverted.

Right side is at left side.

It's working properly on IOS since it's opening the camera app.

Thank you for your help.

Option to have replay video be muted by default

Thanks for this great lib!

For my use case, I need the replay video to be muted by default, as a user might record something with his phone and not want the replay blasting sound right after, but rather have it be muted. Especially since I don't show video controls, so there is no mute button.

I wanted to create a PR, but found that there is some muting and unmuting going on in the code and wasn't entirely sure how to handle that. As there is already a isReplayVideoMuted state var, maybe have a shouldReplayVideoBeMuted attribute (that would be toggled if the user actively mutes/unmutes a video with the video controls)? What do you think?

Is there a way to zoom out?

Hey, I was wondering if zoom in and out is supported on this library. Didn't seem to find anything in the documentation or code.
If the answer is no, then are there any future plans to do so?

Default config not defined

Hello,

I am having problems getting your video component to work with react.
I followed your instructions and it gives me this message, no matter how I try to import.

image

Do you have a solution for this?

Thanks.

Guia de uso

Hola como estas? Te escribo para solicitar ayuda en el uso de esta libreria. Me podrías colaborar? Gracias!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.