问题描述
我正在检查视频正在播放的时间并将其放在控制台上。 到目前为止,这是有效的。
但是我的 if 条件不起作用? 我想在视频播放 3 秒后发送串行消息。
感谢您的帮助!
<script>
var vid = document.getElementById("video");
// Assign an ontimeupdate event to the video element,and execute a function if the current playback position has changed
vid.ontimeupdate = function() {myFunction()};
function myFunction() {
// display the current position of the video in a p element with id="debug"
// document.getElementById("debug").innerHTML = vid.currentTime;
console.log(vid.currentTime);
}
if (vid.currentTime > 3.000000) {
function writetoSerial() {
myPort.write('a');
}
}
vid.onended = function() {
window.location.assign("index.html");
function writetoSerial() {
myPort.write('x');
}
// alert("The video has ended");
};
</script>
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)