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

Generate unique IDs for multiple videos

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 3.4.4, 3.5.1
    • 3.4, 3.4.3
    • Media
    • MOODLE_34_STABLE
    • MOODLE_34_STABLE, MOODLE_35_STABLE
    • MDL-62336_master
    • Hide
      1. Login as an admin
      2. Go to "Site administration / Plugins / Media players / Manage media players"
      3. Make sure that "VideoJS player" is enabled and on the top of the list of "Available players".
      4. Save the changes.
      5. Create a course.
      6. Add an assignment.
      7. In the description record two videos.
      8. Save.
      9. Click to view the assignment.
      10. Inspect the HTML of the videos.
      11. Confirm one of the videos ids ends with '_1_html5_api' and the other '_2_html_api'.
      Show
      Login as an admin Go to " Site administration / Plugins / Media players / Manage media players " Make sure that " VideoJS player " is enabled and on the top of the list of " Available players ". Save the changes. Create a course. Add an assignment. In the description record two videos. Save. Click to view the assignment. Inspect the HTML of the videos. Confirm one of the videos ids ends with '_1_html5_api' and the other '_2_html_api'.

      The media_videojs class, in generating the ID attribute for a video/audio tag, will usually assign identical IDs to different video/audio elements when multiples appear in the same content block. 

      In media_videojs_plugin::embed(),

      $attributes = [
      'data-setup' => '{' . join(', ', $datasetup) . '}',
      'id' => 'id_videojs_' . uniqid() ,
      'class' => get_config('media_videojs', $isaudio ? 'audiocssclass' : 'videocssclass')
      ];

      The uniquid() function returns the same value for any given microsecond. Please consider appending a rand() value, e.g. $attributes['id'] = 'id_videojs_' . uniqid() . rand()

       

            markn Mark Nelson
            czinn carolyn zinn
            Carlos Escobedo Carlos Escobedo
            Jun Pataleta Jun Pataleta
            Janelle Barcega Janelle Barcega
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 hour
                1h

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.