首页 > 解决方案 > 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>`

外壳进程正常运行,
但视频永远不会开始

标签: javascriptphphtmlshell

解决方案


推荐阅读