Error SyntaxError: Unexpected token in Chrome [closed]

0

I'm having trouble with this code ... it's saying "SyntaxError: Unexpected token <" in the Chrome console. But I do not see any "," or ";" out of place. Anyone have any idea what that might be?

 videojs("video", { "controls": true, 
                   "preload": "metadata", 
                   "poster": "<?= $video->getThumbnail($json); ?>", 
                   textTrackSettings: false, 
                   aspectRatio: '16:9', 
                   fluid: true,
                   html5: { nativeTextTracks: false }, 
                   plugins: { 
                    videoJsResolutionSwitcher: { 
                      default: "high",
                      dynamicLabel: true 
                    }
                  }
                }, function() {
                    this.updateSrc([<?= $video->printSources($json); ?>]);
                    this.on('resolutionchange', function(){
                      console.info('Source changed to %s', this.src());
                    });
                  });
    
asked by anonymous 30.05.2017 / 02:22

2 answers

1

The problem is in URLs:

Files do not exist on the server, their path must be wrong, this error message:

  

SyntaxError: Unexpected token

Because probably trying to load is downloaded from the error page which is an HTML and the first character found is the < in the line:

<div class="container not-found">

The JavaScript engine attempts to parse and finds < of <div , then causes the error. To resolve the URLs correct, or if they are correct then it must be because you did not upload properly or some folder or file name is in capital letters, when they should have lowercase letters.

    
30.05.2017 / 03:31
-1

Your application is probably expecting a response in JSON, but it is receiving HTML (probably an error page). If possible, check the backend logs.

I hope I have helped.

    
30.05.2017 / 17:47