Log in or register to post comments

Add my new trackable data and movie in viedoplayback sample

November 9, 2012 - 10:43pm #1

I successfully run android viedoplayback AR sample in my device.After installing app in my device it can track two image(stones and chips) and can play viedo according with image.

Now i want to add new trackable image and movie in this sample application.Please give some solution...

Add my new trackable data and movie in viedoplayback sample

November 13, 2012 - 7:24am #10

Investigating a bit further: it seems that MP4 sometime have problems to be played in streaming mode; this seems to depend on some encoding settings when the video was created. 

This means that if somehow the mp4 has been encoded with some "streaming unfriendly" settings, it will be possible to play it from file (after downloading it to disk) but not in streaming mode (i.e. directly from http). 

This issue does not seem to be Android specific, but a more general issue of MP4 videos.

This is discussed for example in this forum:

http://www.longtailvideo.com/support/forums/jw-player/setup-issues-and-embedding/11471/mp4-video-not-streaming-encoding-issue

 

 

Add my new trackable data and movie in viedoplayback sample

November 13, 2012 - 6:02am #9

sajol,

I tried the video that you have sent me, and indeed it does not work, but that is due to a connection failure, not the video itself;

so, the video format is fine; in fact, if you download it and save it to your disk, and you copy it on the device /sdcard/ (using adb push) you can play it, so the android mediaplayer has no problem with it.

however, retrieving it from the http address is problematic (for some reasons that do not depend on the android mediaplayer);

I tried with other videos over http and they work just fine, however when I tested with your http video, I could not even play it from Internet explorer or other web browser (the video just does not start, showing black screen); although you can actually download the video (save as...).

The log that I got shows there are various connection attempts, and eventually it fails after 10 tries; so, it is a network issue with that address.

I would suggest trying with other video links.

 

Add my new trackable data and movie in viedoplayback sample

November 13, 2012 - 12:51am #8

Hi sajol,

can you provide a link to the video that you are trying to play (if that's public) ?

so, we could make a test here too.

Add my new trackable data and movie in viedoplayback sample

November 13, 2012 - 12:44am #7

Hi, I tried following stream and it worked ok at least;

mMediaPlayer.setDataSource("rtsp://dmzosx001.dpa.act.gov.au/medium");

Add my new trackable data and movie in viedoplayback sample

November 12, 2012 - 8:00pm #6

In ViedoPlayerHelper.java i comment following three line of code

AssetFileDescriptor afd =

mParentActivity.getAssets().openFd(filename);

 

mMediaPlayer.setDataSource(afd.getFileDescriptor(),afd.getStartOffset(),afd.getLength());

afd.close();

and uncomment

mMediaPlayer.setDataSource(sting);

I follow the instruction as suggest in viedoPlayerHelper.load method.But it does't work.please give me a solution

Add my new trackable data and movie in viedoplayback sample

November 12, 2012 - 12:56am #5

Indeed, you can follow Harism's suggestion, just put the video URL in the setDataSource.

Add my new trackable data and movie in viedoplayback sample

November 12, 2012 - 12:47am #4

Hi, take a look at VideoPlayerHelper.load method. There's a line where data source is set, and you should change it to MediaPlayer.setDataSource(Context, Uri) - where Uri is the url to your video stream.

Edit: Ah, actually you can use MediaPlayer.setDataSource(String) too, where String is your stream url.

Add my new trackable data and movie in viedoplayback sample

November 11, 2012 - 9:41pm #3

Thank you very much.It works fine.

I have another problem.I want to play viedo from web server.Please give me some instruction

Add my new trackable data and movie in viedoplayback sample

November 11, 2012 - 7:27am #2

Hi, here are some guidelines on how to achieve what you want:

- open VideoPlayback.java:

- modify the NUM_TARGETS value to 3 or more (now it is set to 2)

- add a definition for an extra target next to CHIPS and STONES, i.e. update this code:

 

    public static final int NUM_TARGETS                 = 3; // was 2, set it to 3 or more

    public static final int STONES                    = 0;

    public static final int CHIPS                       = 1;

 

    public static final int MY_TARGET                = 2; // added code

 
- Add the filename of your new movie in mMovieNames, i.e.:
 
    mMovieName[STONES] = "VuforiaSizzleReel_1.m4v";
    mMovieName[CHIPS] = "VuforiaSizzleReel_2.m4v";
    mMovieName[MY_TARGET] = "My_Movie_Filename.m4v"; //added line of code
 
 
- Open VideoPlayback.cpp (under the JNI directory of the project):
 
  Update the definitions of NUM_TARGETS and the target names as follow:
 
static const int NUM_TARGETS = 3; //was 2 in original sample code, set it to 3 or more
static const int STONES = 0;
static const int CHIPS = 1;
static const int MY_TARGET = 2; //new line of code for my target
 
Update this code (in _initRendering function):
   keyframeQuadAspectRatio[STONES] = (float)textures[0]->mHeight / (float)textures[0]->mWidth;
    keyframeQuadAspectRatio[CHIPS]  = (float)textures[1]->mHeight / (float)textures[1]->mWidth;
    keyframeQuadAspectRatio[MY_TARGET]  = (float)textures[2]->mHeight / (float)textures[2]->mWidth; //added line of code for my target
 
 
In _renderFrame function, update the code to determine the currentTarget as follows:
 
if (strcmp(imageTarget.getName(), "stones") == 0)
            currentTarget=STONES;
else if (strcmp(imageTarget.getName(), "chips") == 1)
            currentTarget=CHIPS;
else
        currentTarget=MY_TARGET;
 
 
Similarly, update the glVertexAtribPointer code:
 
if (strcmp(imageTarget.getName(), "stones") == 0)
                glVertexAttribPointer(videoPlaybackTexCoordHandle, 2, GL_FLOAT, GL_FALSE, 0,
                                  (const GLvoid*) &videoQuadTextureCoordsTransformedStones[0]);
       else if (strcmp(imageTarget.getName(), "chips") == 0)
                glVertexAttribPointer(videoPlaybackTexCoordHandle, 2, GL_FLOAT, GL_FALSE, 0,
                                  (const GLvoid*) &videoQuadTextureCoordsTransformedChips[0]);  
      else 
               glVertexAttribPointer(videoPlaybackTexCoordHandle, 2, GL_FLOAT, GL_FALSE, 0,
                                  (const GLvoid*) &videoQuadTextureCoordsTransformed_My_Target[0]);
 
- Add this definition at the beginning of PlaybackVideo.cpp (next to the other two for chips and stones):
 
GLfloat videoQuadTextureCoordsTransformed_My_Target[] = {
    0.0f, 0.0f,
    1.0f, 0.0f,
    1.0f, 1.0f,
    0.0f, 1.0f,
};
 
 
- Update the _setVideoDimensions function to account the MY_TARGET case (next to CHIPS and STONES)
 
 
Finally, create a new DataSet using the TMS and uploading three images (Chips, Stones and a third image of your choice), and use it instead of the currently used DataSet in the sample.
 
I hope this helps.
 
 

 

 

Log in or register to post comments