No description
Find a file
2015-07-27 19:00:29 +02:00
lib init 2015-07-27 18:12:42 +02:00
test init 2015-07-27 18:12:42 +02:00
.editorconfig init 2015-07-27 18:12:42 +02:00
.gitignore Initial commit 2015-07-27 18:10:32 +02:00
.jshintrc init 2015-07-27 18:12:42 +02:00
.npmignore init 2015-07-27 18:12:42 +02:00
example.html readme, version 2015-07-27 18:58:59 +02:00
Gruntfile.js init 2015-07-27 18:12:42 +02:00
LICENSE-Apache-2.0 init 2015-07-27 18:12:42 +02:00
package.json readme, version 2015-07-27 18:58:59 +02:00
README.md readme 2015-07-27 19:00:23 +02:00

Video.js Resolution Switcher

Resolution switcher for video.js build for 5.0.0-rc.29

Getting Started

Once you've added the plugin script to your page, you can use it with any video:

<video id='video'></video>
<script src="video.js"></script>
<script src="videojs-resolution-switcher.js"></script>
<script>
  videojs('video', {
    controls: true
  }, function(){
  
    // Add dynamically sources via newVideoSources method
    player.newVideoSources([
        {
          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())
      })
      
  }).videoJsResolutionSwitcher();
</script>

There's also a working example of the plugin you can check out if you're having trouble.

Methods

newVideoSources([source])


// Update video sources
player.newVideoSources([
  { type: "video/mp4", src: "http://www.example.com/path/to/video.mp4", label: 'SD' },
  { type: "video/mp4", src: "http://www.example.com/path/to/video.mp4", lable: 'HD' },
  { type: "video/mp4", src: "http://www.example.com/path/to/video.mp4", label: '4k' }
])

PARAMETERS:

  • source Array array of sources

Events

resolutionchange EVENT

Fired when resolution is changed