Start a new topic

Uncaught TypeError: Cannot read property 'playing' of undefined

Uncaught TypeError: Cannot read property 'playing' of undefined

Hi Neel,
my apologies for the delayed response. We've been very busy getting the most recent release out of the door.

Be mindful of what this actually is in each individual situation.


 

var World = {
    init: function initFn() {
        this.createOverlays();
    },

    createOverlays: function createOverlaysFn() {
        this.tracker = new AR.ClientTracker("assets/magazine.wtc");
        this.video = new AR.VideoDrawable("assets/video.mp4", 0.5, {
            offsetX: 0,
            offsetY: 0,
            isTransparent: false,
            onLoaded: function videoLoaded() {
                console.log("Video Loaded")
            },
            onPlaybackStarted: function playbackStarted() {
                console.log("Playback started");
            },

            onFinishedPlaying: function videoFinished() {
                console.log("Video Finished");
            },

            onClick: function videoClicked() {
                console.log("Video Clicked");
                if (this.playing)
                {
                    this.pause();
                    this.playing = false;
                }
                else
                {
                    this.resume();
                    this.playing = true;
                }
            }
        });

        var video = this.video;
        var pageOne = new AR.Trackable2DObject(this.tracker, "*", {
            drawables: {
                cam:
            },
            onEnterFieldOfVision: function onEnterFieldOfVisionFn() {
                video.play(-1);
            }
        });
    }
};

World.init();

 

Kind regards

Daniel


Hi Team,

Just wanted to check if you got a chance to look into this?

Thanks and Regards,

Neel
Hi,

I'm trying to create video overlays dynamically as I've multiple targets.
Everything works absolutely fine except for pausing / resuming the video onClick.
Here's my snippet of the code:

 this.video = new AR.VideoDrawable("assets/"+imageName+".mp4",.50, {
offsetX: 0,
offsetY: 0,
isTransparent: false,
onLoaded: function videoLoaded() {console.log("Video Loaded")},
onPlaybackStarted: function playbackStarted()
{
console.log("Playback started");
ga('send','event','Video Playback',imageName);
},

onFinishedPlaying: function videoFinished() {
console.log("Video Finished");
ga('send','event','Video Finished',imageName);
},

onClick: function videoClicked() {
console.log("Video Clicked");
if (this.video.playing) {
this.video.pause();
this.video.playing = false;
}

else {
this.video.resume();
this.video.playing = true;
}
}
}
);

this.video.play();

Uncaught TypeError: Cannot read property 'playing' of undefined.

  This code works if I declare the video as a variable, however it then does not allow me to destroy the object when a new target is found.

Will appreciate your help.

Thanks and Regards,
Neel
Login or Signup to post a comment