No description
Find a file
Kasper Moskwiak 3183bbaf1c readme fix
2015-07-28 15:16:00 +02:00
lib set sources inside video tag 2015-07-28 14:24:07 +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 set sources inside video tag 2015-07-28 14:24:07 +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 fix 2015-07-28 15:16:00 +02:00

Video.js Resolution Switcher

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

Getting Started

Setup sources dynamically:

<video id='video' class="video-js vjs-default-skin"></video>
<script src="video.js"></script>
<script src="videojs-resolution-switcher.js"></script>
<script>
  videojs('video', {
    controls: true
  }, 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())
      })
      
  }).videoJsResolutionSwitcher();
</script>

Or use <source> tags:


<video id="video" class="video-js vjs-default-skin" width="1000" controls data-setup='{}'>
   <source src="http://mirrorblender.top-ix.org/movies/sintel-1024-surround.mp4" type='video/mp4' label='SD' />
   <source src="http://media.xiph.org/mango/tears_of_steel_1080p.webm" type='video/webm' label='HD'/>
</video>
 <script>
  videojs('video').videoJsResolutionSwitcher()
</script>

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

Methods

updateSrc([source])


// Update video sources
player.updateSrc([
  { 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", label: '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