kmoskwiak / videojs-resolution-switcher

Resolution switcher adds the ability to select the video quality in video.js player.
https://kmoskwiak.github.io/videojs-resolution-switcher/
Other
403 stars 243 forks source link

Documentation - First example missing "var player = this;" #115

Open Edvac opened 6 years ago

Edvac commented 6 years ago

The first example of the documentation should be.

function(){
  var player = this;
    // Add dynamically sources via updateSrc method
    player.updateSrc([
        {
          src: 'http://media.xiph.org/mango/tears_of_steel_1080p.webm',
          type: 'video/webm',
          label: '360'
        },
        {
          src: 'http://mirrorblender.top-ix.org/movies/sintel-1024-surround.mp4',
          type: 'video/mp4',
          label: '720'
        }
      ])
      player.on('resolutionchange', function(){
        console.info('Source changed to %s', player.src())
      })
  }
)

instead of

function(){

    // Add dynamically sources via updateSrc method
    player.updateSrc([
        {
          src: 'http://media.xiph.org/mango/tears_of_steel_1080p.webm',
          type: 'video/webm',
          label: '360'
        },
        {
          src: 'http://mirrorblender.top-ix.org/movies/sintel-1024-surround.mp4',
          type: 'video/mp4',
          label: '720'
        }
      ])

      player.on('resolutionchange', function(){
        console.info('Source changed to %s', player.src())
      })

  })

Otherwise it will give ReferenceError: player is not defined error.