There is a lot of documentation on HTML5 video tags, like here and here. Although the more intricate documentation which covers most of the events associated with media type is documented well on whatwg.org documentation.
You may want to open the links mentioned here in a new tab.
This post is about some of the things that we got to know while working with video.js JavaScript library. You can view the demo of what follows here. For complete source code you could look in to the source code of the demo page. Although here we would highlight some of the code.
Consider that your initial video tag state is like following.
Initialize VideoJs Player
In above snippet it is expected that example_video_1
is id reference of video
tag.
Some of the things thats not clearly evident are
Stop media(video or audio) download
Clear the source tag. AFAIK there is no event associated with audio
or video
tag which allows you to stop download
of any source associated with the tag. When pause event is fired on the element, it merely pauses the audio or video
but continues to download the associated media. To completely stop the media download, you would have to clear the src
attribute. In VideoJs you would do it like
Note that above will make your player defunct, i.e you would not be able to play the media anymore, unless you associate back any media source to it.
Change Video Poster for already initialized Video.
In videojs changing poster can be done with something like below.
Use same video element to play different Videos like Playlist.
Assuming that your playlist JSON is something like
We would want to iterate over the list and associate relevant events to be able to play right media file and set relevant video poster.
On change source event