我想使用javaScript静音和取消静音音量。
AFRAME.registerComponent('volume', {
init: function () {
var buttonVolume = document.querySelector('#control-volume');
var buttonMute = document.querySelector('#control-mute');
var vid = document.querySelector('#video-src');
//vid.setAttribute('volume', this.value);
this.el.addEventListener('click', function (evt) {
//alert(this.vid.muted);
if(this.vid.muted === true){
this.vid.muted = false;
buttonVolume.setAttribute('visible', 'true');
buttonMute.setAttribute('visible', 'false');
}
else{
this.vid.muted = true;
buttonVolume.setAttribute('visible', 'false');
buttonMute.setAttribute('visible', 'true');
}
}, false);
}
});
这是我的代码。但总是显示Uncaught TypeError: Cannot read property 'muted' of undefined
。如何解决这个错误?
<video id="video-src" style="display:none"
autoplay="true" loop="false" crossorigin="anonymous" playsinline webkit-playsinline>
<!-- MP4 video source. -->
<source id="load" type="video/mp4"/>
</video>
<a-image volume id="control-volume" class="clickable" width="0.4"
height="0.4" src="#volume-normal" position="3 -4.440 -3.542" scale="1.3 1.3
1.3"></a-image>
<a-image volume id="control-mute" class="clickable" width="0.4" height="0.4" src="#volume-mute" position="3 -4.440 -3.542" scale="1.3 1.3 1.3" visible="false">
</a-image>
这是我的html编码。如何解决这个错误。什么原因?为什么会出现错误?
答案 0 :(得分:0)
发布回答。代码中有拼写错误。
book = openpyxl.load_workbook('report-201808March0709AM522986.xlsx')
sheet = book.active
a1 = sheet['J1']
a2 = sheet['J2']
a3 = sheet['J3']
print(a1.value)
print(a2.value)
print(a3.value)
被引用为var vid
。删除了this.vid
。