Start a new topic

app force closes after some VideoDrawbable play

app force closes after some VideoDrawbable play


Hi Luca,
Other users reported the same issue and the problem is that a iOS SDK deamon process is consuming a lot of memory which then leads to app termination. I'm currently investigating this issue and we will hopefully release an update in the near future.

THX

Best regards

Andreas

Hi, thanks for your support.

I've updated my code to use external references. Same behavior the app force closes after about 6 scans of the target.

 

var World = {
loaded: false,
tracker: null,
trackable: null,
scan: null,
video: null,

init: function() {
World.tracker = new AR.ClientTracker("http://example.org/file.wtc", {});

World.trackable = new AR.Trackable2DObject(World.tracker, "*", {
onEnterFieldOfVision: function onEnterFieldOfVisionFn() {
World.scan = new AR.VideoDrawable("assets/scan.mp4", 1, {
isTransparent: true,
onLoaded: function() {
this.play();
},
onFinishedPlaying: function() {
destroyVideoDrawable(World.scan, World.trackable);

World.video = new AR.VideoDrawable("http://example.org/video.mp4", 1, {
onLoaded: function() {
this.play();
},
onClick: function() {
destroyVideoDrawable(World.video, World.trackable);
}
});
World.trackable.drawables.addCamDrawable(World.video);
}
});
World.trackable.drawables.addCamDrawable(World.scan);
}
});
}
};

function destroyVideoDrawable(drawable, trackable) {
drawable.stop();
trackable.drawables.removeCamDrawable(drawable);
drawable.destroy();
drawable = null;
}

World.init();


 

Hi Luca,
Thx for sharing your Architect World snippet. It helped a lot to understand your problem. The issue is related to the video drawables. You don't release any of your video drawables in your application. Thats why the app exceeds it's memory limit and crashes. 

The issue is that you call 'this.destroy()'. In your context, this relates not to the video drawable. You need to keep a reference to any created video drawable as e.g. member of the World object and then call destroy on the video object that is currently stored in the World object.

 

Maybe the following snippet is helpful:

```

var World = {

 

initialized : false,

_tracker: null,

_trackable: null,

_videoDrawable: null,

 

initialize : function(lat, lon, alt, acc)

{

 

World.initialized = true;

Logger.initialize();

Logger.info('World is initialized');

 

World._tracker = new AR.ClientTracker('Assets/Tracker/magazine.wtc');

World._trackable = new AR.Trackable2DObject(World._tracker, '*', {

onEnterFieldOfVision: function() {

if ( null == World._videoDrawable ) {

World._videoDrawable = new AR.VideoDrawable('Assets/Videos/surfer.mp4', 1);

}

World._trackable.drawables.addCamDrawable(World._videoDrawable);

World._videoDrawable.play(-1);

},

onExitFieldOfVision: function() {

World._videoDrawable.stop();

World._trackable.drawables.removeCamDrawable(World._videoDrawable);

World._videoDrawable.destroy();

World._videoDrawable = null;

}

})

 

}

};

```

 

Best regards

Andreas

Hello,

I have the following code inside a wikitude 4.1.1 iOS SDK ArchitectView.

After some playback of the videos (about 6 times) the app force closes (disconnecting from the debugger).

It seems like the app is having some memory issuses.

I've tried removing objects from cam.drawable or destroying them after playback (like in the following snippet) but nothing seems to help.

I've attached the crash log.

How can I solve this problem?

Thanks in advance.

 

var World = {
loaded: false,

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

createOverlays: function createOverlaysFn() {
this.tracker = new AR.ClientTracker("mydb.wtc", {});

var scan;
var video;

var pageOne = new AR.Trackable2DObject(this.tracker, "*", {
onEnterFieldOfVision: function onEnterFieldOfVisionFn() {
scan = new AR.VideoDrawable("assets/transparent-video.mp4", 1, {
isTransparent: true,
onLoaded: function() {
this.play();
},
onFinishedPlaying: function() {
this.destroy();
video = new AR.VideoDrawable("http://example.org/video.mp4", 1, {
onLoaded: function() {
this.play();
},
onClick: function() {
this.destroy();
}
});
pageOne.drawables.addCamDrawable(video);
}
});
pageOne.drawables.addCamDrawable(scan);
}
});
}
};

World.init();


 
Login or Signup to post a comment