Start a new topic

VideoDrawable in click button in HTML

Qestion :
How can I to start video by click in button  and showing video while i walk 



I want to show some button in Geolocation and when the user press in the button the video will start? 


1 Comment

Hi Beshr,


You can do that by defining a GeoLocation object and a VideoDrawable as suggested below:


//create the location first - the feature can either be GeoLocation or Relative Location
var markerLocation = new AR.GeoLocation(poiData.latitude, poiData.longitude, poiData.altitude);

//create the video drawable and add events
var video = new AR.VideoDrawable(“assets/video.mp4”, 0.5, {
  translate: {
      x: 0.2,
      y: 0.2
  },
  onLoaded: function videoLoaded() {
       playButton.enabled = true;
   },
   onPlaybackStarted: function videoPlaying () {
       playButton.enabled = false;
       video.enabled = true;
   },
   onFinishedPlaying: function videoFinished () {
       playButton.enabled = true;
       video.playing = false;
       video.enabled = false;
   },
   onClick: function videoClicked () {
       if (video.playing) {
           video.pause();
           video.playing = false;
           playButton.enabled = true;
       } else {
           video.resume();
           video.playing = true;
           playButton.enabled = true;
       }
   }

});

//link the video drawable object with the location object
var geoObject = new AR.GeoObject(markerLocation, {
    drawables: {
        cam: video
    }
});


Thanks

Eva

Login or Signup to post a comment