Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-65028

loader.js reference to "setup-lazy" that should be "data-setup-lazy"?

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Not a bug
    • Affects Version/s: 3.5.4
    • Fix Version/s: None
    • Component/s: JavaScript
    • Labels:
      None
    • Affected Branches:
      MOODLE_35_STABLE

      Description

      We integrate our Moodle with Poodll for video and audio recording.  After a Teacher adds a feedback audio recording to a Assignment Submission of a student. The left side of the grader page goes blank.  It's caused by a javascript error.  If the teacher navigates back to the submission from the view all submissions page the left side of the grader mostly loads, except for the Feedback files. It just spins again because of a javascript error.

      I started a ticket with Poodll but after digging I think it might be a typo in core's loader.js.

      https://support.poodll.com/support/tickets/3449
      The error was on first.js:168 according to Chrome.  In Chrome's Developer Tools, I used "Pretty Print" on first.js to make it readable. After prettying up the code, line 168 becomes the following lines of code. 
       
      define('media_videojs/loader', ["jquery", "core/event"], function(a, b) {
          var c, d = function(d) {
              c = d,
              e(null, a("body")),
              b.getLegacyEvents().done(function(b)

      {             a(document).on(b.FILTER_CONTENT_UPDATED, e)         }

      )
          }, e = function(b, d) {
              var e = ".mediaplugin_videojs";
              d.find(e).addBack(e).find("audio, video").each(function() {
                  var b = a(this).attr("id")
                    , d = a(this).data("setup-lazy")
                    , e = ["media_videojs/video-lazy"];
                  d.techOrder && d.techOrder.indexOf("youtube") !== -1 && e.push("media_videojs/Youtube-lazy"),
                  d.techOrder && d.techOrder.indexOf("flash") !== -1 && e.push("media_videojs/videojs-flash-lazy"),
                  require(e, function(a)

      {                 c && (c(a),                 c = null),                 a(b, d)             }

      )
              })
          };
          return

      {         setUp: d     }

      });
       
       
      Comparing the code to the HTML Elements I notice the class .mediaplugin_videojs is found then all the audio (and video) tags within it. It then loops through each audio/video tag and tries to get .data() on "setup-lazy".  But "d" will be undefined because there is no "setup-lazy" attribute. BUT there IS a "data-setup-lazy" attribute.
       
      If I search our Moodle code base which includes all our Poodll plugins for "setup-lazy" I find 7 instances. None of which are in Poodll plugin files.  It's only referenced as setup-lazy on loader.js which gets minified into loader.min.js.  The other references use "data-setup-lazy" in plugin.php and playertest.php.
       
      At the moment I think this is a Moodle core issue because of a typo but I'm not 100% sure yet.  Since I can not recreate or debug this anywhere except our production server I hesitate to change loader.js, re-minify the code, and test it on production server.
       
      I'd change /media/player/videojs/amd/src/loader.js line 65
      from:
      config = $(this).data('setup-lazy'),
      to:
      config = $(this).data('data-setup-lazy'),
       

      Does anyone know a for sure if it should be "setup-lazy" or "data-setup-lazy"?

       

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              swit Matthew G. Switlik
              Participants:
              Component watchers:
              Jake Dallimore, Jun Pataleta
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: