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

271
Vistas
Is it possible to embed an iframe element in a fabricjs canvas to insert a youtube video into it?

I need to embed a youtube video in a fabricjs canvas. I have tried to do this by inserting an iframe element into a fabricjs image object. This has worked for me to insert a element into the canvas before. However, when inserting an iframe it is not possible.

<input type="text" name="enlace-video" id="enlace-video-yt"  value="" placeholder="http://">
<button id="input-video-yt">
    Insert YT video
</button>
const ytVideo = document.getElementById('input-video-yt');
ytVideo.addEventListener('click', function (){

    var ytvideoURL = document.getElementById("enlace-video-yt").value;
    var embedURL = ytvideoURL.replace("watch?v=","embed/");

    var divVideo = document.createElement('div');
    document.body.appendChild(divVideo);

    var iframe = document.createElement('iframe');
    iframe.id="new-video";
    iframe.src = embedURL;
    divVideo.appendChild(iframe);

    iframe.addEventListener( "loadedmetadata", function (e) {
        
        var fab_video = new fabric.Image(iframe, {left: 100,   top: 50, data: "video"});
        canvas.add(fab_video);

    }, false );
});

Any other way that makes it possible to insert a youtube video into the canvas would work for me.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

To add YouTube Video in canvas, you will need to create a video html tag and assign source to YouTube video link, and then add that video in Canvas as shown in

Demo: http://fabricjs.com/video-element

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