ios - Vuforia Video Playback


Keywords:ios 


Question: 

I am trying to use the Vuforia Video Playback sample app as the starting point for a university project. What I want to do is develop a small iOS based app that will recognise a target, that I define, and play a video of my choice over the target as per the sample app. I am brand new to Vuforia so I would really appreciate some help and guidance by way of a simple explanation of the following:

  1. Having created my own target dataset using the target manager and downloaded the .xml and .dat files, where do I have to update the sample app code in order for my target to be used rather than the Stones&Chips example?

  2. Once I have my target integrated, what sample app code do I need to modify to invoke my own video (either streamed from the web or stored locally on the iPhone) when my target is detected? As I said, I’m very new to this environment and find I learn best by examples so any help and guidance would be much appreciated…


1 Answer: 

First, add your dataset (.dat and .xml) files and any videos to the Resources/assets groups.

Then, as of VideoPlayback-2-0-7, you'll need to edit the following lines in VideoPlaybackAppDelegate.mm.

Update the data set to match the files names for your data set (.dat and .xml). Line 92:

[qUtils addTargetName:@"Stones & Chips" atPath:@"StonesAndChips.xml"];

Update the videos to match any videos you have added. Starting at line 148:

switch (i) {
    case 0:
        filename = @"VuforiaSizzleReel_1.m4v";
        break;
    default:
        filename = @"VuforiaSizzleReel_2.m4v";
        break;
}

Update the number of video targets in EAGLView.h. Line 25:

#define NUM_VIDEO_TARGETS 2

Update the video textures in EAGLView.mm. Note that you will need to have one texture for each trackable or the app will crash. There is no error checking on the code that loads the texture. Starting at line 39:

    // Texture filenames (an Object3D object is created for each texture)
    const char* textureFilenames[] = {
        "icon_play.png",
        "icon_loading.png",
        "icon_error.png",
        "VuforiaSizzleReel_1.png",
        "VuforiaSizzleReel_2.png"
    };

Update the target name matching code in EAGLView.mm. Starting at line 357:

// VideoPlayerHelper to use for current target
int playerIndex = 0;    // stones

if (strcmp(imageTarget.getName(), "chips") == 0)
{
    playerIndex = 1;
}