• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

remove video in HTML5 canvas

New Here ,
Aug 22, 2020 Aug 22, 2020

Copy link to clipboard

Copied

Hi,

I can add video into HTML5 with the code here (makeDiv = function() ...

https://community.adobe.com/t5/animate/how-to-load-video-in-html5-canvas/m-p/8154016?page=1

 

But the code remove DIV rmDiv = function(ref) { } works only when I add it at the same frame with a setTimeout function:

 

    var d = document.createElement("div");  
    d.style.visibility = "hidden";  
    d.style.position = "absoulute";  
    d.style.left = 0;  
    d.style.top = 0;  
    d.style.width =  "300px";  
    d.style.height =  "600px";  
    d.style.overflow = "hidden";  	
    d.innerHTML = "<video src='videos/video1.mp4' autoplay muted></video>";  
    // attach element to CreateJS stage  
    canvas.parentNode.appendChild(d);  
    var dcjs = new createjs.DOMElement(d);  
    dcjs.x = 0;  
    dcjs.y = 0;  

    stage.addChild(dcjs);
	
    setTimeout(function()
    {
	rmDiv(dcjs);
    }, 10000);

 

 

How can I use this function rmDiv at another frame, because I don't know how I can get the DOM element again ?

Thanks for your help!

 

Views

344

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Aug 23, 2020 Aug 23, 2020

use this.dcjs instead of declaring a var and thereafter use this.dcjs to reference that element.

Votes

Translate

Translate
Community Expert ,
Aug 23, 2020 Aug 23, 2020

Copy link to clipboard

Copied

use this.dcjs instead of declaring a var and thereafter use this.dcjs to reference that element.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 23, 2020 Aug 23, 2020

Copy link to clipboard

Copied

Thanks a lot!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 25, 2020 Aug 25, 2020

Copy link to clipboard

Copied

LATEST

you're welcome.

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines