关于javascript中的PHP路径

I have been Working on a project in that project I am using single video on home page as slider in design everything is good but when we work on core php.Video is not showing because of in the design video comes using jquery with static path but in the development how to give php path in jquery and how to dynamically change this video from the back-end. I have done php path in jquery like (filename":" But it's not Working. please correct it.

<script>
$(document).ready(function() {
var videobackground = new $.backgroundVideo($('.page-sec'), {
  "align": "centerXY",
  "width": 1280,
  "height": 720,
  "path": "uploads/",
**"filename":"<?php foreach($videos as $video){
   echo $path.$video['video'];**}  ?>",
   "types": ["mp4","ogg","webm"]
    });});
   </script>
<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>Test</title>

        <script type="text/javascript">
            $(document).ready(function () {
                var videoPathsString = $('#videoPaths').val();
                var videoPathsArray = videoPathsString.split(',');

                var videobackground = new $.backgroundVideo($('.page-sec'), {
                    "align": "centerXY",
                    "width": 1280,
                    "height": 720,
                    "path": "uploads/",
                    "filename": videoPathsArray,
                    "types": ["mp4", "ogg", "webm"]
                });
            });
        </script>
    </head>
    <body>
        <?php
        $videoPaths = '';
        foreach ($videos as $video) {
            if ($videoPaths != '') {
                $videoPaths .= ',';
            }
            $videoPaths .= $path . $video['video'];
        }
        ?>
        <input type="hidden" id="videoPaths" name="videoPaths" value="<?php echo $videoPaths; ?>" />
    </body>
</html>