Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

117
Vistas
Video Clipping JS

I am working on a set of volleyball coaching tools for going over film and whatnot, and I am working on building a tool that can clip a video to grab a small 30-second portion similar to how twitch does it so that people can download cool highlights.

I have come across a few libraries that aim at exactly that however I can not wrap my head around making it work. As of now, I am able to grab the current time as well as the -minus 60 seconds to account for the clip point while the video is playing

I do have the video playing through a canvas, not sure why but I feel like that is right?

    <div>
    <input  type="file" id="Input" name="video" accept="video/mp4, video/mov">
        <button id="Play-Button">Play</button>
        <button id="Clip-Button">Clip</button>
    </div>
    
    <canvas id="canvas"></canvas>   
    
    <script src="../FilmRoom/videoclipping.js"></script>
var canvas = document.getElementById('canvas');
var ctx = canvas.getContext('2d');
var Film = document.createElement('video');
const input = document.querySelector('input');
var url = null;
let currentTime = 0;
let minusTime = 0;
var clippedVid;

input.addEventListener('input', () => {
    const file = input.files[0];
    if(!file) return;
    
    url = URL.createObjectURL(file);
    Film.src = url;

    Film.addEventListener('loadeddata', () =>{
        canvas.width = 1280;
        canvas.height = 720;
    })
})

// set canvas size = video size when known
document.getElementById("Play-Button").onclick = function clip(){
Film.play();
}

Film.addEventListener('play', () => {
  function step() {
    ctx.drawImage(Film, 0, 0,  canvas.width, canvas.height);
    requestAnimationFrame(step);    
  }
    requestAnimationFrame(step);
    
    document.getElementById("Clip-Button").onclick = function clip(){
        Film.pause();   
        
        currentTime = Film.currentTime;
        minusTime = currentTime-60;

    }

})
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda