javascript - php shell 和 video 并行运行
问题描述
我正在尝试将眼动仪与网站连接起来。我希望当用户按下按钮时,视频开始播放并同时运行 shell 进程
这是我的代码的一部分`
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<video id="vid1" width="100%" height="240" >
<source src="assets/img/aa.mp4" type="video/mp4" >
</video>
<script>
function play(vidid) {
var myVideo = vidid;
$('.vjs-fullscreen-control').click();
if (myVideo.requestFullscreen) {
myVideo.requestFullscreen();
}
else if (myVideo.msRequestFullscreen) {
myVideo.msRequestFullscreen();
}
else if (myVideo.mozRequestFullScreen) {
myVideo.mozRequestFullScreen();
}
else if (myVideo.webkitRequestFullScreen) {
myVideo.webkitRequestFullScreen();
}
myVideo.play();
var vid = document.getElementById("vid");
vidid.onended = function() {
document.exitFullscreen(); //kanei exit toy video apo thn prliri o8oni otan auto teleiosei
}
}
</script>
</div>
<a href="?run=true" type="button" name="something" value="start_experiment" onclick="play(vid1);">start</a>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.0/js/bootstrap.bundle.min.js"></script>
<script src="popup.js"></script>
</body>
<?php
if ($_GET['run']) {
$last_line = exec("cd tobii_eye_tracker_linux_installer-master/example && ./main>example.txt > /dev/null 2>/dev/null &");
}
?>
</html>`
外壳进程正常运行,
但视频永远不会开始
解决方案
推荐阅读
- python - cppyy 继承包含智能指针的类
- django - NoReverseMatch at /theme/ Reverse for 'article' with arguments '('',)' 未找到。尝试了 1 种模式:['theme/(?P
[0-9]+)$' - html - 如何使用伪元素向 div 添加图标 - CSS
- javascript - webpack - 使用 DefinePlugin 处理 SCSS 文件
- javascript - 基于 React 输入字段的禁用按钮无法正常工作
- windows - 如果没有窗口处于活动状态,则运行热键
- angular - 如何在 Angular 中使用 Azure 应用程序配置
- kubernetes - Minishift Kubernetes Dashboard 抛出错误:找不到服务“kubernetes-dashboard”
- javascript - 从日期字符串的时区中的日期字符串获取小时,不转换为当前时间
- python - Numpy square 为数组返回错误的值