1

I arelady found how to load external JS file into moodle? but it doesn't solve my problem.

I got an external JS file must be loaded as it's the VOD service's player.

Having to call it in <script></script> in my course's video page like so,

 <script type="text/javascript">
 (function(){ 
   var option ={"auto_play":"0","file_id":"someid","app_id":"some_app_id","width":0,"height":0,"https":1}; 
   new qcVideo.Player( "id_video_container_someid" /* this is the div id */, option ); 
 })() 
 </script>

So this qcVideo is Uncaught ReferenceError: qcVideo is not defined as Moodle uses require.js to load js files, and I'm not familiar with that.

The js file is h5connect.js.

I tried to put it in my theme's javascript folder and amd/src folder. and in theme's config.php like this $THEME->javascript_footer=array('h5connect'); both not working.

So what exactly I should do to make this qcVideo.Player work?

tomriddle_1234
  • 3,145
  • 6
  • 41
  • 71

1 Answers1

0

You need to first include the JS file and then you can put the tag. Then it should work.

$PAGE->requires->js('/local/programmanagement/module.js'); Put your script tag after it. It seems u are putting script tag before the js lib loaded.

Bishwanath Jha
  • 399
  • 3
  • 10