Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

447
Visualizações
Failed to load resource: net::ERR_FILE_NOT_FOUND when trying to play videos in reactjs

Im trying to play videos that I get from the server but the videos dont show anything and im getting this error in the console: Failed to load resource: net::ERR_FILE_NOT_FOUND.

this is what the links im trying to play from the server looks like: "blob:http://localhost:3000/fd2ba95b-480a-4a46-baf0-8423e1163f7e"

here is the upload form that uploads videos to the server.

export default function Previews(props) {
  const [files, setFiles] = useState([]);
  const [title,setTitle] = useState("");
  const [userData,setUserData] = useState([]);

useEffect(() => {
  const currentUser = AuthService.getCurrentUser();

  AuthService.getUser(currentUser.id).then(results => {
      console.log(results.data.user);
      setUserData(results.data.user);
  }).catch(err => {
      console.log(err.message);
  });
},[])

const {getRootProps, getInputProps} = useDropzone({
  onDrop: acceptedFiles => {
  setFiles(acceptedFiles.map(file => Object.assign(file, {
    preview: URL.createObjectURL(file),
  })));
}
});

const thumbs = files.map(file => (
  <div style={thumb} key={file.name}>
    <div style={thumbInner}>
    <img
      autoPlay={true}
      src={file.preview}
      style={img}
      alt="src"
    />
  </div>
</div>
));



 useEffect(() => {
// Make sure to revoke the data uris to avoid memory leaks
files.forEach(file => URL.revokeObjectURL(file.preview));
}, [files]);

   const upload = () => {

const url = files.map(file => (file.preview)).toString();
PostService
  .create(userData.username,title,url)
  .then(() => {
      window.location = "/"; 
      console.log(url);
  }).catch(err => {
      console.log(err.message);
  });
  
}

  return (
<div className="notborder">
    <h1><strong>Upload</strong></h1>
    <br/>
    <h2>Add Caption</h2>
    <center>
         <input value={title} onChange={(e) => setTitle(e.target.value)} className="addtitle"/>
    </center>
    <center>
    <button onClick={upload} className="upload-btn">upload</button>
    </center>
  <section className="contained">
      <center>
      <div {...getRootProps({className: 'dropzone'})}>
        <input {...getInputProps()} />
        <p className="dragndrop">drop files here, or click to select files</p>
      </div>
      </center>
  <center>
  <aside style={{borderBottom:"none"}} >
    {thumbs}
  </aside>
      
  </center>
</section>
</div>
);
}
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda