Log in or register to post comments

Pause and Resume AR

July 27, 2012 - 12:24pm #1

Hi everybody,

for my game I'd like to pause and resume the AR in order to display some advanced 3d with effects. 
To do this, I just call SetActiveRecursively on the AR camera. The AR will stop, but when I try to turn it on again, it crashes. 

How can I avoid this issue? Thanks !

Pause and Resume AR

January 29, 2013 - 3:46am #11

Glad you solved this and thanks for sharing!

N

Pause and Resume AR

January 25, 2013 - 9:43am #10

Just solved the issue calling:     [[QCARutils getInstance] destroyAR];

the full method is here: 

- (IBAction)backToPreviousController:(id)sender {

    [self removeMoviePlayerView];

    EAGLView* arView = [self getARView];

    for (int i = 0; i < NUM_VIDEO_TARGETS; ++i) {

        VideoPlayerHelper* player = [arView getVideoPlayerHelper:i];

 

        // If the video is playing, pause it and store the index of the player

        // so playback can be resumed

        if (PLAYING == [player getStatus]) {

            [player pause];

        }

 

        // Store the current video playback time for use when resuming (even if

        // the player is currently paused)

        videoPlaybackTime[i] = [player getCurrentPosition];

 

        // Unload the video

        if (NO == [player unload]) {

            NSLog(@"Failed to unload media");

        }

    }

    // do the same as when the view has dissappeared

    [self viewDidDisappear:NO];

    [[QCARutils getInstance]setAppStatus: APPSTATUS_CAMERA_STOPPED];

    [[QCARutils getInstance] destroyAR];

    [self.navigationController popViewControllerAnimated:YES];

}

 

Hope this helps, for anyone else. 

Thanks!

Pause and Resume AR

January 25, 2013 - 9:30am #9

Same problem over here, how did you solve it? after 3 restarts the AR view goes on black screen!!

this comes out from log screen:

 

 

DEBUG/AR(802) Could not find a UIView with CAEAGLLayer layer class that responds to selector renderFrameQCAR

 

 

 

Please help!!

Pause and Resume AR

July 30, 2012 - 6:45am #8

Ok ! I've some news :)

At the begining of the application I take a picture from the camera, I use this code:

Quote:

CameraDevice cam = CameraDevice.Instance;
cam.SetFrameFormat(Image.PIXEL_FORMAT.RGB888, true);
//after few seconds
Image image = cam.GetCameraImage(Image.PIXEL_FORMAT.RGB888);

 

I'm doing that on a Start function. If I do that, the application will crash (50% chance).

So maybe the problem comes from the FrameFormat when the application is restarted.

Pause and Resume AR

July 30, 2012 - 5:50am #7

By crashes I mean crashes, the application will stop. Each time I start the AR I have this following error log, even if the AR is starting properly:

Quote:

2012-07-30 08:48:49.977 medallionbots[470:707] DEBUG/AR(470) UIView has CAEAGLLayer class

2012-07-30 08:48:49.978 medallionbots[470:707] DEBUG/AR(470) UIView does not respond to selector renderFrameQCAR

2012-07-30 08:48:49.981 medallionbots[470:707] DEBUG/AR(470) Could not find a UIView with CAEAGLLayer layer class that responds to selector renderFrameQCAR

2012-07-30 08:48:49.985 medallionbots[470:707] DEBUG/AR(470) UIView has CAEAGLLayer class

2012-07-30 08:48:49.986 medallionbots[470:707] DEBUG/AR(470) UIView does not respond to selector renderFrameQCAR

2012-07-30 08:48:49.988 medallionbots[470:707] DEBUG/AR(470) Could not find a UIView with CAEAGLLayer layer class that responds to selector renderFrameQCAR

2012-07-30 08:48:49.991 medallionbots[470:707] DEBUG/AR(470) UIView has CAEAGLLayer class

2012-07-30 08:48:49.992 medallionbots[470:707] DEBUG/AR(470) UIView does not respond to selector renderFrameQCAR

2012-07-30 08:48:49.994 medallionbots[470:707] DEBUG/AR(470) Could not find a UIView with CAEAGLLayer layer class that responds to selector renderFrameQCAR

2012-07-30 08:48:50.814 medallionbots[470:707] INFO/AR(470) 2012-07-30 08:48:50: Setting the torch mode not supported

I'm not trying to set the torch mode btw. 

I'll create a simple application will only AR and a toggle button that will turn on/off the AR component.

 

Pause and Resume AR

July 27, 2012 - 2:15pm #6

By 'crashes' do you mean that the app crashes, or that the AR can't be reactivated? Do you have a log of this that you can post?

Pause and Resume AR

July 27, 2012 - 1:42pm #5

The reason why I'm doing that is to save framerate.
If I disable manually my marker, do you think it will work? 

Pause and Resume AR

July 27, 2012 - 1:20pm #4

Same result, sadly.

It crashes randomly, the 3rd or 4th time I active it again.
To give more information about the game, I disable the AR and enable again after 6 or 7 seconds, and then again disable after 20 30sec, depends on the user. 

Pause and Resume AR

July 27, 2012 - 1:03pm #3

Thanks for this sick reactivity !

I'll give it a try :)

Pause and Resume AR

July 27, 2012 - 12:40pm #2

Try referencing the QCARBehaviour via GetComponent<QCARBehaviour>() and enable / disable that directly. This will start and stop QCAR properly.

Log in or register to post comments