mirror of
https://github.com/kmoskwiak/videojs-resolution-switcher.git
synced 2025-10-03 17:59:42 +02:00
Hide loading spinner after playing (flash issue). Added example with flash.
This commit is contained in:
parent
9807328dc0
commit
b09025742b
2 changed files with 51 additions and 1 deletions
47
example.html
47
example.html
|
@ -44,6 +44,14 @@
|
||||||
<source src="https://vjs.zencdn.net/v/oceans.mp4?144" type='video/mp4' label='phone' res='144'/>
|
<source src="https://vjs.zencdn.net/v/oceans.mp4?144" type='video/mp4' label='phone' res='144'/>
|
||||||
<source src="https://vjs.zencdn.net/v/oceans.mp4?2160" type='video/mp4' label='4k' res='2160'/>
|
<source src="https://vjs.zencdn.net/v/oceans.mp4?2160" type='video/mp4' label='4k' res='2160'/>
|
||||||
</video>
|
</video>
|
||||||
|
|
||||||
|
<div class="info">
|
||||||
|
<p>
|
||||||
|
Use flash
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<video id='video_flash' class="video-js vjs-default-skin"></video>
|
||||||
|
|
||||||
<script src="node_modules/video.js/dist/video.js"></script>
|
<script src="node_modules/video.js/dist/video.js"></script>
|
||||||
<script>
|
<script>
|
||||||
|
@ -86,6 +94,45 @@
|
||||||
})
|
})
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
// Use flash
|
||||||
|
videojs('video_flash', {
|
||||||
|
controls: true,
|
||||||
|
techOrder: ['flash'],
|
||||||
|
preload: 'auto',
|
||||||
|
width: 1000,
|
||||||
|
plugins: {
|
||||||
|
videoJsResolutionSwitcher: {
|
||||||
|
default: 'low', // Default resolution [{Number}, 'low', 'high'],
|
||||||
|
dynamicLabel: true // Display dynamic labels or gear symbol
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, function(){
|
||||||
|
var player = this;
|
||||||
|
window.player = player
|
||||||
|
|
||||||
|
player.updateSrc([
|
||||||
|
{
|
||||||
|
src: 'https://vjs.zencdn.net/v/oceans.mp4?sd',
|
||||||
|
type: 'video/mp4',
|
||||||
|
label: 'SD',
|
||||||
|
res: 360
|
||||||
|
},
|
||||||
|
{
|
||||||
|
src: 'https://vjs.zencdn.net/v/oceans.mp4?hd',
|
||||||
|
type: 'video/mp4',
|
||||||
|
label: 'HD',
|
||||||
|
res: 720
|
||||||
|
}
|
||||||
|
])
|
||||||
|
|
||||||
|
player.on('resolutionchange', function(){
|
||||||
|
console.info('Source changed to %s', player.src())
|
||||||
|
})
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,10 @@
|
||||||
// Probably because of https://github.com/videojs/video-js-swf/issues/124
|
// Probably because of https://github.com/videojs/video-js-swf/issues/124
|
||||||
setSourcesSanitized(this.player_, this.src).one('loadeddata', function() {
|
setSourcesSanitized(this.player_, this.src).one('loadeddata', function() {
|
||||||
this.player_.currentTime(currentTime);
|
this.player_.currentTime(currentTime);
|
||||||
if(!isPaused){ this.player_.play(); }
|
if(!isPaused){
|
||||||
|
// Start playing and hide loadingSpinner (flash issue ?)
|
||||||
|
this.player_.play().handleTechSeeked_();
|
||||||
|
}
|
||||||
this.player_.trigger('resolutionchange');
|
this.player_.trigger('resolutionchange');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue