Start a new topic

How can I reuse VideoDrawable ?

How can I reuse VideoDrawable ?


I want to play random video in AR World. I have 11 video.

when video finished. Next button is appear and you can click it to play next video.

Now I create 11 VideoDrawable and then enable or disable it.

but myapp crash when play to 5th video or more

How can I reuse VideoDrawable or better way ?

Thank you in advance for reply

now I destroy video when video finished and removes video from the ARObject in the cam.

and then I create new VideoDrawable and add new video to the ARObject

but my app still receive message "Received memory warning." at 5th video and crash

now I feel hopeless :(

Hi, I was facing a similar issue but fixed it. Here's my code that is working now. Hope it helps.

 

 var pageOne = new AR.Trackable2DObject(this.tracker, "*" ,{

        onEnterFieldOfVision: function(imageName){

        console.log(imageName + " recognized!");

if(this.currentImage!=imageName)

{

this.currentImage = imageName;

 

        if(this.video != null)

        {

        pageOne.drawables.removeCamDrawable(0);

this.video.destroy();

}

 

        this.video = new AR.VideoDrawable("assets/1.mp4",1,{

                        offsetX: 0,

                        offsetY: 0,

                        isTransparent: true

                        }

                        );

                    this.video.play();

pageOne.drawables.addCamDrawable(this.video);

}

        },

        snapToScreen: {

enabledOnExitFieldOfVision: true,

snapContainer: document.getElementById('snapContainer')

 },

        onExitFieldOfVision: function(imageName){

        console.log(imageName + " leaving!");

        }

        });
Login or Signup to post a comment