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

172
Views
Howe to Add Dynamic Caption to a Video?

Is there any way to create and add a caption to a video without creating .vtt file?

Here is what I want to try: So, I am creating a video call app (just for practice purposes), and I am wondering if I can display the username of the callers by making a caption or subtitle in the video that will run in the entire stream time.

Adding subtitles is possible using a tracking element, but I need to create .vtt file, and I don't want that. What I want is to create the track in the code. I have this code below but it is not showing in the video.

    video.srcObject = stream;
    video.addEventListener("loadedmetadata", () => {
        video.play();
        track = this.addTextTrack("captions", "English", "en");
        track.addCue(new VTTCue(0, 500, username));
    });

Summary of the questions:

  1. Is my goal possible? (Proceed if yes)
  2. How to add a caption by coding it and not by using a file?
  3. How to play it in the entire stream time (from 00:00 to the end of the stream)?
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

This in arrow function points to window. You can access video element by event.target or just use you video variable.

   video.srcObject = stream;
   video.addEventListener("loadedmetadata", () => {
        video.play();
        const track = video.addTextTrack("captions", "English", "en");
        track.mode = "showing";
        track.addCue(new VTTCue(0, 500, username));// or TextTrackCue instead VTTCue
    });
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!