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();
A
Andreas Schacherbauer
said
over 7 years ago
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);
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.
Luca Marra