Xenoveritas / xvwebvideo

A very simplistic method of self-hosting videos using video.js.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

xvwebvideo

This is the code behind http://video.xenoveritas.org/ - for the most part.

The play.php script embeds video information, stored as a JSON file, into a web page that can then play back a video.

Required Software

The basic code is written using PHP 5 and PHP will need to be available on your server. It probably already is.

The code itself uses video.js.

As of now, you need to compile a bunch of artifacts to build a final useful system. Compiling requires:

Once you have NodeJS installed, installing LESS CSS and marked is easy:

npm install -g lessc
npm install -g marked

To just create the minified versions of everything, just use make.

However, to create a "deploy" copy, you can use make install which will create a version of all the files with their "deployed" versions. You can set video_root to be the base URL where the video appears in the final domain, or leave it blank if everything is at the root already.

So, for example, to have everything hosted under video, use video_root=/video install.

JSON Video Description Format

The following are used to encode the video:

{
  "title":       "Video Title",
  "description": "Description of the video",
  "url":         "video file name prefix",
  "formats":     [ "mp4", "webm" ],
  "poster":      "video.jpg",
  "width":       640, "height": 480,
  "duration":    600,
  "previous":    "prev",
  "next":        "next",
  "playlist":    "/playlist/videos"
}

The individual keys are as follows:

title

The title as shown on the page.

description

A brief bit of text displayed under the video that describes the video.

url

The URL to use for the video format, without an extension. The extensions will automatically be added via the "formats" field. This URL should not end with a '.' as it will be automatically added.

formats

An array of extensions to add to the original URL, without the '.' at the start.

poster

Sets the poster image. Defaults to the URL with ".jpg" added to it, just like the various video formats are defined.

width / height

The width and height of the video file in pixels. Yes, all formats must use the same width/height: each individual format is supposed to be a reencode of the same video to provide support for multiple browsers.

duration

The length of the video in seconds. If you really want to, this can be a decimal, although that's ignored. This is purely informational. (This was required with jwplayer and is entirely ignored by video.js.)

previous

If provided, a relative URL to the previous video in the playlist.

next

If provided, a relative URL to the next video in the playlist.

playlist

NOT IMPLEMENTED YET

About

A very simplistic method of self-hosting videos using video.js.

License:Apache License 2.0


Languages

Language:JavaScript 94.3%Language:PHP 5.7%