Skip to content

Camera options in @uppy/react Dashboard #1519

@rafcontreras

Description

@rafcontreras

Hi there, I can't seem to be able to set camera options.

I'm trying to enable only photos and no video or audio. And I can't seem to be able to pass this props.

Here is my code

import React, { Component, Fragment } from "react";
import Uppy from "@uppy/core";
import Webcam from "@uppy/webcam";
import { Dashboard } from "@uppy/react";
import Helmet from "react-helmet";

class AvatarPicker extends Component {
 constructor(props) {
   super(props);

   this.uppy = Uppy({
     id: "uploader",
     autoProceed: false,
     allowMultipleUploads: true,
     debug: false,
     restrictions: {
       maxFileSize: null,
       maxNumberOfFiles: 1,
       minNumberOfFiles: 1,
       allowedFileTypes: ["image/*", ".jpg", ".jpeg", ".png", ".gif"]
     }
   })
     .use(Webcam)
     .use(Webcam, {
       countdown: true,
       modes: ["picture"],
       id: "webcam"        
     });
 }

 componentWillUnmount() {
   this.uppy.close();
 }

 render() {
   return (
     <Fragment>
       <Helmet>
         <link href="/css/uppy/main.css" rel="stylesheet" type="text/css" />
       </Helmet>
       <Dashboard
         plugins={["Webcam"]}
         uppy={this.uppy}
       />
     </Fragment>
   );
 }
}

export default AvatarPicker;

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions