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

388
Views
Uncaught (in promise) DOMException: An attempt was made to use an object that is not, or is no longer, usable

I'm using seekToNextFrame which is an experimental mozilla thing: https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/seekToNextFrame

I'm using this to go over all the frames, sometimes, near the last frames of the video I get an error:

Uncaught (in promise) DOMException: An attempt was made to use an object that is not, or is no longer, usable

const video_src = "600_frames_in_120fps.mp4";


let canvas,
    ctx,
    video;


async function process_frame(e) {

    const video = e.target;

    const bitmap = await createImageBitmap(video);
    ctx.drawImage(bitmap, 0, 0, canvas.width, canvas.height);

    if (!video.ended) {
        video.seekToNextFrame();        
    }
}



async function init() {

    if (!HTMLMediaElement.prototype.seekToNextFrame) {
        // TODO display error in body
        console.log(
            `[ERROR] HTMLMediaElement seekToNextFrame not supported;
            are you using firefox?`);
        return;
    }

    canvas = document.createElement('canvas');
    document.body.append(canvas);
    ctx = canvas.getContext("2d");

    video = document.createElement('video');
    video.src = video_src;
    video.volume = 0; // required for play() to work
    document.body.append(video);

    video.addEventListener("seeked", process_frame);

    await video.play();

    video.currentTime = 0; // trigger seeked
}

init();

console.log did not gave any undefined.

For me it smells like a bug similar to:

InvalidStateError: An attempt was made to use an object that is not, or is no longer, usable

But I could be wrong.

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!