Start a new topic

VideoDrawable without tracker object?

VideoDrawable without tracker object?


Hello! 

I wonder if it is possible to display Green Screen video drawable without using the Tracker object? I have a usecase which does not need image recognition feature so I have no need for tracker object. All I need is to start Wikitude camera view and display in it the Green Screen(Transparent) video drawable.

Can you advise me how this could be done? 

Thank you very much!

Hi Sergey,
You could use a GeoObject in combination with eiter a GeoLocation or a RelativeLocation to position the video on a location. Please refer to the documentation/samples for how to use the GeoObject,GeoLocation & RelativeLocation.

Best regards

Andreas

Andreas, thank you for your reply! 

I have tried that for no success. I can hear the video drawable playing but I do not see video on a screen for some reason. Below is my code. Do you see where I am mistaken? 

 

 video_inner = new AR.VideoDrawable(video_url_inner, scaleLevel, {

                                                 offsetX: propertiesArr,

                                                 offsetY: propertiesArr,

                                                 zOrder:1,

                                                 isTransparent:isVideoTransparent,

                                                 onLoaded: function videoLoaded() {

                                                    myco_video_loaded_inner = true;

                                                    video_inner.play(-1);

                                          },

                                                  onPlaybackStarted: function videoPlaying () {

                                                  myPlaybackStarted = true;

                                                  video_inner.enabled = true;

                                                  video_inner.playing = true;

                                                  hideStatusPanel();

                                                },

                                                 onFinishedPlaying: function videoFinished () {

                                                    video_inner.playing = false;

                                                    video_inner.enabled = false;

                                                  }

                                                }

                                  );

 

 

var geoLoc = new AR.GeoLocation(locationLat,locationLon);

 

var location1 = new AR.RelativeLocation(geoLoc, 0, 0, 0);

var geoObject1 = new AR.GeoObject(location1, {

         enabled : true,

         onEnterFieldOfVision:function() {

 

         },onExitFieldOfVision:function() {

  

         }, drawables: {

                    cam: video_inner

                }

       });

 

       geoObject1.enabled = true;

Hi Sergey,
I've created a very basic sample which positions a video 10 meters north of your current location.

You can pass 'null' as location during the creation of a AR.RelativeLocation. That indicates that the relative location should be relative to the current location.

I also added a direction indicator that will point to the video drawable if it's currently not visible.

I hope you can resolve your issue based on that sample.

Best regards

Andreas

Hi Andreas!

Thank you very much for your reply and the example! Yes, Geo Object now works when loaded in a separate from tracker object architect world. I will look in to it in greater details and will re-arrange things in my code to make it work. But yes, the example you have shared with me works. I have noticed another probem though and I now have spend couple of hours trying to figure it out. I cannot get Image Drawable loaded in geo object clickable. I remember myself posting here on the forum that when video drawable is used together with image drawable, image drawable is not clickable for some reason.... :(... now I got into exactly same situation. Geo Object loads up Video Drawable and Image Drawable and the image drawable is not clickable. Can you advise me why?

 

var closeIcon = new AR.ImageDrawable(new AR.ImageResource('http://www.earthlandia.com/complement/data/images/tap_button.jpg'), 1, {

          offsetX: 2,

          offsetY: 1,

          enabled: true,

 

     onClick: function() {

              document.location = "architectsdk://drawableView?type=image&documentId=1&url=1";

            } 

});

 

var location1 = new AR.RelativeLocation(null, 10, 0);

        var geoObject1 = new AR.GeoObject(location1, {

        drawables: {

                   cam:

                },

        onClick: function() {

              document.location = "architectsdk://drawableView?type=image&documentId=2&url=2";

            } 

       });

 

 

Hi Sergey,
As far as I can see from your snippet you're making the mistake by setting a onClick on a GeoObject. That can not work because the GeoObject itself has no onClick event. Only drawables (they have a visual representation) have an onClick event. Abstract things like ARObjects (GeoObject, Trackable2DObject) don't have this trigger as they don't have any visual representation.

FYI: you don't need to set a drawable 'enabled: true' in the constructor as they are enabled by default.

Best regards

Andreas

Andreas, thank you very much for your your message! 

I have just checked the documentation for GeoObject on this page http://www.wikitude.com/developer/documentation/ios and it shows that GeoObject DOES have onClick(). Is it correct? 

But I have actually added onClick event to GeoObject only after I lost my hope to make onClick event working with Image Drawable. I have removed the onClick event from GeoObject now to check if onClick event will be called for image drawable and it does not work. It just does not get called. Same with the "enabled" property. I know it should be true by default, but when button does not work and everything has been checked I wanted to make sure that it is set to "true" and it is enabled. I am trying to figure out why tap on a button does not trigger onClick event in Image Drawable. 

 

var closeIcon = new AR.ImageDrawable(new AR.ImageResource('http://www.earthlandia.com/complement/data/images/tap_button.jpg'), 1, {

          offsetX: 2,

          offsetY: 1

 

         onClick: function() {

              document.location = "architectsdk://drawableView?type=image&documentId=1&url=1";

            } 

});

 

var location1 = new AR.RelativeLocation(null, 10, 0);

        var geoObject1 = new AR.GeoObject(location1, {

        drawables: {

                   cam:

                } 

       });

 

 

 

Sergey

 

 

Hi Sergey,
I responded to your mail from a few days ago. I will post the result in this thread for all the other forum user, but let's move our conversation to mails only. Makes it easier for me ;)

Best regards

Andreas

Sorry, I use this code but it is not work:

var drawableLocation = new AR.RelativeLocation(null, 10, 0, 0);
var geoObject = new AR.GeoObject(drawableLocation, {
  drawables: {
   cam: videoDrawable,
   indicator: directionIndicator
  },
  onEnterFieldOfVision: function(targetName) {
      AR.logger.info("video onEnterFieldOfVision");
      AR.logger.info(targetName);
  },
  onExitFieldOfVision: function(targetName) {
      AR.logger.info("video onExitFieldOfVision");
      AR.logger.info(targetName);
  }
});

I have try new AR.RelativeLocation(null, 10, 0, 0); and new AR.RelativeLocation(null, 0, 0, 0);

Both do not work

Can anyone help?

Hi Lilian,
What are you trying to do?

Best regards

Andreas

I would like to play videoDrawable without tracker object in android, I follow this code but it dosen't work.

But I have found the solution.

Thanks anyway

Hi Lilian lau,

I am also trying to developed something like this...when user open the camera then video will play without any tracker....in android..

is it possible can you please share your code ..or give me an idea ??

thanks

 

In your StartupConfiguration, you cannot choose StartupConfiguration.Features.GEO

This is my StartupConfiguration:

 

StartupConfiguration config = new StartupConfiguration(
this.getWikitudeSDKLicenseKey(),
StartupConfiguration.Features.Tracking2D,
this.getStartupConfigurationCameraPosition()
);

 

But you still need to define your ARObject as a AR.GeoObject in your javascript:

This is my ARObject:

 

videoDrawable = new AR.VideoDrawable('assets/output-iphonepod.mp4', 13, {
offsetY : -0.1,
isTransparent : true,
zOrder : 1,
onLoaded : function onLoadedFn() {
videoDrawable.play(-1);
},
onError : function(message) {
document.location = "architectsdk://error?message=" + message;
}
});

drawableLocation = new AR.RelativeLocation(null, 10, 0);
geoObject = new AR.GeoObject(drawableLocation, {
drawables : {
cam : videoDrawable,
indicator : directionIndicator
}
});

 

I hope this will be helpful

Hi Lilian,
When using the Wikitude SDK you always need either an AR.GeoObject or AR.Trackable2DObject to attach drawables to. Stand alone drawables are not supported.

Are you sure that you can't select the geo feature from a startup configuration? Have you had a look at our example application? It uses this to check if the sensors needs to be activated for a particular example.

Specifying the geo feature does not compensate for any GeoObject creation in JS. It only tells the SDK to start up the GPS and gyro sensor.

Best regards

Andreas
Login or Signup to post a comment