I am using Video.js to display some short videos. My first page that used Video.js looked like the following:
<video id='my-video' class='video-js' controls preload='auto' width='800' height='600' poster='MY_VIDEO_POSTER.jpg' data-setup='{}'>
<source src='example.mp4' type="video/mp4">
</video>
When playing this video, using the code above, I see a pause/play button (it toggles between pause and play), a mute sound button, and a progress bar whenever I move the mouse over the player window.
I began learning how to do this in Javascript because I wanted to be able to pass a function the name of a video and have it play that video when clicking the button. The altered HTML is below:
<button type="button" onclick="playit('example.mp4')">Press Me</button>
<video id='my-video' class='video-js' width='800' height='600' poster='MY_VIDEO_POSTER.jpg'>
</video>
The Javascript I am using to play the video is below:
var playit = function(vName) {
var options = {
sources: [{
src: vName,
type: "video/mp4"
}],
preload: "auto",
controls: true,
autoplay: true
};
var play = videojs("my-video",options,function onPlayerReady() {
this.play();
});
}
The Javascript works well, but the resulting playing video only shows the progress bar! The play/pause and mute are gone.
Is there something I need to set in the options object that will make those controls appear? How do I get the pause/play and mute controls back using Javascript?
Also: it would be nice to have a real volume control and fullscreen control available. I know these exist in the View.js control, and the fullscreen control appears when using the HTML- only video, but it is unclear from the documentation how to make either of them appear when using Javascript.
Can someone tell me how to make them available as well?
I