The Play pause button works for HTML5 video and this Video.JS. I am not sure why the other functions don't work for video.js, even though they work for HTML5 video?
What can I do to make video JS skip forward and backwards 15 seconds? Also, for some weird reason the video won't change size either.
<div id="instructions">
<video id="my_video_1" class="video-js vjs-default-skin" width="640px" height="267px"
controls preload="none" poster='http://video-js.zencoder.com/oceans-clip.jpg'
data-setup='{ "aspectRatio":"640:267", "playbackRates": [1, 1.5, 2] }'>
<source src="http://vjs.zencdn.net/v/oceans.mp4" type='video/mp4' />
<source src="http://vjs.zencdn.net/v/oceans.webm" type='video/webm' />
</video>
<button onclick="playPause()">Play/Pause</button>
<button onclick="makeBig()">Big</button>
<button onclick="makeSmall()">Small</button>
<button onclick="makeNormal()">Normal</button>
<button onclick="restart();">Restart</button>
<button onclick="skip(-10)">Rewind</button>
<button onclick="skip(10)">Fastforward</button>
</div>
<script>
//controls for video.js HTML5 video player
var myVideo = document.getElementById("my_video_1");
function playPause() {
if (myVideo.paused)
myVideo.play();
else
myVideo.pause();
}
function makeBig() {
myVideo.width = 560;
}
function makeSmall() {
myVideo.width = 320;
}
function makeNormal() {
myVideo.width = 420;
}
function skip(value) {
var video = document.getElementById("my_video_1");
video.currentTime += value;
}
function restart() {
var video = document.getElementById("my_video_1");
video.currentTime = 0;
}
</script>