【发布时间】:2018-11-18 06:51:07
【问题描述】:
我正在尝试检测 mp4 格式的 360 度视频是否在显示隐藏的 btn1 之前结束。
<a-videosphere id="videosphere1"
rotation="0 180 0"
visible="true"
src="#vid1"
show-btn-when-ended="target: #btn1"
autoplay = "true">
</a-videosphere>
要显示的按钮
<a-entity
id="btn1"
geometry = "primative: plane"
position = "-0.8 3 -12.3"
rotation = "0 -1 -3"
scale = "12.5 25 1"
visible = "false"
text = "align:center; width: 6; wrapCount:100; color:black;
value: CLICK HERE"
go-toScene-onCLick>
</a-entity>
脚本不工作。无法使用 javascript 将可见属性更改为 true
AFRAME.registerComponent('show-btn-when-ended', {
init: function () {
el = this.el;
this.showBtn= this.showBtn.bind(this);
el.addEventListener('ended', this.showBtn);
},
showBtn: function(evt) {
console.log('in window.showBtn');
var videosphere1 = document.querySelector("#videosphere1")
var btn1 = document.querySelector('#btn1');
btn1.setAttribute('visible', 'true');
console.log("Show Button");
}
})
【问题讨论】:
标签: javascript html aframe 360-virtual-reality