Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

182
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda