Skip to content

Instantly share code, notes, and snippets.

@mraiguo
Last active September 29, 2018 09:34
Show Gist options
  • Save mraiguo/6786502ece497f17a1874887a89d900e to your computer and use it in GitHub Desktop.
Save mraiguo/6786502ece497f17a1874887a89d900e to your computer and use it in GitHub Desktop.
videojs switch
<!DOCTYPE html>
<html>
<head>
<title>Video.js | HTML5 Video Player</title>
<!-- Change URLs to wherever Video.js files will be hosted -->
<link href="//vjs.zencdn.net/6.2.5/video-js.css" rel="stylesheet" type="text/css">
<!-- video.js must be in the <head> for older IEs to work. -->
<script src="//vjs.zencdn.net/6.2.5/video.js"></script>
</head>
<body>
<video id="my-player" class="video-js vjs-default-skin"></video>
</body>
<script type="text/javascript">
var options = {
autoplay: false,
controls: true,
width: 300,
height: 200,
autoplay: true,
sources: [
{
src: 'http://os71std62.bkt.clouddn.com/kitteh.mp4',
type: 'video/mp4'
}
]
};
var player = videojs('my-player', options, function onPlayerReady() {
videojs.log('Your player is ready!');
});
setTimeout(function() {
player.src('http://os71std62.bkt.clouddn.com/ocean.mp4')
}, 3000)
</script>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment