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

133
Views
how can play video file as soon as i select file and side by it stores in different folder

Searching for a code which can help me to solve above question using only HTML,css,javascript.

It would help me a lot,Thanks in advance.

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

set urlPath is a path of your video store in argument of changeSrc function:

const video = document.querySelector('#video')
const source = document.querySelector('#source')
function changeSrc(urlPath) {
  video.pause();
  source.setAttribute('src', urlPath);
  source.setAttribute('type', 'video/mp4');
  video.load();
  video.play();
}
div {
display: flex;
flex-direction: column;
}

button{
 width: 200px
}
<div>
<button onclick="changeSrc('https://test-videos.co.uk/vids/bigbuckbunny/mp4/h264/360/Big_Buck_Bunny_360_10s_1MB.mp4')">Click to change video</button>
<video id="video" width="320" height="240" controls autoplay>
  <source id= "source" src="http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerBlazes.mp4" type="video/mp4">
</video>
</div>

about 4 years ago · Juan Pablo Isaza Report

0

i hope this would helps you a lot.

            function loadTheVideo()
            {
                 //alert(URL.createObjectURL(document.getElementById("file").files[0]));
                 document.getElementById("video").src = URL.createObjectURL(document.getElementById("file").files[0]);
                 document.getElementById("video").play();
            }
       
       
            video
            {
                width: 400px;
                height: 400px;
                border: 1px solid black;
            }
        
<!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Document</title>

    </head>
    <body>
          <video controls id="video"></video>
          <br>

            <input onchange="loadTheVideo()" type="file" id="file" name="file">
          
       
    </body>
    </html>

about 4 years ago · Juan Pablo Isaza Report
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!