Support for Wikitude Software Development Kit and tools is coming to an end. All the details can be found here. Kindly note that no new topics can be started on the forum from 21.09.2023. Also, some of the FAQs here (especially license related ones) might become inaccurate.
Hi. I would like to know how to add a video.play() in a button.
I have the following code:
var World = { loaded: false, init: function initFn() { this.createOverlays(); }, createVideoBtn: function createVideoBtnFn(imgButton, size, video) { var Vbtn = new AR.ImageDrawable(imgButton, size, { offsetX: -0.25, offsetY: -0.25, onClick : function() { video.enabled = true, video.play(); } }); return Vbtn; }, createOverlays: function createOverlaysFn() { this.tracker = new AR.ClientTracker("assets/tracker.wtc", { onLoaded: this.worldLoaded }); var imgButton = new AR.ImageResource("assets/button.png"); var videourl = "assets/video.mp4"; var video = new AR.VideoDrawable(videourl, 0.40, { offsetY: -0.3, enabled: false, }); var page4Button = this.createVideoBtn(imgButton, 0.45, video); var page4 = new AR.Trackable2DObject(this.tracker, "Cocodrilo", { drawables: { cam: [page4Button] } }); },};World.init();
But, it doesn't work properly and it doesn't show the video, only the audio is heard.
Rodrigo Hidalgo
Hi. I would like to know how to add a video.play() in a button.
I have the following code:
But, it doesn't work properly and it doesn't show the video, only the audio is heard.