A simple HTML5/JS video player. Crated just to check out the HTML5 <video>
JavaScript API.
To be able to run smoothly, the player requires some basic configuration.
- playerPoster - poster file location (image that's displayed when player is stopped)
- playerContainer -
id
of the DOM Element that the player should be injected into - playlistContainer -
id
of the DOM Element that the playlist component should be injected into - playlistData - playlist configuration object that includes two fields:
- type - type of configuration provided
obj
for object,url
for JSON file to load via XHR - data - either an object with all the data as specified below or an
url
to JSON file
- type - type of configuration provided
let vplayer = new VideoPlayer({
playerPoster: "img/poster.jpg",
playerContainer: "vplayer",
playlistContainer: "playlist",
playlistData: {
type: _list_type_,
data: _playlist_data_source
}
});
Player includes basic support for playlist, which should be an array of objects in format mentioned below.
- title - title of the movie clip
- url - movie file location (currently remote resources are not supported)
- duration - movie clip duration
- type - file format:
video/mp4
,video/webm
,video/ogg
A sample playlist element:
{
title: "Sample video title",
url: "/vids/sample_video.mp4",
duration: "0:05",
type: "video/mp4"
}
To run it locally:
- Clone the repository
- run
npm install
oryarn install
to install all the packages - Use
gulp
to build the project. - Open browser and load up
http://localhost:9001
For now the build process assumes that video files are located inside /vids/
folder in the root.