Log in or register to post comments

Two targets, two videos

September 4, 2014 - 8:15pm #1

I'm looking over the sample code and trying to modify it slightly to allow it to use two targets. I started with the easy part, making a new target and putting the XLM and DAT into my project, then modified the loader thus:

- (bool) doLoadTrackersData {

    bool ret = true;

    ret= [self loadAndActivateImageTrackerDataSet:@"Direct_mail_flier.xml"];

    ret= [self loadAndActivateImageTrackerDataSet:@"Sirens.xml"];

    return ret;

}

 
But now I don't understand the next part... how do I select the right video based on the target? The sample starts the load/play in:
 

- (void) prepare {

[...]

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

        NSString* filename = @"Behind_The_Scenes.mp4";

        if (NO == [player load:filename playImmediately:NO fromPosition:videoPlaybackTime[i]]) {

            NSLog(@"Failed to load media");

        }

    }

But there's no selection based on the target here. I'm sure it's simple, can someone offer a pointer?

Two targets, two videos

September 4, 2014 - 8:57pm #4

This may dup, my appologies in advance.

The key code is VERY well hidden. Do a search in your project for:

        // VideoPlayerHelper to use for current target

Look inside your XML files for the targets, whatever filename you see there is what you need to put here.
 
This code would be *greatly* improved if this section was moved out to it's own function. The DAT/XML, jpg and mp4 all work hand-in hand, the code that finds which goes with which should really be very clear instead of split up and buried like this.

Two targets, two videos

September 4, 2014 - 8:54pm #3

Ahhh. Look for this very key line of code:

        // VideoPlayerHelper to use for current target

 
You have to modify that to support different targets. That is NOT obvious, and the sample should really put this code into it's own function somewhere so it's more obvious how to make this work!

Two targets, two videos

September 4, 2014 - 8:22pm #2

Hmm, definitely helps if you download the latest code...

        switch (i) {

            case 0:

            filename = @"VuforiaSizzleReel_1.m4v";

            break;

            default:

            filename = @"VuforiaSizzleReel_2.m4v";

            break;

        }

 

OK, now why does my new target have the "can't play" button on it?
 
 
Log in or register to post comments