Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

202
Views
React - How to get selected video display/preview from input

I'm trying to get a video preview after selecting a video from input type file. But it is not giving me video preview however if it is working fine if i select a image but it is not working fine for video.

import React, { useState } from 'react';

const [imgAvatar, setImgAvatar] = useState('')

    const handleFile = e => {
        const file = e.target.files[0]
        const fileReader = new FileReader()


        fileReader.onloadend = (e) => {
            setImgAvatar(e.target.result)
        }
        fileReader.readAsDataURL(file)
     }

return(
    <video>
        <source src={imgAvatar} type="video/mp4"></source>
    </video>
    <img src={imgAvatar} alt='...'></img>
)
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!