Log in or register to post comments

How do I add another target to the Video Playback sample

November 21, 2013 - 11:54am #1

Hello,

I followed this link  https://developer.vuforia.com/forum/faq/android-how-do-i-add-another-target-video-playback-sample to add another target & video to the video playback sample but still the images in the new database (db.xml) are not being identified. Moreover only the thumbnail of the video is being shown on stone & chips texture whereas the new images(textures) are not even identified. Please help. Thanks

How do I add another target to the Video Playback sample

April 14, 2014 - 1:39am #33

Its not just about changing a couple of lines of code in the sample.... this is a substantial application logic matter, so the actual implementation of video unloading/loading is up to you and will depend on your coding style and app design preferences. 

 

How do I add another target to the Video Playback sample

April 13, 2014 - 8:25pm #32

hi Allesandro B ,

can i know that how to load and unloadind the videos ,which part of code should i modify ?

thank uu:)

 

How do I add another target to the Video Playback sample

April 10, 2014 - 5:24am #31

So, I have just tested a basic Image Targets setup with a Dataset that contains 16 image targets, and each of the target can be detected immediately (usually in less than 1 second) on a Samsung Galaxy S3 "mini"... 

so, what you are experiencing is not an issue with detecting your targets, but rather something else in the App that is consuming two many resources..  my guess is that this could be related to the Loadin time of each video... or simply the fact that using 15 videos is a bit too much for your device resources (memory and CPU).

So, you probably need to consider either reducing the number of videos or use a different strategy (e.g. Load / Unload videos dynamically)... something to be figured out in your application design.

As far as the number of Datasets is concerned, for 15 targets, one Dataset is more than enough (one dataset can handle up to 100 targets).

 

How do I add another target to the Video Playback sample

April 10, 2014 - 3:54am #30

hi ,

i use only one dataset which contains 15 videos ..haha..it is too much ?:p

can i separate to 2 dataset in on code ?then aftethat how i am going to merge them ?

How do I add another target to the Video Playback sample

April 10, 2014 - 3:32am #29

i found out that the detection of the image target will becoming so slow when have many image target loaded in code and sometimes have to wait for a minutes or two for detection and video play

mmm... sounds a bit too slow to me (you could be waiting for a fw seconds, but not for 2 minutes), I would tend to think it is some issue with your implementation; how many targets are you loading ? are they all in the same dataset ? 

 

How do I add another target to the Video Playback sample

April 10, 2014 - 3:05am #28

hi Allesandro B ,

i found out that the detection of the image target will becoming so slow when have many image target loaded in code and sometimes have to wait for a minutes or two for detection and video play ..is it cause by the low spec of phone or we can do anything in coding ?

second question is  it posible for us to  use 2 data datset (each dataset have 2-3 image target )in one source code instead of one dataset contains of 10 image targets and then merge it together .will it make the speed of detection of image target faster or not ? then can i know which part of the code should change?

 

thank uu:D

How do I add another target to the Video Playback sample

April 8, 2014 - 3:42am #27

You need to update the sample code in VideoPlaybackRenderer.java, in the renderFrame() method to take care of all the cases (rendering the keyframes, rendering the icons, etc.).

For instance, in the sample code, you will find this lines:

// The following section renders the icons. The actual textures used
// are loaded from the assets folder
 
All the code after that is about rendering the icons.
 

 

How do I add another target to the Video Playback sample

April 8, 2014 - 2:42am #26

Hi Allesandro B ,

Now i am trying to build up the apps by slowing adding the video instead of modify by add up 18 image target .Now i am trying like add up slowly  one by one  image target and video and can play succesfully .However i have a small problem  is  the play button is missing and the cover image is always  the same for 3 image target when i capture on  them .Can i know what is the problem and what i need to do to make it nicer as previous AR ?

THANK UU:)

How do I add another target to the Video Playback sample

April 7, 2014 - 3:32am #25

1. Why are you building with ndk-build ?

The VideoPlayback sample in version 2.8.8 does not require it. (Vuforia has a full Java API since version 2.8).

 

2. The error logs are not what you have shown here. They can be read via ADB logcat or directly in Eclipse in the adb console, see:

http://developer.android.com/tools/help/logcat.html

 

 

How do I add another target to the Video Playback sample

April 7, 2014 - 2:53am #24

the apps can be loaded in the phone but the apps force to close .

the error log u mean is it like this 

leo@leo-PC /cygdrive/C/Users/leo/Desktop/android/vuforia-sdk-android-2-8-7/example/VideoPlayback-2-8-8
$ ndk-build
Android NDK: WARNING: APP_PLATFORM android-18 is larger than android:minSdkVersion 9 in ./AndroidManifest.xml
Android NDK: Your APP_BUILD_SCRIPT points to an unknown file: ./jni/Android.mk                         
/cygdrive/c/Users/leo/Desktop/android/android-ndk-r9d/build/core/add-application.mk:187: *** Android NDK: Aborting...    .

what kind of error is it ,can someone explain to me ?

the total video size is is around 115 mb and  i think my phone storage is suffiicient ..anything will cause the error besides the storage problem ?

thank you

 

How do I add another target to the Video Playback sample

April 7, 2014 - 2:09am #23

application has stopped unexpectedly

That does not tell much.  What does the error logs say ? it is not possible to tell what the error is about, without looking at the error logs of the app.

Also, i could be that the app is simply running out of memory, if you are using too many videos..

How many?

it probably depends how large your video files are, for example, and on the memory limits of the device. 

Many developers in this Forum have reported being able to play many videos by dynamically loading and unloading them, so to keep memory usage low.

 

 

How do I add another target to the Video Playback sample

April 7, 2014 - 12:09am #22
hi Alessandro B,
my videoplayback apps crash again .this time is showing the application has stopped unexpectedly .please try again.i have  no idea what i should changing again . 
I still have many did not understand well,the code in videoplayback .java like below need to change the value of 2 of not if my image target is about 18 image target .btw some of the star rating of the image  is none 
 
 
 
 
if (imageTracker != null)
        {
            imageTracker.start();
            Vuforia.setHint(HINT.HINT_MAX_SIMULTANEOUS_IMAGE_TARGETS, 2);
        } else
 
while in videoplaybakRenderer.java
 
 temp[0] = targetPositiveDimensions[currentTarget].getData()[0] / 2.0f;
            temp[1] = targetPositiveDimensions[currentTarget].getData()[1] / 2.0f;

should i continues to add on the temp [3->temp[17]?

 

can the apps  support up to how many image target ?

 

thank you for the help :)

How do I add another target to the Video Playback sample

April 6, 2014 - 11:03pm #21

can i know will the star rating effect the detection of the image target when the camera capture it ?

yes, star rating may affect detection, see: 

https://developer.vuforia.com/forum/faq/how-can-i-improve-detection-and-tracking-stability

(but if your target has at least 3 stars, that's generally good enough... of course, 4 or 5 stars are recommended for the best experience).

 

then how about the width size that added when we add our image on the online target manager,did it effect the coding ?

Well, if you use the code of the sample, there should be a variable called targetDimensions; that should adjust the video size (rendering) according to the target size, so it should work out-of-the-box....   but this also depends on your code changes.

 

How do I add another target to the Video Playback sample

April 6, 2014 - 7:33pm #20

hi metalistik , 

thank you for helping ..i managed to settled the problem :)

How do I add another target to the Video Playback sample

April 6, 2014 - 7:30pm #19

hi Allesandro 

i managed to settle down dataset of  2 SDK image targets loading to my phone and succesfully loaded it and played it . now i am going to play with more image target on my phone .can i know will the star rating effect the detection of the image target when the camera capture it ?then how about the width size that added when we add our image on the online target manager,did it effect the coding ?

How do I add another target to the Video Playback sample

April 6, 2014 - 4:48am #18

Hi Kathyin

This sounds to me like you are having an issue loading your data sets. I've encountred this problem before myself when I did not correctly manage and had erros in the syntax of the data set declarations. Go though all parts of your code that have to do with the Datasets and the variables pulled out of them. I bet the error is somewhere in there.

How do I add another target to the Video Playback sample

April 4, 2014 - 3:40am #17

1. what version of the SDK are you using ?

2. have you geenrated the Datasets recently using the online Target Manager ?

3. how many targets does the Dataset contain ? what is the star rating of each target ?

 

How do I add another target to the Video Playback sample

April 4, 2014 - 1:24am #16

 i can run the default sample appls very smoothly but now when i am trying to modiffy the stones and chips .xml to my image target  SDK file .however the apps is crashing after changing the name of  stone to my_target ..so ,i am not sure which part i did wrong .i follow the post u did in the https://developer.vuforia.com/forum/faq/android-how-do-i-add-another-target-video-playback-sample&sort=2 but i not adding the taget but changing the target .

How do I add another target to the Video Playback sample

April 4, 2014 - 1:07am #15

kahyin,

you wrote your own code; this is not a crash occurring in the samples; so, first thing to do is to debug it and check where is the error exactly;

then, after investigating and debugging, if you find evidence that the error is something caused by Vuforia, and you can describe the error condition in detail (e.g. with error message logs, description of the erratic code, repro-case and any other useful info to reproduce this), feel free to post your findings back in this Forum, so that we can investigate the issue.

 

How do I add another target to the Video Playback sample

April 4, 2014 - 12:50am #14

hi, i have encounter a problem which is the software crash when i press the start button on the phones .it did not loading the camera which is suppose turn on the camera to detect the image target .btw ,i had change the default image target stones and chips to my image target .the sourcecode has no errors and succesfully laoding to the phone. Can someone help me please ?

How do I add another target to the Video Playback sample

March 12, 2014 - 2:56am #13

Check these few things:

- the variable dataSetStonesAndChips should load your Dataset (see the code line  dataSetStonesAndChips.load( "StonesAndChips.xml" )  and make sure you ahve replaced the name of the XML file)

- the variables public static final int NUM_TARGETS = 2; should be set to 4 in your case (if you have 4 movies)

- have you added another couple of variables beyond the STONES and CHIPS ones, i.e. something like:

    public static final int STONES = 0;
    public static final int CHIPS = 1;
    public static final int MY_THIRD_TARGET = 2;
    public static final int MY_FOURTH_TARGET = 3;
 
- check the use of the variable mMovieName across the VideoPlayback.java code, and in particular make sure you have updated this code along the lines of what I write here:
     mMovieName[STONES] = "VideoPlayback/VuforiaSizzleReel_1.m4v";
     mMovieName[CHIPS] = "VideoPlayback/VuforiaSizzleReel_2.m4v";
     mMovieName[MY_THIRD_TARGET] = "VideoPlayback/My_Video_03.m4v"; // use your atual video filename
     mMovieName[MY_FOURTH_TARGET] = "VideoPlayback/My_Video_04.m4v"; // use your actual video filename
 
Then in the VideoPlaybackRenderer.java (very important), check all occurrences of "chips" or "stones" or "CHIPS" or "STONES" in the code, and adjust the code to handle the "if / else" conditions appropriately to take into account your additional targets (you will need to add additonal "else if" statements); this is primarily a copy-paste work, but pretty easy to do.
 
 

 

How do I add another target to the Video Playback sample

March 11, 2014 - 8:46pm #12

Thank you for the tip. I actually got it to work. I guess some of the CPP code ar enow in the VideoPlaybackRenderer file. However, now I have a new issue. I got the software to recognise my targets, but now it can't tell the differrence  between any targets except "stones". I.E. I have four targets loaded now from two different Data Sets, however all but the "stones" target are recognised as the same and play the same video even though there are individual videos for all four targets. What am I doing wrong? Which part of the code sorts out what video plays? Thanks in advance.

How do I add another target to the Video Playback sample

March 11, 2014 - 1:55am #11

The new 2.8 samples are in Java, including the VideoPlayback sample. The tutorial you refer to was written for the C++ version of Vuforia (prior to 2.8); we are planning to update that tutorial in the near future, but for the time being, the best is to read the existing one, understand the main steps and adapt it to the Java version of the samples;   basically this should be a lot easier, because all the JNI code to link C++ wth Java is no longer needed.

 

How do I add another target to the Video Playback sample

March 11, 2014 - 1:33am #10

I'm also having an issue. I tried to follow the instructions on the forum about adding new targets, but it talks about a CPP file that the current package does not have. All is in Java. Is there another sample package that I need to download? Or is there a new tutorial on how to add etra image targets using only Java? Please help.

How do I add another target to the Video Playback sample

November 27, 2013 - 8:49am #9

can you teach me how to load videos on 5 image? i manage to used the tutorial in your link but i have a problem.. when the image is detect the play icon pop but then when i tap and double tap .. nothing happen :( .., all of my image target..can you give me some advice ?

How do I add another target to the Video Playback sample

November 23, 2013 - 8:10am #8

Hi aain,

I took the time to try and go again through the tutorial in https://developer.vuforia.com/forum/faq/android-how-do-i-add-another-target-video-playback-sample

and I was able to change the chips and stones targets with another dataset with a couple of custom targets (same as you did) and I managed to make it work without observing issues.

In my test I only changed the image targets , not the video files.

I'd suggest to try and debug by putting some logs, to see f you have some incorrect code somewhere by accident, as I don't see other obvious reasons why it should fail..

 

How do I add another target to the Video Playback sample

November 22, 2013 - 9:50pm #7

I replaced "stones" target with my target "first" but still getting error 'failed to load tracker data'. I have created my own dataset StoneAndChips with two images 'first' & 'chips'.

These are the relevant code changes:-

1. if (strcmp(imageTarget.getName(), "first") == 0)
            currentTarget=STONES;
        else
            currentTarget=CHIPS;
 
2. if (strcmp(imageTarget.getName(), "first") == 0)
                glVertexAttribPointer(videoPlaybackTexCoordHandle, 2, GL_FLOAT, GL_FALSE, 0,
                                  (const GLvoid*) &videoQuadTextureCoordsTransformedStones[0]);
            else
                glVertexAttribPointer(videoPlaybackTexCoordHandle, 2, GL_FLOAT, GL_FALSE, 0,
                                  (const GLvoid*) &videoQuadTextureCoordsTransformedChips[0]);
 
Now what am  i missing?
 
 

How do I add another target to the Video Playback sample

November 22, 2013 - 2:14pm #6

Look for the "chips" and "stones" strings in ImageTargets.cpp, and you'll find the code where these are used

(e.g. to compare target name so to do specific actions based on that).

 

How do I add another target to the Video Playback sample

November 22, 2013 - 11:08am #5

I am a bit confused.. with what my target image name should match ? 

For example my target image name is 'my_first'... where do i have to mention this name in the code?

Do i need to upload the thumbnail as well ?

How do I add another target to the Video Playback sample

November 22, 2013 - 6:41am #4

Your dataset can have more than 3 targets, and the order of the targets does not matter.

The important thing is that your C++ code (for loading and activating datasets) is consistent with the actual datasets used, and that the target names (such as "cips", "stones" or "my_image") used in the code are also consistent with the actual names of the targets as defined in the XML file.

For the rest, try and double-check the code that you have modified, and see if you find any inconsistencies.

 

How do I add another target to the Video Playback sample

November 21, 2013 - 11:02pm #3

Yes i have added all the code changes indicated in the link. I am concerned about the dataset ,  the concerns are as follows:-

1. The dataset can have only 3 images, stones, chips & my_image?

2. Do they need to be in a specific order?

3. If my dataset does not contains stones & chips textures, will the textures in my dataset still be recognised?

4. I have deleted stoneandchips.xml and copied  my dataset newdata.xml but now i am getting errors in the logcat :-

Failed to load dataset 'stoneandchips.xml'

Failed to load dataset

( I have changed the relevant c code as well in videoplayback.cpp )

 // Load the data sets:
    if (!dataSetStonesAndChips->load("newdata.xml", QCAR::DataSet::STORAGE_APPRESOURCE))
    {
        LOG("Failed to load data set.");
        return 0;
    }
 

How do I add another target to the Video Playback sample

November 21, 2013 - 4:04pm #2

Make sure to check carefully all the steps and the code changes indicated;

also, make sure you have added your dataset to the assets folder and you have loaded it in the C++ code (next to the loading of chips and stoens).

 

Log in or register to post comments