mirror of
https://github.com/videojs/video.js.git
synced 2025-02-02 11:34:50 +02:00
Update grunt build script.
This commit is contained in:
parent
e7c146bc1f
commit
0f0fccc312
176
Gruntfile.js
176
Gruntfile.js
@ -3,52 +3,37 @@ module.exports = function(grunt) {
|
||||
// Project configuration.
|
||||
grunt.initConfig({
|
||||
pkg: grunt.file.readJSON('package.json'),
|
||||
concat: {
|
||||
dist: {
|
||||
src: [
|
||||
'src/js/goog.base.js',
|
||||
'src/js/core.js',
|
||||
'src/js/lib.js',
|
||||
'src/js/events.js',
|
||||
'src/js/component.js',
|
||||
'src/js/player.js',
|
||||
'src/js/media.js',
|
||||
'src/js/media.html5.js',
|
||||
'src/js/media.flash.js',
|
||||
'src/js/controls.js',
|
||||
'src/js/tracks.js',
|
||||
'src/js/setup.js',
|
||||
'src/js/json.js',
|
||||
'src/js/exports.js'
|
||||
],
|
||||
dest: 'dist/video.js'
|
||||
},
|
||||
test: {
|
||||
src: [
|
||||
'test/unit/phantom-logging.js',
|
||||
'test/unit/component.js',
|
||||
'test/unit/core.js',
|
||||
'test/unit/events.js',
|
||||
'test/unit/lib.js',
|
||||
'test/unit/media.html5.js',
|
||||
'test/unit/player.js',
|
||||
'test/unit/setup.js',
|
||||
],
|
||||
dest: 'test/unit.js'
|
||||
}
|
||||
build: {
|
||||
dist:{}
|
||||
},
|
||||
// Current forEach issue: https://github.com/gruntjs/grunt/issues/610
|
||||
// npm install https://github.com/gruntjs/grunt-contrib-jshint/archive/7fd70e86c5a8d489095fa81589d95dccb8eb3a46.tar.gz
|
||||
jshint: {
|
||||
dist: {
|
||||
src: ["dist/video.js"],
|
||||
src: {
|
||||
src: ["src/js/*.js"],
|
||||
options: {
|
||||
jshintrc: ".jshintrc"
|
||||
}
|
||||
}
|
||||
},
|
||||
compile: {
|
||||
dist:{
|
||||
sourcelist: 'dist/sourcelist.txt',
|
||||
externs: ['src/js/media.flash.externs.js'],
|
||||
dest: 'dist/video.js'
|
||||
},
|
||||
test: {
|
||||
sourcelist: 'dist/sourcelist.txt',
|
||||
src: ['test/unit/*.js'],
|
||||
externs: ['src/js/media.flash.externs.js', 'test/qunit-externs.js'],
|
||||
dest: 'test/video.test.js'
|
||||
}
|
||||
},
|
||||
dist: {
|
||||
latest:{}
|
||||
},
|
||||
qunit: {
|
||||
all: ['test/unit.html']
|
||||
all: ['test/index.html'],
|
||||
},
|
||||
watch: {
|
||||
files: [ "src/**/*.js" ],
|
||||
@ -57,77 +42,80 @@ module.exports = function(grunt) {
|
||||
|
||||
});
|
||||
|
||||
// Default task.
|
||||
// grunt.registerTask('default', 'lint:beforeconcat concat lint:afterconcat');
|
||||
// // Default task(s).
|
||||
// grunt.registerTask('default', ['uglify']);
|
||||
|
||||
grunt.loadNpmTasks("grunt-contrib-concat");
|
||||
grunt.loadNpmTasks("grunt-contrib-jshint");
|
||||
grunt.loadNpmTasks("grunt-contrib-qunit");
|
||||
grunt.loadNpmTasks("grunt-contrib-watch");
|
||||
|
||||
grunt.registerTask( "dev", [ "compile" ] ); // "build:*:*", "jshint"
|
||||
// compiled += grunt.file.read( filepath );
|
||||
// Default task.
|
||||
grunt.registerTask('default', ['build', 'jshint', 'compile', 'dist']);
|
||||
// Development watch task
|
||||
grunt.registerTask('dev', ['build', 'jshint']);
|
||||
|
||||
var exec = require('child_process').exec,
|
||||
fs = require('fs'),
|
||||
grunt.registerTask('test', ['build', 'jshint', 'qunit']);
|
||||
|
||||
var fs = require('fs'),
|
||||
gzip = require('zlib').gzip;
|
||||
|
||||
grunt.registerMultiTask('build', 'Building Source', function(){
|
||||
grunt.log.writeln(this.target)
|
||||
if (this.target === 'latest') {
|
||||
var files = this.data.files;
|
||||
var dist = '';
|
||||
|
||||
// for (prop in this.file) {
|
||||
// grunt.log.writeln(prop + ":" + this.file[prop])
|
||||
// }
|
||||
|
||||
files.forEach(function(file){
|
||||
dist += grunt.file.read('src/js/' + file)
|
||||
});
|
||||
|
||||
grunt.file.write('dist/video.js', dist);
|
||||
} else if (this.target === 'test') {
|
||||
grunt.task.run('build:latest');
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
grunt.registerTask('compile', 'Minify JS files using Closure Compiler.', function() {
|
||||
var calcdeps = require('calcdeps').calcdeps;
|
||||
// caclcdeps is async
|
||||
var done = this.async();
|
||||
|
||||
var command = 'java -jar build/compiler/compiler.jar';
|
||||
command += ' --compilation_level ADVANCED_OPTIMIZATIONS';
|
||||
// In current version of calcdeps, not supplying certain
|
||||
// options that should have defaults causes errors
|
||||
// so we have all options listed here with their defaults.
|
||||
calcdeps({
|
||||
input: ['src/js/exports.js'],
|
||||
path:['src/js/'],
|
||||
dep:[],
|
||||
exclude:[],
|
||||
output_mode:'list',
|
||||
}, function(err,results){
|
||||
if (err) {
|
||||
grunt.warn({ message: err })
|
||||
grunt.log.writeln(err);
|
||||
done(false);
|
||||
}
|
||||
|
||||
var files = [
|
||||
'goog.base.js',
|
||||
'core.js',
|
||||
'lib.js',
|
||||
'events.js',
|
||||
'component.js',
|
||||
'player.js',
|
||||
'media.js',
|
||||
'media.html5.js',
|
||||
'media.flash.js',
|
||||
'controls.js',
|
||||
'tracks.js',
|
||||
'setup.js',
|
||||
'json.js',
|
||||
'exports.js'
|
||||
];
|
||||
if (results) {
|
||||
grunt.file.write('dist/sourcelist.txt', results.join(','));
|
||||
grunt.file.write('dist/sourcelist.js', 'var sourcelist = ["' + results.join('","') + '"]');
|
||||
}
|
||||
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
grunt.registerMultiTask('compile', 'Minify JS files using Closure Compiler.', function() {
|
||||
var done = this.async();
|
||||
var exec = require('child_process').exec;
|
||||
|
||||
var externs = this.file.externs || [];
|
||||
var dest = this.file.dest;
|
||||
var files = [];
|
||||
if (this.data.sourcelist) {
|
||||
files = files.concat(grunt.file.read(this.data.sourcelist).split(','))
|
||||
}
|
||||
if (this.file.src) {
|
||||
files = files.concat(this.file.src);
|
||||
}
|
||||
|
||||
var command = 'java -jar build/compiler/compiler.jar'
|
||||
+ ' --compilation_level ADVANCED_OPTIMIZATIONS'
|
||||
// + ' --formatting=pretty_print'
|
||||
+ ' --js_output_file=' + dest
|
||||
+ ' --create_source_map ' + dest + '.map --source_map_format=V3'
|
||||
+ ' --output_wrapper "(function() {%output%})();//@ sourceMappingURL=video.js.map"';
|
||||
|
||||
files.forEach(function(file){
|
||||
command += ' --js=src/js/'+file;
|
||||
command += ' --js='+file;
|
||||
});
|
||||
|
||||
command += ' --externs src/js/media.flash.externs.js';
|
||||
// command += ' --formatting=pretty_print';
|
||||
command += ' --js_output_file=test/video.compiled.js';
|
||||
command += ' --create_source_map test/video.compiled.js.map --source_map_format=V3';
|
||||
// command += ' --externs test/qunit-externs.js';
|
||||
command += ' --output_wrapper "(function() {%output%})();//@ sourceMappingURL=video.compiled.js.map"';
|
||||
externs.forEach(function(extern){
|
||||
command += ' --externs='+extern;
|
||||
});
|
||||
|
||||
// grunt.log.writeln(command)
|
||||
|
||||
exec(command, { maxBuffer: 500*1024 }, function(err, stdout, stderr){
|
||||
|
||||
@ -140,9 +128,11 @@ module.exports = function(grunt) {
|
||||
grunt.log.writeln(stdout);
|
||||
}
|
||||
|
||||
grunt.log.writeln("done!")
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
grunt.registerMultiTask('dist', 'Creating distribution', function(){
|
||||
|
||||
});
|
||||
};
|
||||
|
10
Makefile
10
Makefile
@ -1,10 +0,0 @@
|
||||
# Using makefile temporarily to run tests on Travis CI
|
||||
|
||||
test:
|
||||
jshint src/*.js --config .jshintrc
|
||||
node test/server.js &
|
||||
phantomjs test/phantom.js "http://localhost:3000/test/unit.html"
|
||||
kill -9 `cat test/pid.txt`
|
||||
rm test/pid.txt
|
||||
|
||||
.PHONY: test
|
@ -1,20 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Video.js | HTML5 Video Player | YouTube Demo</title>
|
||||
|
||||
<!-- Change URLs to wherever Video.js files will be hosted -->
|
||||
<link href="video-js.css" rel="stylesheet" type="text/css">
|
||||
<!-- video.js must be in the <head> for older IEs to work. -->
|
||||
<script src="video.js"></script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<video id="example_video_1" class="video-js vjs-default-skin" controls preload="none" width="640" height="360"
|
||||
data-setup='{"techOrder":["youtube","html5"],"ytcontrols":false}'>
|
||||
<source src="http://www.youtube.com/watch?v=qWjzVHG9T1I" type='video/youtube' />
|
||||
</video>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -11,7 +11,7 @@
|
||||
"homepage": "http://videojs.com",
|
||||
"author": "Steve Heffernan",
|
||||
"scripts": {
|
||||
"test": "grunt qunit"
|
||||
"test": "grunt test"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@ -20,14 +20,14 @@
|
||||
"devDependencies": {
|
||||
"grunt-cli": "~0.1.0",
|
||||
"grunt": "0.4.0rc4",
|
||||
"grunt-contrib-jshint": "~0.1.0",
|
||||
"grunt-contrib-jshint": "https://github.com/gruntjs/grunt-contrib-jshint/archive/7fd70e86c5a8d489095fa81589d95dccb8eb3a46.tar.gz",
|
||||
"grunt-contrib-nodeunit": "~0.1.0",
|
||||
"jshint": "0.6.1",
|
||||
"connect": "2.1.3",
|
||||
"grunt-contrib-uglify": "~0.1.0",
|
||||
"grunt-closure-compiler": "0.0.13",
|
||||
"grunt-contrib-watch": "~0.1.4",
|
||||
"grunt-contrib-concat": "~0.1.1",
|
||||
"grunt-contrib-qunit": "~0.1.0"
|
||||
"grunt-contrib-qunit": "~0.1.0",
|
||||
"calcdeps": "~0.1.7"
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,11 @@
|
||||
*
|
||||
*/
|
||||
|
||||
goog.provide('vjs.Component');
|
||||
|
||||
goog.require('vjs.events');
|
||||
goog.require('vjs.dom');
|
||||
|
||||
/**
|
||||
* Base UI Component class
|
||||
* @param {Object} player Main Player
|
||||
|
6
src/js/controls.js
vendored
6
src/js/controls.js
vendored
@ -2,6 +2,12 @@
|
||||
* @fileoverview Controls classes for Video.js buttons, sliders, etc.
|
||||
*/
|
||||
|
||||
goog.provide('vjs.Control');
|
||||
goog.provide('vjs.Menu');
|
||||
goog.provide('vjs.MenuItem');
|
||||
|
||||
goog.require('vjs.Player');
|
||||
|
||||
/**
|
||||
* Base class for all control elements
|
||||
* @param {vjs.Player|Object} player
|
||||
|
@ -1,7 +1,10 @@
|
||||
/**
|
||||
* @fileoverview Main function src. First file after goog.base.
|
||||
* @fileoverview Main function src.
|
||||
*/
|
||||
|
||||
goog.provide('vjs');
|
||||
goog.provide('videojs');
|
||||
|
||||
// HTML5 Shiv. Must be in <head> to support older browsers.
|
||||
document.createElement('video');document.createElement('audio');
|
||||
|
||||
|
@ -1,8 +1,13 @@
|
||||
// Event System (John Resig - Secrets of a JS Ninja http://jsninja.com/)
|
||||
// (Original book version wasn't completely usable, so fixed some things and made Closure Compiler compatible)
|
||||
//
|
||||
// This should work very similarly to jQuery's events, however it's based off the book version which isn't as
|
||||
// robust as jquery's, so there's probably some differences.
|
||||
/**
|
||||
* @fileoverview Event System (John Resig - Secrets of a JS Ninja http://jsninja.com/)
|
||||
* (Original book version wasn't completely usable, so fixed some things and made Closure Compiler compatible)
|
||||
* This should work very similarly to jQuery's events, however it's based off the book version which isn't as
|
||||
* robust as jquery's, so there's probably some differences.
|
||||
*/
|
||||
|
||||
goog.provide('vjs.events');
|
||||
|
||||
goog.require('vjs');
|
||||
|
||||
/**
|
||||
* Add an event listener to element
|
||||
|
@ -5,6 +5,15 @@
|
||||
* be renamed by closure compiler.
|
||||
*/
|
||||
|
||||
goog.require('vjs');
|
||||
goog.require('vjs.Component');
|
||||
goog.require('vjs.Player');
|
||||
goog.require('vjs.Control');
|
||||
goog.require('vjs.Html5');
|
||||
goog.require('vjs.Flash');
|
||||
goog.require('vjs.TextTrack');
|
||||
goog.require('vjs.autoSetup');
|
||||
|
||||
/**
|
||||
* vjs (internal only) = videojs = _V_ (external only)
|
||||
*
|
||||
@ -118,3 +127,5 @@ goog.exportProperty(vjs.TextTrack.prototype, 'label', vjs.TextTrack.prototype.la
|
||||
goog.exportSymbol('videojs.CaptionsTrack', vjs.CaptionsTrack);
|
||||
goog.exportSymbol('videojs.SubtitlesTrack', vjs.SubtitlesTrack);
|
||||
goog.exportSymbol('videojs.ChaptersTrack', vjs.ChaptersTrack);
|
||||
|
||||
goog.exportSymbol('videojs.autoSetup', vjs.autoSetup);
|
||||
|
@ -1,3 +1,5 @@
|
||||
goog.provide('vjs.JSON');
|
||||
|
||||
/**
|
||||
* Javascript JSON implementation
|
||||
* (Parse Method Only)
|
||||
|
@ -1,3 +1,7 @@
|
||||
goog.provide('vjs.dom');
|
||||
|
||||
goog.require('vjs');
|
||||
|
||||
/**
|
||||
* Creates an element and applies properties.
|
||||
* @param {String=} tagName Name of tag to be created.
|
||||
@ -202,7 +206,7 @@ vjs.removeClass = function(element, classToRemove){
|
||||
* @type {Element}
|
||||
* @constant
|
||||
*/
|
||||
vjs.TEST_VID = document.createElement('video');
|
||||
vjs.TEST_VID = vjs.createEl('video');
|
||||
|
||||
/**
|
||||
* Useragent for browser testing.
|
||||
@ -216,19 +220,19 @@ vjs.USER_AGENT = navigator.userAgent;
|
||||
* @type {Boolean}
|
||||
* @constant
|
||||
*/
|
||||
vjs.IS_IPHONE = !!navigator.userAgent.match(/iPad/i);
|
||||
vjs.IS_IPAD = !!navigator.userAgent.match(/iPhone/i);
|
||||
vjs.IS_IPOD = !!navigator.userAgent.match(/iPod/i);
|
||||
vjs.IS_IPHONE = !!vjs.USER_AGENT.match(/iPad/i);
|
||||
vjs.IS_IPAD = !!vjs.USER_AGENT.match(/iPhone/i);
|
||||
vjs.IS_IPOD = !!vjs.USER_AGENT.match(/iPod/i);
|
||||
vjs.IS_IOS = vjs.IS_IPHONE || vjs.IS_IPAD || vjs.IS_IPOD;
|
||||
|
||||
vjs.IOS_VERSION = (function(){
|
||||
var match = navigator.userAgent.match(/OS (\d+)_/i);
|
||||
var match = vjs.USER_AGENT.match(/OS (\d+)_/i);
|
||||
if (match && match[1]) { return match[1]; }
|
||||
})();
|
||||
|
||||
vjs.IS_ANDROID = !!navigator.userAgent.match(/Android.*AppleWebKit/i);
|
||||
vjs.IS_ANDROID = !!vjs.USER_AGENT.match(/Android.*AppleWebKit/i);
|
||||
vjs.ANDROID_VERSION = (function() {
|
||||
var match = navigator.userAgent.match(/Android (\d+)\./i);
|
||||
var match = vjs.USER_AGENT.match(/Android (\d+)\./i);
|
||||
if (match && match[1]) {
|
||||
return match[1];
|
||||
}
|
||||
|
@ -4,6 +4,10 @@
|
||||
* Not using setupTriggers. Using global onEvent func to distribute events
|
||||
*/
|
||||
|
||||
goog.provide('vjs.Flash');
|
||||
|
||||
goog.require('vjs.MediaTechController');
|
||||
|
||||
/**
|
||||
* HTML5 Media Controller - Wrapper for HTML5 Media API
|
||||
* @param {vjs.Player|Object} player
|
||||
|
@ -2,6 +2,10 @@
|
||||
* @fileoverview HTML5 Media Controller - Wrapper for HTML5 Media API
|
||||
*/
|
||||
|
||||
goog.provide('vjs.Html5');
|
||||
|
||||
goog.require('vjs.MediaTechController');
|
||||
|
||||
/**
|
||||
* HTML5 Media Controller - Wrapper for HTML5 Media API
|
||||
* @param {vjs.Player|Object} player
|
||||
|
@ -2,6 +2,10 @@
|
||||
* @fileoverview Media Technology Controller - Base class for media playback technologies
|
||||
*/
|
||||
|
||||
goog.provide('vjs.MediaTechController');
|
||||
|
||||
goog.require('vjs.Component');
|
||||
|
||||
/**
|
||||
* Base class for media (HTML5 Video, Flash) controllers
|
||||
* @param {vjs.Player|Object} player Central player instance
|
||||
|
@ -1,3 +1,7 @@
|
||||
goog.provide('vjs.Player');
|
||||
|
||||
goog.require('vjs.Component');
|
||||
|
||||
/**
|
||||
* Main player class. A player instance is returned by _V_(id);
|
||||
* @param {Element} tag The original video tag used for configuring options
|
||||
|
@ -3,6 +3,11 @@
|
||||
* based on the data-setup attribute of the video tag
|
||||
*/
|
||||
|
||||
goog.provide('vjs.autoSetup');
|
||||
|
||||
goog.require('vjs.JSON');
|
||||
goog.require('vjs.events');
|
||||
|
||||
// Automatically set up any tags that have a data-setup attribute
|
||||
vjs.autoSetup = function(){
|
||||
var options, vid, player,
|
||||
|
@ -7,6 +7,12 @@
|
||||
* Descriptions (not supported yet) - audio descriptions that are read back to the user by a screen reading device
|
||||
*/
|
||||
|
||||
goog.provide('vjs.TextTrack');
|
||||
|
||||
goog.require('vjs.Menu');
|
||||
goog.require('vjs.MenuItem');
|
||||
goog.require('vjs.Component');
|
||||
|
||||
|
||||
// Player Additions - Functions add to the player object for easier access to tracks
|
||||
|
||||
|
@ -1,90 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>HTML5 Video Player</title>
|
||||
|
||||
<link rel="stylesheet" href="../design/video-js.css" type="text/css">
|
||||
|
||||
<link rel="stylesheet" href="../test/vendor/qunit/qunit/qunit.css" />
|
||||
<script src="../test/vendor/qunit/qunit/qunit.js"></script>
|
||||
|
||||
|
||||
<!--[if IE]>
|
||||
<script src="https://getfirebug.com/releases/lite/1.3/firebug-lite.js"></script>
|
||||
<!--<![endif]-->
|
||||
|
||||
<script src='video.compiled.js'></script>
|
||||
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
// Easy access to test Flash over HTML5. Add ?flash to URL
|
||||
if (window.location.href.indexOf("?flash") !== -1) {
|
||||
videojs.options.techOrder = ["Flash"];
|
||||
videojs.options.flash.swf = "../tech/flash/video-js.swf";
|
||||
}
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<video id="vid1" class="video-js vjs-default-skin" controls preload="none" width="640" height="264"
|
||||
poster="http://video-js.zencoder.com/oceans-clip.png"
|
||||
data-setup='{}'>
|
||||
<source src="http://video-js.zencoder.com/oceans-clip.mp4" type='video/mp4'>
|
||||
<source src="http://video-js.zencoder.com/oceans-clip.webm" type='video/webm'>
|
||||
<source src="http://video-js.zencoder.com/oceans-clip.ogv" type='video/ogg'>
|
||||
<track kind=captions src="http://videojs.com/video-js/captions.vtt" srclang="en" label="English" />
|
||||
<p>Video Playback Not Supported</p>
|
||||
</video>
|
||||
|
||||
<script>
|
||||
vid = document.getElementById("vid1");
|
||||
var player = videojs('vid1');
|
||||
|
||||
function roughSizeOfObject( object ) {
|
||||
|
||||
var objectList = [];
|
||||
|
||||
var recurse = function( value )
|
||||
{
|
||||
var bytes = 0;
|
||||
|
||||
if ( typeof value === 'boolean' ) {
|
||||
bytes = 4;
|
||||
}
|
||||
else if ( typeof value === 'string' ) {
|
||||
bytes = value.length * 2;
|
||||
}
|
||||
else if ( typeof value === 'number' ) {
|
||||
bytes = 8;
|
||||
}
|
||||
else if
|
||||
(
|
||||
typeof value === 'object'
|
||||
&& objectList.indexOf( value ) === -1
|
||||
)
|
||||
{
|
||||
objectList[ objectList.length ] = value;
|
||||
|
||||
for( i in value ) {
|
||||
bytes+= 8; // an assumed existence overhead
|
||||
bytes+= recurse( value[i] )
|
||||
}
|
||||
}
|
||||
|
||||
return bytes;
|
||||
}
|
||||
|
||||
return recurse( object );
|
||||
}
|
||||
|
||||
function cacheSize(){
|
||||
for (i in videojs.cache[6].handlers) {
|
||||
console.log(i, roughSizeOfObject(videojs.cache[6].handlers[i]))
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
59
test/index.html
Normal file
59
test/index.html
Normal file
@ -0,0 +1,59 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Video.js Test Suite</title>
|
||||
|
||||
<!-- QUnit -->
|
||||
<link rel="stylesheet" href="../test/qunit/qunit/qunit.css" />
|
||||
<script src="../test/qunit/qunit/qunit.js"></script>
|
||||
|
||||
<!-- Video.js CSS -->
|
||||
<link rel="stylesheet" href="../src/css/video-js.css" type="text/css">
|
||||
|
||||
<!-- GENERATED LIST OF SOURCE FILES -->
|
||||
<script src="../dist/sourcelist.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
(function(){
|
||||
var root = '../';
|
||||
// ADD NEW TEST FILES HERE
|
||||
var tests = [
|
||||
'test/unit/lib.js',
|
||||
'test/unit/events.js',
|
||||
'test/unit/component.js',
|
||||
'test/unit/player.js',
|
||||
'test/unit/core.js',
|
||||
'test/unit/media.html5.js'
|
||||
];
|
||||
var compiledTests = "test/video.test.js";
|
||||
var scripts = [];
|
||||
|
||||
// Choose either the raw source and tests
|
||||
// Or the compiled source + tests.
|
||||
// Use ?comiled to use the compiled tests
|
||||
if (QUnit.urlParams.min || QUnit.urlParams.compiled) {
|
||||
scripts.push(compiledTests);
|
||||
} else {
|
||||
// sourcelist is loaded by sourcelist.js
|
||||
// which is built by `grunt build` or `grunt watch`
|
||||
scripts = scripts.concat(sourcelist,tests);
|
||||
}
|
||||
|
||||
for (var i = 0; i < scripts.length; i++) {
|
||||
document.write( "<script src='" + root + scripts[i] + "'><\/script>" );
|
||||
}
|
||||
|
||||
})()
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div>
|
||||
<h1 id="qunit-header">Video.js Test Suite</h1>
|
||||
<h2 id="qunit-banner"></h2>
|
||||
<h2 id="qunit-userAgent"></h2>
|
||||
<ol id="qunit-tests"></ol>
|
||||
<div id="qunit-fixture"></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -1,42 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Video.js Test Suite</title>
|
||||
|
||||
<!-- QUnit -->
|
||||
<link rel="stylesheet" href="vendor/qunit/qunit/qunit.css" />
|
||||
<script src="vendor/qunit/qunit/qunit.js"></script>
|
||||
|
||||
<!-- Video.js CSS -->
|
||||
<link rel="stylesheet" href="../design/video-js.css" type="text/css">
|
||||
|
||||
<!-- Video.js JavaScript -->
|
||||
<script src='../src/core.js'></script>
|
||||
<script src='../src/lib.js'></script>
|
||||
<script src='../src/component.js'></script>
|
||||
<script src='../src/controls.js'></script>
|
||||
<script src='../src/events.js'></script>
|
||||
<script src='../src/json.js'></script>
|
||||
<script src='../src/player.js'></script>
|
||||
<script src='../src/tech.js'></script>
|
||||
<script src='../src/tracks.js'></script>
|
||||
|
||||
<script src='../tech/html5/html5.js'></script>
|
||||
<script src='../tech/flash/flash.js'></script>
|
||||
|
||||
<script src='../src/setup.js'></script>
|
||||
|
||||
<!-- Integration Tests -->
|
||||
<script src="integration/test.js"></script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div>
|
||||
<h1 id="qunit-header">Bootstrap Plugin Test Suite</h1>
|
||||
<h2 id="qunit-banner"></h2>
|
||||
<h2 id="qunit-userAgent"></h2>
|
||||
<ol id="qunit-tests"></ol>
|
||||
<div id="qunit-fixture"></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -1,304 +0,0 @@
|
||||
|
||||
// Potential Future automation
|
||||
// https://github.com/mcrmfc/qunit_sauce_runner
|
||||
// http://saucelabs.com/blog/index.php/2011/06/javascript-unit-testing-with-jellyfish-and-ondemand/
|
||||
// https://github.com/admc/jellyfish/blob/master/test/fun/jfqunit.js
|
||||
|
||||
function createVideoTag(id){
|
||||
var tagCode, tag, attrs;
|
||||
|
||||
tagCode = '<video id="vid1" controls class="video-js vjs-default-skin" preload="none" width="640" height="264" data-setup=\'{}\' poster="http://video-js.zencoder.com/oceans-clip.png">';
|
||||
tagCode+= '<source src="http://video-js.zencoder.com/oceans-clip.mp4" type="video/mp4">';
|
||||
tagCode+= '<source src="http://video-js.zencoder.com/oceans-clip.webm" type="video/webm">';
|
||||
tagCode+= '<source src="http://video-js.zencoder.com/oceans-clip.ogv" type="video/ogg; codecs=\'theora, vorbis\'">';
|
||||
tagCode+= '</video>';
|
||||
|
||||
tag = document.createElement("video");
|
||||
|
||||
tag.id = "vid1";
|
||||
tag.controls = true;
|
||||
tag.className = "video-js vjs-default-skin";
|
||||
tag.preload = "auto";
|
||||
tag.width = "640";
|
||||
tag.height = "264";
|
||||
tag.poster = "http://video-js.zencoder.com/oceans-clip.png";
|
||||
|
||||
source1 = document.createElement("source");
|
||||
source1.src = "http://video-js.zencoder.com/oceans-clip.mp4";
|
||||
source1.type = "video/mp4";
|
||||
tag.appendChild(source1);
|
||||
|
||||
source2 = document.createElement("source");
|
||||
source2.src = "http://video-js.zencoder.com/oceans-clip.webm";
|
||||
source2.type = "video/webm";
|
||||
tag.appendChild(source2);
|
||||
|
||||
source3 = document.createElement("source");
|
||||
source3.src = "http://video-js.zencoder.com/oceans-clip.ogv";
|
||||
source3.type = "video/ogg";
|
||||
tag.appendChild(source3);
|
||||
|
||||
return tag;
|
||||
}
|
||||
|
||||
function playerSetup(){
|
||||
|
||||
_V_.el("qunit-fixture").appendChild(createVideoTag())
|
||||
|
||||
var vid = document.getElementById("vid1");
|
||||
this.player = _V_(vid);
|
||||
|
||||
stop();
|
||||
|
||||
this.player.ready(_V_.proxy(this, function(){
|
||||
start();
|
||||
}));
|
||||
}
|
||||
|
||||
function playerTeardown(){
|
||||
stop();
|
||||
_V_("vid1").destroy();
|
||||
// document.body.removeChild(document.getElementById("vid1"));
|
||||
delete this.player;
|
||||
setTimeout(function(){
|
||||
start();
|
||||
}, 500);
|
||||
}
|
||||
|
||||
module("Video.js setup", {
|
||||
setup: playerSetup,
|
||||
teardown: playerTeardown
|
||||
});
|
||||
|
||||
test("Player Set Up", function() {
|
||||
ok(this.player);
|
||||
});
|
||||
|
||||
/* Methods
|
||||
================================================================================ */
|
||||
module("API Methods", {
|
||||
setup: playerSetup,
|
||||
teardown: playerTeardown
|
||||
});
|
||||
|
||||
function failOnEnded() {
|
||||
this.player.one("ended", _V_.proxy(this, function(){
|
||||
start();
|
||||
}));
|
||||
}
|
||||
|
||||
// Play Method
|
||||
test("Play", 1, function() {
|
||||
stop();
|
||||
|
||||
this.player.one("playing", _V_.proxy(this, function(){
|
||||
ok(true);
|
||||
start();
|
||||
}));
|
||||
|
||||
this.player.play();
|
||||
|
||||
failOnEnded.call(this);
|
||||
});
|
||||
|
||||
// Pause Method
|
||||
test("Pause", 1, function() {
|
||||
stop();
|
||||
|
||||
// Flash doesn't currently like calling pause immediately after 'playing'.
|
||||
this.player.one("timeupdate", _V_.proxy(this, function(){
|
||||
|
||||
this.player.pause();
|
||||
|
||||
}));
|
||||
|
||||
this.player.addEvent("pause", _V_.proxy(this, function(){
|
||||
ok(true);
|
||||
start();
|
||||
}));
|
||||
|
||||
this.player.play();
|
||||
});
|
||||
|
||||
// Paused Method
|
||||
test("Paused", 2, function() {
|
||||
stop();
|
||||
|
||||
this.player.one("timeupdate", _V_.proxy(this, function(){
|
||||
equal(this.player.paused(), false);
|
||||
this.player.pause();
|
||||
}));
|
||||
|
||||
this.player.addEvent("pause", _V_.proxy(this, function(){
|
||||
equal(this.player.paused(), true);
|
||||
start();
|
||||
}));
|
||||
|
||||
this.player.play();
|
||||
});
|
||||
|
||||
// test("currentTime()", 1, function() {
|
||||
// stop();
|
||||
|
||||
// // Try for 3 time updates, sometimes it updates at 0 seconds.
|
||||
// // var tries = 0;
|
||||
|
||||
// // Can't rely on just time update because it's faked for Flash.
|
||||
// this.player.one("loadeddata", _V_.proxy(this, function(){
|
||||
|
||||
// this.player.addEvent("timeupdate", _V_.proxy(this, function(){
|
||||
|
||||
// if (this.player.currentTime() > 0) {
|
||||
// ok(true, "Time is greater than 0.");
|
||||
// start();
|
||||
// } else {
|
||||
// // tries++;
|
||||
// }
|
||||
|
||||
// // if (tries >= 3) {
|
||||
// // start();
|
||||
// // }
|
||||
// }));
|
||||
|
||||
// }));
|
||||
|
||||
// this.player.play();
|
||||
// });
|
||||
|
||||
|
||||
// test("currentTime(seconds)", 2, function() {
|
||||
// stop();
|
||||
|
||||
// // var afterPlayback = _V_.proxy(this, function(){
|
||||
// // this.player.currentTime(this.player.duration() / 2);
|
||||
// //
|
||||
// // this.player.addEvent("timeupdate", _V_.proxy(this, function(){
|
||||
// // ok(this.player.currentTime() > 0, "Time is greater than 0.");
|
||||
// //
|
||||
// // this.player.pause();
|
||||
// //
|
||||
// // this.player.addEvent("timeupdate", _V_.proxy(this, function(){
|
||||
// // ok(this.player.currentTime() == 0, "Time is 0.");
|
||||
// // start();
|
||||
// // }));
|
||||
// //
|
||||
// // this.player.currentTime(0);
|
||||
// // }));
|
||||
// // });
|
||||
|
||||
// // Wait for Source to be ready.
|
||||
// this.player.one("loadeddata", _V_.proxy(this, function(){
|
||||
|
||||
// _V_.log("loadeddata", this.player);
|
||||
// this.player.currentTime(this.player.duration() - 1);
|
||||
|
||||
// }));
|
||||
|
||||
// this.player.one("seeked", _V_.proxy(this, function(){
|
||||
|
||||
// _V_.log("seeked", this.player.currentTime())
|
||||
// ok(this.player.currentTime() > 1, "Time is greater than 1.");
|
||||
|
||||
// this.player.one("seeked", _V_.proxy(this, function(){
|
||||
|
||||
// _V_.log("seeked2", this.player.currentTime())
|
||||
|
||||
// ok(this.player.currentTime() <= 1, "Time is less than 1.");
|
||||
// start();
|
||||
|
||||
// }));
|
||||
|
||||
// this.player.currentTime(0);
|
||||
|
||||
// }));
|
||||
|
||||
|
||||
// this.player.play();
|
||||
|
||||
// // this.player.one("timeupdate", _V_.proxy(this, function(){
|
||||
// //
|
||||
// // this.player.currentTime(this.player.duration() / 2);
|
||||
// //
|
||||
// // this.player.one("timeupdate", _V_.proxy(this, function(){
|
||||
// // ok(this.player.currentTime() > 0, "Time is greater than 0.");
|
||||
// //
|
||||
// // this.player.pause();
|
||||
// // this.player.currentTime(0);
|
||||
// //
|
||||
// // this.player.one("timeupdate", _V_.proxy(this, function(){
|
||||
// //
|
||||
// // ok(this.player.currentTime() == 0, "Time is 0.");
|
||||
// // start();
|
||||
// //
|
||||
// // }));
|
||||
// //
|
||||
// // }));
|
||||
// //
|
||||
// //
|
||||
// // }));
|
||||
|
||||
// });
|
||||
|
||||
/* Events
|
||||
================================================================================ */
|
||||
module("API Events", {
|
||||
setup: playerSetup,
|
||||
teardown: playerTeardown
|
||||
});
|
||||
|
||||
var playEventList = []
|
||||
|
||||
// Test all playback events
|
||||
test("Initial Events", 12, function() {
|
||||
stop(); // Give 30 seconds to run then fail.
|
||||
|
||||
var events = [
|
||||
// "loadstart" // Called during setup
|
||||
"play",
|
||||
"playing",
|
||||
|
||||
"durationchange",
|
||||
"loadedmetadata",
|
||||
"loadeddata",
|
||||
"loadedalldata",
|
||||
|
||||
"progress",
|
||||
"timeupdate",
|
||||
|
||||
"canplay",
|
||||
"canplaythrough",
|
||||
|
||||
"pause",
|
||||
"ended"
|
||||
];
|
||||
|
||||
// Add an event listener for each event type.
|
||||
for (var i=0, l=events.length; i<l; i++) {
|
||||
var evt = events[i];
|
||||
|
||||
// Bind player and event name to function so event name value doesn't get overwritten.
|
||||
this.player.one(evt, _V_.proxy({ player: this.player, evt: evt }, function(){
|
||||
ok(true, this.evt);
|
||||
|
||||
// Once we reach canplaythrough, pause the video and wait for 'paused'.
|
||||
if (this.evt == "loadedalldata") {
|
||||
this.player.pause();
|
||||
|
||||
// After we've paused, go to the end of the video and wait for 'ended'.
|
||||
} else if (this.evt == "pause") {
|
||||
this.player.currentTime(this.player.duration() - 1);
|
||||
|
||||
// Flash has an issue calling play too quickly after currentTime. Hopefully we'll fix this.
|
||||
setTimeout(this.player.proxy(function(){
|
||||
this.play();
|
||||
}), 250);
|
||||
|
||||
// When we reach ended, we're done. Continue with the test suite.
|
||||
} else if (this.evt == "ended") {
|
||||
start();
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
this.player.play();
|
||||
});
|
@ -1,22 +0,0 @@
|
||||
// Logging setup for phantom integration
|
||||
// adapted from Modernizr & Bootstrap
|
||||
|
||||
QUnit.begin = function () {
|
||||
console.log("Starting test suite")
|
||||
console.log("================================================\n")
|
||||
}
|
||||
|
||||
QUnit.moduleDone = function (opts) {
|
||||
if (opts.failed === 0) {
|
||||
console.log("\n\u2714 All tests passed in '" + opts.name + "' module")
|
||||
} else {
|
||||
console.log("\n\u2716 " + opts.failed + " tests failed in '" + opts.name + "' module")
|
||||
}
|
||||
}
|
||||
|
||||
QUnit.done(function (opts) {
|
||||
console.log("\n================================================")
|
||||
console.log("Tests completed in " + opts.runtime + " milliseconds")
|
||||
console.log(opts.passed + " tests of " + opts.total + " passed, " + opts.failed + " failed.")
|
||||
return false;
|
||||
});
|
@ -1,63 +0,0 @@
|
||||
// Simple phantom.js integration script
|
||||
// Adapted from Modernizr & Bootstrap
|
||||
|
||||
function waitFor(testFx, onReady, timeOutMillis) {
|
||||
var maxtimeOutMillis = timeOutMillis ? timeOutMillis : 5001 //< Default Max Timout is 5s
|
||||
, start = new Date().getTime()
|
||||
, condition = false
|
||||
, interval = setInterval(function () {
|
||||
if ((new Date().getTime() - start < maxtimeOutMillis) && !condition) {
|
||||
// If not time-out yet and condition not yet fulfilled
|
||||
condition = (typeof(testFx) === "string" ? eval(testFx) : testFx()) //< defensive code
|
||||
} else {
|
||||
if (!condition) {
|
||||
// If condition still not fulfilled (timeout but condition is 'false')
|
||||
console.log("'waitFor()' timeout")
|
||||
phantom.exit(1)
|
||||
} else {
|
||||
// Condition fulfilled (timeout and/or condition is 'true')
|
||||
typeof(onReady) === "string" ? eval(onReady) : onReady() //< Do what it's supposed to do once the condition is fulfilled
|
||||
clearInterval(interval) //< Stop this interval
|
||||
}
|
||||
}
|
||||
}, 100) //< repeat check every 100ms
|
||||
}
|
||||
|
||||
|
||||
if (phantom.args.length === 0 || phantom.args.length > 2) {
|
||||
console.log('Usage: phantom.js URL')
|
||||
phantom.exit()
|
||||
}
|
||||
|
||||
var page = new WebPage()
|
||||
|
||||
// Route "console.log()" calls from within the Page context to the main Phantom context (i.e. current "this")
|
||||
page.onConsoleMessage = function(msg) {
|
||||
console.log(msg)
|
||||
};
|
||||
|
||||
page.open(phantom.args[0], function(status){
|
||||
if (status !== "success") {
|
||||
console.log("Unable to access network")
|
||||
phantom.exit()
|
||||
} else {
|
||||
waitFor(function(){
|
||||
return page.evaluate(function(){
|
||||
var el = document.getElementById('qunit-testresult')
|
||||
if (el && el.innerText.match('completed')) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
})
|
||||
}, function(){
|
||||
var failedNum = page.evaluate(function(){
|
||||
var el = document.getElementById('qunit-testresult')
|
||||
try {
|
||||
return el.getElementsByClassName('failed')[0].innerHTML
|
||||
} catch (e) { }
|
||||
return 10000
|
||||
});
|
||||
phantom.exit((parseInt(failedNum, 10) > 0) ? 1 : 0)
|
||||
})
|
||||
}
|
||||
})
|
@ -1,14 +0,0 @@
|
||||
/*
|
||||
* Simple connect server for phantom.js
|
||||
* Adapted from Modernizr & Bootstrap
|
||||
*/
|
||||
|
||||
var connect = require('connect')
|
||||
, http = require('http')
|
||||
, fs = require('fs')
|
||||
, app = connect()
|
||||
.use(connect.static(__dirname + '/../'));
|
||||
|
||||
http.createServer(app).listen(3000);
|
||||
|
||||
fs.writeFileSync(__dirname + '/pid.txt', process.pid, 'utf-8')
|
@ -1,29 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Video.js Test Suite</title>
|
||||
|
||||
<!-- QUnit -->
|
||||
<link rel="stylesheet" href="../test/vendor/qunit/qunit/qunit.css" />
|
||||
<script src="../test/vendor/qunit/qunit/qunit.js"></script>
|
||||
|
||||
<!-- phantomjs logging script-->
|
||||
<!--<script src="unit/phantom-logging.js"></script>-->
|
||||
|
||||
<!-- Video.js CSS -->
|
||||
<link rel="stylesheet" href="../design/video-js.css" type="text/css">
|
||||
|
||||
<!-- Video.js JavaScript -->
|
||||
<script src='video.test.compiled.js'></script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div>
|
||||
<h1 id="qunit-header">Video.js Test Suite</h1>
|
||||
<h2 id="qunit-banner"></h2>
|
||||
<h2 id="qunit-userAgent"></h2>
|
||||
<ol id="qunit-tests"></ol>
|
||||
<div id="qunit-fixture"></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -1,49 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Video.js Test Suite</title>
|
||||
|
||||
<!-- QUnit -->
|
||||
<link rel="stylesheet" href="../test/vendor/qunit/qunit/qunit.css" />
|
||||
<script src="../test/vendor/qunit/qunit/qunit.js"></script>
|
||||
|
||||
<!-- phantomjs logging script-->
|
||||
<script src="phantom-logging.js"></script>
|
||||
|
||||
<!-- Video.js CSS -->
|
||||
<link rel="stylesheet" href="../src/css/video-js.css" type="text/css">
|
||||
|
||||
<!-- Video.js JavaScript -->
|
||||
<script src='../src/js/goog.base.js'></script>
|
||||
<script src='../src/js/core.js'></script>
|
||||
<script src='../src/js/lib.js'></script>
|
||||
<script src='../src/js/events.js'></script>
|
||||
<script src='../src/js/component.js'></script>
|
||||
<script src='../src/js/player.js'></script>
|
||||
<script src='../src/js/media.js'></script>
|
||||
<script src='../src/js/media.html5.js'></script>
|
||||
<script src='../src/js/media.flash.js'></script>
|
||||
<script src='../src/js/controls.js'></script>
|
||||
<script src='../src/js/tracks.js'></script>
|
||||
<script src='../src/js/setup.js'></script>
|
||||
|
||||
<!-- Unit Tests -->
|
||||
<script src="unit/lib.js"></script>
|
||||
<script src="unit/events.js"></script>
|
||||
<script src="unit/component.js"></script>
|
||||
<script src="unit/player.js"></script>
|
||||
<script src="unit/core.js"></script>
|
||||
<script src="unit/media.html5.js"></script>
|
||||
|
||||
<!-- -->
|
||||
</head>
|
||||
<body>
|
||||
<div>
|
||||
<h1 id="qunit-header">Video.js Test Suite</h1>
|
||||
<h2 id="qunit-banner"></h2>
|
||||
<h2 id="qunit-userAgent"></h2>
|
||||
<ol id="qunit-tests"></ol>
|
||||
<div id="qunit-fixture"></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
646
test/unit.js
646
test/unit.js
@ -1,646 +0,0 @@
|
||||
module("Component");
|
||||
|
||||
test('should create an element', function(){
|
||||
var comp = new vjs.Component({}, {});
|
||||
|
||||
ok(comp.el().nodeName);
|
||||
});
|
||||
|
||||
test('should add a child component', function(){
|
||||
var comp = new vjs.Component({});
|
||||
|
||||
var child = comp.addChild("component");
|
||||
|
||||
ok(comp.children().length === 1);
|
||||
ok(comp.children()[0] === child);
|
||||
ok(comp.el().childNodes[0] === child.el());
|
||||
ok(comp.getChild('component') === child);
|
||||
ok(comp.getChildById(child.id()) === child);
|
||||
});
|
||||
|
||||
test('should init child coponents from options', function(){
|
||||
var comp = new vjs.Component({}, {
|
||||
children: {
|
||||
'component': true
|
||||
}
|
||||
});
|
||||
|
||||
ok(comp.children().length === 1);
|
||||
ok(comp.el().childNodes.length === 1);
|
||||
});
|
||||
|
||||
test('should dispose of component and children', function(){
|
||||
var comp = new vjs.Component({});
|
||||
|
||||
// Add a child
|
||||
var child = comp.addChild("Component");
|
||||
ok(comp.children().length === 1);
|
||||
|
||||
// Add a listener
|
||||
comp.on('click', function(){ return true; });
|
||||
var data = vjs.getData(comp.el());
|
||||
var id = comp.el()[vjs.expando];
|
||||
|
||||
comp.dispose();
|
||||
|
||||
ok(!comp.children(), 'component children were deleted');
|
||||
ok(!comp.el(), 'component element was deleted');
|
||||
ok(!child.children(), 'child children were deleted');
|
||||
ok(!child.el(), 'child element was deleted');
|
||||
ok(!vjs.cache[id], 'listener cache nulled')
|
||||
ok(vjs.isEmpty(data), 'original listener cache object was emptied')
|
||||
});
|
||||
|
||||
test('should add and remove event listeners to element', function(){
|
||||
var comp = new vjs.Component({}, {});
|
||||
|
||||
// No need to make this async because we're triggering events inline.
|
||||
// We're going to trigger the event after removing the listener,
|
||||
// So if we get extra asserts that's a problem.
|
||||
expect(2);
|
||||
|
||||
var testListener = function(){
|
||||
ok(true, 'fired event once');
|
||||
ok(this === comp, 'listener has the component as context');
|
||||
};
|
||||
|
||||
comp.on('test-event', testListener);
|
||||
comp.trigger('test-event');
|
||||
comp.off('test-event', testListener);
|
||||
comp.trigger('test-event');
|
||||
});
|
||||
|
||||
test('should trigger a listener once using one()', function(){
|
||||
var comp = new vjs.Component({}, {});
|
||||
|
||||
expect(1);
|
||||
|
||||
var testListener = function(){
|
||||
ok(true, 'fired event once');
|
||||
};
|
||||
|
||||
comp.one('test-event', testListener);
|
||||
comp.trigger('test-event');
|
||||
comp.trigger('test-event');
|
||||
});
|
||||
|
||||
test('should trigger a listener when ready', function(){
|
||||
expect(2);
|
||||
|
||||
var optionsReadyListener = function(){
|
||||
ok(true, 'options listener fired')
|
||||
};
|
||||
var methodReadyListener = function(){
|
||||
ok(true, 'ready method listener fired')
|
||||
};
|
||||
|
||||
var comp = new vjs.Component({}, {}, optionsReadyListener);
|
||||
|
||||
comp.triggerReady();
|
||||
|
||||
comp.ready(methodReadyListener);
|
||||
|
||||
// First two listeners should only be fired once and then removed
|
||||
comp.triggerReady();
|
||||
});
|
||||
|
||||
test('should add and remove a CSS class', function(){
|
||||
var comp = new vjs.Component({}, {});
|
||||
|
||||
comp.addClass('test-class');
|
||||
ok(comp.el().className.indexOf('test-class') !== -1);
|
||||
comp.removeClass('test-class');
|
||||
ok(comp.el().className.indexOf('test-class') === -1);
|
||||
});
|
||||
|
||||
test('should show and hide an element', function(){
|
||||
var comp = new vjs.Component({}, {});
|
||||
|
||||
comp.hide();
|
||||
ok(comp.el().style.display === 'none');
|
||||
comp.show();
|
||||
ok(comp.el().style.display === 'block');
|
||||
});
|
||||
|
||||
test('should change the width and height of a component', function(){
|
||||
var container = document.createElement('div');
|
||||
var comp = new vjs.Component({}, {});
|
||||
var el = comp.el();
|
||||
var fixture = document.getElementById('qunit-fixture');
|
||||
|
||||
fixture.appendChild(container);
|
||||
container.appendChild(el);
|
||||
// Container of el needs dimensions or the component won't have dimensions
|
||||
container.style.width = '1000px'
|
||||
container.style.height = '1000px'
|
||||
|
||||
comp.width('50%');
|
||||
comp.height('123px');
|
||||
|
||||
ok(comp.width() === 500, 'percent values working');
|
||||
ok(vjs.getComputedStyleValue(el, 'width') === comp.width() + 'px', 'matches computed style');
|
||||
ok(comp.height() === 123, 'px values working');
|
||||
|
||||
comp.width(321);
|
||||
ok(comp.width() === 321, 'integer values working');
|
||||
});
|
||||
|
||||
module("Core");
|
||||
|
||||
test('should create a video tag and have access children in old IE', function(){
|
||||
var fixture = document.getElementById('qunit-fixture');
|
||||
|
||||
fixture.innerHTML += "<video id='test_vid_id'><source type='video/mp4'></video>";
|
||||
|
||||
vid = document.getElementById('test_vid_id');
|
||||
|
||||
ok(vid.childNodes.length === 1);
|
||||
ok(vid.childNodes[0].getAttribute('type') === 'video/mp4');
|
||||
});
|
||||
|
||||
test('should return a video player instance', function(){
|
||||
var fixture = document.getElementById('qunit-fixture');
|
||||
fixture.innerHTML += "<video id='test_vid_id'></video><video id='test_vid_id2'></video>";
|
||||
|
||||
var player = videojs('test_vid_id');
|
||||
ok(player, 'created player from tag');
|
||||
ok(player.id() === 'test_vid_id');
|
||||
ok(videojs.players['test_vid_id'] === player, 'added player to global reference')
|
||||
|
||||
var playerAgain = videojs('test_vid_id');
|
||||
ok(player === playerAgain, 'did not create a second player from same tag');
|
||||
|
||||
var tag2 = document.getElementById('test_vid_id2');
|
||||
var player2 = videojs(tag2);
|
||||
ok(player2.id() === 'test_vid_id2', 'created player from element');
|
||||
});
|
||||
|
||||
module("Events");
|
||||
|
||||
test('should add and remove an event listener to an element', function(){
|
||||
expect(1);
|
||||
|
||||
var el = document.createElement('div');
|
||||
var listener = function(){
|
||||
ok(true, 'Click Triggered');
|
||||
};
|
||||
|
||||
vjs.on(el, 'click', listener);
|
||||
vjs.trigger(el, 'click'); // 1 click
|
||||
vjs.off(el, 'click', listener)
|
||||
vjs.trigger(el, 'click'); // No click should happen.
|
||||
});
|
||||
|
||||
test('should remove all listeners of a type', function(){
|
||||
var el = document.createElement('div');
|
||||
var clicks = 0;
|
||||
var listener = function(){
|
||||
clicks++;
|
||||
};
|
||||
var listener2 = function(){
|
||||
clicks++;
|
||||
};
|
||||
|
||||
vjs.on(el, 'click', listener);
|
||||
vjs.on(el, 'click', listener2);
|
||||
vjs.trigger(el, 'click'); // 2 clicks
|
||||
|
||||
ok(clicks === 2, 'both click listeners fired')
|
||||
|
||||
vjs.off(el, 'click')
|
||||
vjs.trigger(el, 'click'); // No click should happen.
|
||||
|
||||
ok(clicks === 2, 'no click listeners fired')
|
||||
});
|
||||
|
||||
test('should remove all listeners from an element', function(){
|
||||
expect(2);
|
||||
|
||||
var el = document.createElement('div');
|
||||
var listener = function(){
|
||||
ok(true, 'Fake1 Triggered');
|
||||
};
|
||||
var listener2 = function(){
|
||||
ok(true, 'Fake2 Triggered');
|
||||
};
|
||||
|
||||
vjs.on(el, 'fake1', listener);
|
||||
vjs.on(el, 'fake2', listener2);
|
||||
|
||||
vjs.trigger(el, 'fake1');
|
||||
vjs.trigger(el, 'fake2');
|
||||
|
||||
vjs.off(el);
|
||||
|
||||
// No listener should happen.
|
||||
vjs.trigger(el, 'fake1');
|
||||
vjs.trigger(el, 'fake2');
|
||||
});
|
||||
|
||||
test('should listen only once', function(){
|
||||
expect(1);
|
||||
|
||||
var el = document.createElement('div');
|
||||
var listener = function(){
|
||||
ok(true, 'Click Triggered');
|
||||
};
|
||||
|
||||
vjs.one(el, 'click', listener);
|
||||
vjs.trigger(el, 'click'); // 1 click
|
||||
vjs.trigger(el, 'click'); // No click should happen.
|
||||
});
|
||||
|
||||
module("Lib");
|
||||
|
||||
test('should create an element', function(){
|
||||
var div = vjs.createEl();
|
||||
var span = vjs.createEl('span', { "data-test": "asdf", innerHTML:'fdsa' })
|
||||
ok(div.nodeName === 'DIV');
|
||||
ok(span.nodeName === 'SPAN');
|
||||
ok(span['data-test'] === 'asdf');
|
||||
ok(span.innerHTML === "fdsa");
|
||||
});
|
||||
|
||||
test('should make a string start with an uppercase letter', function(){
|
||||
var foo = vjs.capitalize('bar')
|
||||
ok(foo === 'Bar');
|
||||
});
|
||||
|
||||
test('should loop through each property on an object', function(){
|
||||
var asdf = {
|
||||
a: 1,
|
||||
b: 2,
|
||||
'c': 3
|
||||
}
|
||||
|
||||
// Add 3 to each value
|
||||
vjs.eachProp(asdf, function(key, value){
|
||||
asdf[key] = value + 3;
|
||||
});
|
||||
|
||||
deepEqual(asdf,{a:4,b:5,'c':6})
|
||||
});
|
||||
|
||||
test('should add context to a function', function(){
|
||||
var newContext = { test: 'obj'};
|
||||
var asdf = function(){
|
||||
ok(this === newContext);
|
||||
}
|
||||
var fdsa = vjs.bind(newContext, asdf);
|
||||
|
||||
fdsa();
|
||||
});
|
||||
|
||||
test('should add and remove a class name on an element', function(){
|
||||
var el = document.createElement('div');
|
||||
vjs.addClass(el, 'test-class')
|
||||
ok(el.className === 'test-class', 'class added');
|
||||
vjs.addClass(el, 'test-class')
|
||||
ok(el.className === 'test-class', 'same class not duplicated');
|
||||
vjs.addClass(el, 'test-class2')
|
||||
ok(el.className === 'test-class test-class2', 'added second class');
|
||||
vjs.removeClass(el, 'test-class')
|
||||
ok(el.className === 'test-class2', 'removed first class');
|
||||
});
|
||||
|
||||
test('should get and remove data from an element', function(){
|
||||
var el = document.createElement('div');
|
||||
var data = vjs.getData(el);
|
||||
var id = el[vjs.expando];
|
||||
|
||||
ok(typeof data === 'object', 'data object created');
|
||||
|
||||
// Add data
|
||||
var testData = { asdf: 'fdsa' };
|
||||
data.test = testData;
|
||||
ok(vjs.getData(el).test === testData, 'data added');
|
||||
|
||||
// Remove all data
|
||||
vjs.removeData(el);
|
||||
|
||||
ok(!vjs.cache[id], 'cached item nulled')
|
||||
ok(el[vjs.expando] === null || el[vjs.expando] === undefined, 'element data id removed')
|
||||
});
|
||||
|
||||
test('should read tag attributes from elements, including HTML5 in all browsers', function(){
|
||||
var container = document.createElement('div');
|
||||
|
||||
var tags = '<video id="vid1" controls autoplay loop muted preload="none" src="http://google.com" poster="http://www2.videojs.com/img/video-js-html5-video-player.png" data-test="asdf" data-empty-string=""></video>';
|
||||
tags += '<video id="vid2">';
|
||||
// Not putting source and track inside video element because
|
||||
// oldIE needs the HTML5 shim to read tags inside HTML5 tags.
|
||||
// Still may not work in oldIE.
|
||||
tags += '<source id="source" src="http://google.com" type="video/mp4" media="fdsa" title="test" >';
|
||||
tags += '<track id="track" default src="http://google.com" kind="captions" srclang="en" label="testlabel" title="test" >';
|
||||
container.innerHTML += tags;
|
||||
document.getElementById('qunit-fixture').appendChild(container);
|
||||
|
||||
var vid1Vals = vjs.getAttributeValues(document.getElementById('vid1'));
|
||||
var vid2Vals = vjs.getAttributeValues(document.getElementById('vid2'));
|
||||
var sourceVals = vjs.getAttributeValues(document.getElementById('source'));
|
||||
var trackVals = vjs.getAttributeValues(document.getElementById('track'));
|
||||
|
||||
deepEqual(vid1Vals, { 'autoplay': true, 'controls': true, 'data-test': "asdf", 'data-empty-string': "", 'id': "vid1", 'loop': true, 'muted': true, 'poster': "http://www2.videojs.com/img/video-js-html5-video-player.png", 'preload': "none", 'src': "http://google.com" });
|
||||
deepEqual(vid2Vals, { 'id': "vid2" });
|
||||
deepEqual(sourceVals, {'title': "test", 'media': "fdsa", 'type': "video/mp4", 'src': "http://google.com", 'id': "source" });
|
||||
deepEqual(trackVals, { "default": true, /* IE no likey default key */ 'id': "track", 'kind': "captions", 'label': "testlabel", 'src': "http://google.com", 'srclang': "en", 'title': "test" });
|
||||
});
|
||||
|
||||
test('should get the right style values for an element', function(){
|
||||
var el = document.createElement('div');
|
||||
var container = document.createElement('div');
|
||||
var fixture = document.getElementById('qunit-fixture')
|
||||
|
||||
container.appendChild(el);
|
||||
fixture.appendChild(container);
|
||||
|
||||
container.style.width = "1000px";
|
||||
container.style.height = "1000px";
|
||||
|
||||
el.style.height = "100%";
|
||||
el.style.width = "123px";
|
||||
|
||||
ok(vjs.getComputedStyleValue(el, 'height') === '1000px');
|
||||
ok(vjs.getComputedStyleValue(el, 'width') === '123px');
|
||||
});
|
||||
|
||||
test('should insert an element first in another', function(){
|
||||
var el1 = document.createElement('div');
|
||||
var el2 = document.createElement('div');
|
||||
var parent = document.createElement('div');
|
||||
|
||||
vjs.insertFirst(el1, parent)
|
||||
ok(parent.firstChild === el1, 'inserts first into empty parent');
|
||||
|
||||
vjs.insertFirst(el2, parent)
|
||||
ok(parent.firstChild === el2, 'inserts first into parent with child');
|
||||
});
|
||||
|
||||
test('should return the element with the ID', function(){
|
||||
var el1 = document.createElement('div');
|
||||
var el2 = document.createElement('div');
|
||||
var fixture = document.getElementById('qunit-fixture');
|
||||
|
||||
fixture.appendChild(el1);
|
||||
fixture.appendChild(el2);
|
||||
|
||||
el1.id = 'test_id1';
|
||||
el2.id = 'test_id2';
|
||||
|
||||
ok(vjs.el("test_id1") === el1, 'found element for ID');
|
||||
ok(vjs.el("#test_id2") === el2, 'found element for CSS ID');
|
||||
});
|
||||
|
||||
test('should trim whitespace from a string', function(){
|
||||
ok(vjs.trim(' asdf asdf asdf \t\n\r') === 'asdf asdf asdf');
|
||||
});
|
||||
|
||||
test('should round a number', function(){
|
||||
ok(vjs.round(1.01) === 1);
|
||||
ok(vjs.round(1.5) === 2);
|
||||
ok(vjs.round(1.55, 2) === 1.55);
|
||||
ok(vjs.round(10.551, 2) === 10.55);
|
||||
});
|
||||
|
||||
test('should format time as a string', function(){
|
||||
ok(vjs.formatTime(1) === "0:01");
|
||||
ok(vjs.formatTime(10) === "0:10");
|
||||
ok(vjs.formatTime(60) === "1:00");
|
||||
ok(vjs.formatTime(600) === "10:00");
|
||||
ok(vjs.formatTime(3600) === "1:00:00");
|
||||
ok(vjs.formatTime(36000) === "10:00:00");
|
||||
ok(vjs.formatTime(360000) === "100:00:00");
|
||||
|
||||
// Using guide should provide extra leading zeros
|
||||
ok(vjs.formatTime(1,1) === "0:01");
|
||||
ok(vjs.formatTime(1,10) === "0:01");
|
||||
ok(vjs.formatTime(1,60) === "0:01");
|
||||
ok(vjs.formatTime(1,600) === "00:01");
|
||||
ok(vjs.formatTime(1,3600) === "0:00:01");
|
||||
// Don't do extra leading zeros for hours
|
||||
ok(vjs.formatTime(1,36000) === "0:00:01");
|
||||
ok(vjs.formatTime(1,360000) === "0:00:01");
|
||||
});
|
||||
|
||||
test('should create a fake timerange', function(){
|
||||
var tr = vjs.createTimeRange(0, 10);
|
||||
ok(tr.start() === 0);
|
||||
ok(tr.end() === 10);
|
||||
});
|
||||
|
||||
test('should get an absolute URL', function(){
|
||||
// Errors on compiled tests that don't use unit.html. Need a better solution.
|
||||
// ok(vjs.getAbsoluteURL('unit.html') === window.location.href);
|
||||
ok(vjs.getAbsoluteURL('http://asdf.com') === "http://asdf.com");
|
||||
ok(vjs.getAbsoluteURL('https://asdf.com/index.html') === "https://asdf.com/index.html");
|
||||
});
|
||||
|
||||
module("HTML5");
|
||||
|
||||
module("Player");
|
||||
|
||||
var PlayerTest = {
|
||||
makeTag: function(){
|
||||
var videoTag = document.createElement('video');
|
||||
videoTag.id = 'example_1';
|
||||
videoTag.className = 'video-js vjs-default-skin';
|
||||
return videoTag;
|
||||
},
|
||||
makePlayer: function(playerOptions){
|
||||
var videoTag = PlayerTest.makeTag();
|
||||
|
||||
var fixture = document.getElementById('qunit-fixture');
|
||||
fixture.appendChild(videoTag);
|
||||
|
||||
return player = new vjs.Player(videoTag, playerOptions);
|
||||
}
|
||||
};
|
||||
|
||||
// Compiler doesn't like using 'this' in setup/teardown.
|
||||
// module("Player", {
|
||||
// /**
|
||||
// * @this {*}
|
||||
// */
|
||||
// setup: function(){
|
||||
// window.player1 = true; // using window works
|
||||
// },
|
||||
|
||||
// /**
|
||||
// * @this {*}
|
||||
// */
|
||||
// teardown: function(){
|
||||
// // if (this.player && this.player.el() !== null) {
|
||||
// // this.player.dispose();
|
||||
// // this.player = null;
|
||||
// // }
|
||||
// }
|
||||
// });
|
||||
|
||||
// Object.size = function(obj) {
|
||||
// var size = 0, key;
|
||||
// for (key in obj) {
|
||||
// console.log('key', key)
|
||||
// if (obj.hasOwnProperty(key)) size++;
|
||||
// }
|
||||
// return size;
|
||||
// };
|
||||
|
||||
|
||||
test('should create player instance that inherits from component and dispose it', function(){
|
||||
var player = PlayerTest.makePlayer();
|
||||
|
||||
ok(player.el().nodeName === 'DIV');
|
||||
ok(player.on, 'component function exists');
|
||||
|
||||
player.dispose();
|
||||
ok(player.el() === null, 'element disposed');
|
||||
});
|
||||
|
||||
test('should accept options from multiple sources and override in correct order', function(){
|
||||
// For closure compiler to work, all reference to the prop have to be the same type
|
||||
// As in options['attr'] or options.attr. Compiler will minimize each separately.
|
||||
// Since we're using setAttribute which requires a string, we have to use the string
|
||||
// version of the key for all version.
|
||||
|
||||
// Set a global option
|
||||
vjs.options['attr'] = 1;
|
||||
|
||||
var tag0 = PlayerTest.makeTag();
|
||||
var player0 = new vjs.Player(tag0);
|
||||
|
||||
ok(player0.options['attr'] === 1, 'global option was set')
|
||||
player0.dispose();
|
||||
|
||||
// Set a tag level option
|
||||
var tag1 = PlayerTest.makeTag();
|
||||
tag1.setAttribute('attr', 'asdf'); // Attributes must be set as strings
|
||||
|
||||
var player1 = new vjs.Player(tag1);
|
||||
ok(player1.options['attr'] === 'asdf', 'Tag options overrode global options');
|
||||
player1.dispose();
|
||||
|
||||
// Set a tag level option
|
||||
var tag2 = PlayerTest.makeTag();
|
||||
tag2.setAttribute('attr', 'asdf');
|
||||
|
||||
var player2 = new vjs.Player(tag2, { 'attr': 'fdsa' });
|
||||
ok(player2.options['attr'] === 'fdsa', 'Init options overrode tag and global options');
|
||||
player2.dispose();
|
||||
});
|
||||
|
||||
test('should get tag, source, and track settings', function(){
|
||||
// Partially tested in lib->getAttributeValues
|
||||
|
||||
var fixture = document.getElementById('qunit-fixture');
|
||||
|
||||
var html = '<video id="example_1" class="video-js" autoplay preload="metadata">'
|
||||
html += '<source src="http://google.com" type="video/mp4">';
|
||||
html += '<source src="http://google.com" type="video/webm">';
|
||||
html += '<track src="http://google.com" kind="captions" default>';
|
||||
html += '</video>';
|
||||
|
||||
fixture.innerHTML += html;
|
||||
|
||||
var tag = document.getElementById('example_1');
|
||||
var player = new vjs.Player(tag);
|
||||
|
||||
ok(player.options['autoplay'] === true);
|
||||
ok(player.options['preload'] === 'metadata'); // No extern. Use string.
|
||||
ok(player.options['id'] === 'example_1');
|
||||
ok(player.options['sources'].length === 2);
|
||||
ok(player.options['sources'][0].src === 'http://google.com');
|
||||
ok(player.options['sources'][0].type === 'video/mp4');
|
||||
ok(player.options['sources'][1].type === 'video/webm');
|
||||
ok(player.options['tracks'].length === 1);
|
||||
ok(player.options['tracks'][0]['kind'] === 'captions'); // No extern
|
||||
ok(player.options['tracks'][0]['default'] === true);
|
||||
|
||||
ok(player.el().className.indexOf('video-js') !== -1, 'transferred class from tag to player div');
|
||||
ok(player.el().id === 'example_1', 'transferred id from tag to player div');
|
||||
|
||||
ok(tag.player === player, 'player referenceable on original tag');
|
||||
ok(vjs.players[player.id()] === player, 'player referenceable from global list');
|
||||
ok(tag.id !== player.id, 'tag ID no longer is the same as player ID');
|
||||
ok(tag.className !== player.el().className, 'tag classname updated');
|
||||
|
||||
player.dispose();
|
||||
|
||||
ok(tag.player === null, 'tag player ref killed')
|
||||
ok(!vjs.players['example_1'], 'global player ref killed')
|
||||
ok(player.el() === null, 'player el killed')
|
||||
});
|
||||
|
||||
test('should set the width and height of the player', function(){
|
||||
var player = PlayerTest.makePlayer({ width: 123, height: '100%' });
|
||||
|
||||
ok(player.width() === 123)
|
||||
ok(player.el().style.width === '123px')
|
||||
|
||||
var fixture = document.getElementById('qunit-fixture');
|
||||
var container = document.createElement('div');
|
||||
fixture.appendChild(container);
|
||||
|
||||
// Player container needs to have height in order to have height
|
||||
// Don't want to mess with the fixture itself
|
||||
container.appendChild(player.el());
|
||||
container.style.height = "1000px";
|
||||
ok(player.height() === 1000);
|
||||
|
||||
player.dispose();
|
||||
});
|
||||
|
||||
test('should accept options from multiple sources and override in correct order', function(){
|
||||
var tag = PlayerTest.makeTag();
|
||||
var container = document.createElement('div');
|
||||
var fixture = document.getElementById('qunit-fixture');
|
||||
|
||||
container.appendChild(tag);
|
||||
fixture.appendChild(container);
|
||||
|
||||
var player = new vjs.Player(tag);
|
||||
var el = player.el();
|
||||
|
||||
ok(el.parentNode === container, 'player placed at same level as tag')
|
||||
// Tag may be placed inside the player element or it may be removed from the DOM
|
||||
ok(tag.parentNode !== container, 'tag removed from original place')
|
||||
|
||||
player.dispose();
|
||||
});
|
||||
|
||||
test('should load a media controller', function(){
|
||||
var player = PlayerTest.makePlayer({
|
||||
preload: 'none',
|
||||
sources: [
|
||||
{ src: "http://google.com", type: 'video/mp4' },
|
||||
{ src: "http://google.com", type: 'video/webm' }
|
||||
]
|
||||
});
|
||||
|
||||
ok(player.el().children[0].className.indexOf('vjs-tech') !== -1, 'media controller loaded')
|
||||
|
||||
player.dispose();
|
||||
});
|
||||
|
||||
module("Setup");
|
||||
|
||||
// Logging setup for phantom integration
|
||||
// adapted from Modernizr & Bootstrap
|
||||
|
||||
QUnit.begin = function () {
|
||||
console.log("Starting test suite")
|
||||
console.log("================================================\n")
|
||||
}
|
||||
|
||||
QUnit.moduleDone = function (opts) {
|
||||
if (opts.failed === 0) {
|
||||
console.log("\u2714 All tests passed in '" + opts.name + "' module")
|
||||
} else {
|
||||
console.log("\u2716 " + opts.failed + " tests failed in '" + opts.name + "' module")
|
||||
}
|
||||
}
|
||||
|
||||
QUnit.done = function (opts) {
|
||||
console.log("\n================================================")
|
||||
console.log("Tests completed in " + opts.runtime + " milliseconds")
|
||||
console.log(opts.passed + " tests of " + opts.total + " passed, " + opts.failed + " failed.")
|
||||
}
|
@ -1,97 +0,0 @@
|
||||
(function() {var e=void 0,g=!0,h=null,k=!1;function n(a){return function(){return this[a]}}function q(a){return function(){return a}}var r,t=this;t.Sc=g;function u(a,b){var c=a.split("."),d=t;!(c[0]in d)&&d.execScript&&d.execScript("var "+c[0]);for(var f;c.length&&(f=c.shift());)!c.length&&b!==e?d[f]=b:d=d[f]?d[f]:d[f]={}}function v(a,b){function c(){}c.prototype=b.prototype;a.f=b.prototype;a.prototype=new c;a.prototype.constructor=a};document.createElement("video");document.createElement("audio");var aa=vjs=function(a,b,c){if("string"===typeof a){0===a.indexOf("#")&&(a=a.slice(1));if(vjs.Va[a])return vjs.Va[a];a=vjs.j(a)}if(!a||!a.nodeName)throw new TypeError("The element or ID supplied is not valid. (videojs)");return a.a||new vjs.ea(a,b,c)};
|
||||
vjs.options={techOrder:["html5","flash"],html5:{},flash:{jd:"http://vjs.zencdn.net/c/video-js.swf"},width:300,height:150,defaultVolume:0,children:{mediaLoader:{},posterImage:{},textTrackDisplay:{},loadingSpinner:{},bigPlayButton:{},controlBar:{}}};vjs.Va={};vjs.d=function(a,b){var c=document.createElement(a||"div"),d;for(d in b)b.hasOwnProperty(d)&&(c[d]=b[d]);return c};vjs.T=function(a){return a.charAt(0).toUpperCase()+a.slice(1)};vjs.Oa=function(a,b){if(a)for(var c in a)a.hasOwnProperty(c)&&b.call(this,c,a[c])};vjs.s=function(a,b){if(!b)return a;for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return a};vjs.bind=function(a,b,c){function d(){return b.apply(a,arguments)}b.p||(b.p=vjs.p++);d.p=c?c+"_"+b.p:b.p;return d};vjs.ya={};vjs.p=1;
|
||||
vjs.expando="vdata"+(new Date).getTime();vjs.getData=function(a){var b=a[vjs.expando];b||(b=a[vjs.expando]=vjs.p++,vjs.ya[b]={});return vjs.ya[b]};vjs.Sb=function(a){a=a[vjs.expando];return!(!a||vjs.sb(vjs.ya[a]))};vjs.Xb=function(a){var b=a[vjs.expando];if(b){delete vjs.ya[b];try{delete a[vjs.expando]}catch(c){a.removeAttribute?a.removeAttribute(vjs.expando):a[vjs.expando]=h}}};vjs.sb=function(a){for(var b in a)if(a[b]!==h)return k;return g};
|
||||
vjs.u=function(a,b){-1==(" "+a.className+" ").indexOf(" "+b+" ")&&(a.className=""===a.className?b:a.className+" "+b)};vjs.z=function(a,b){if(-1!=a.className.indexOf(b)){var c=a.className.split(" ");c.splice(c.indexOf(b),1);a.className=c.join(" ")}};vjs.kc=document.createElement("video");vjs.Ja=navigator.userAgent;vjs.ic=!!navigator.userAgent.match(/iPad/i);vjs.hc=!!navigator.userAgent.match(/iPhone/i);vjs.jc=!!navigator.userAgent.match(/iPod/i);vjs.gc=vjs.ic||vjs.hc||vjs.jc;var ba=vjs,w;var x=navigator.userAgent.match(/OS (\d+)_/i);
|
||||
w=x&&x[1]?x[1]:e;ba.Tc=w;vjs.ec=!!navigator.userAgent.match(/Android.*AppleWebKit/i);var ca=vjs,y=navigator.userAgent.match(/Android (\d+)\./i);ca.dc=y&&y[1]?y[1]:h;vjs.fc=function(){return!!vjs.Ja.match("Firefox")};vjs.qb=function(a){var b={};if(a&&a.attributes&&0<a.attributes.length)for(var c=a.attributes,d,f,l=c.length-1;0<=l;l--){d=c[l].name;f=c[l].value;if("boolean"===typeof a[d]||-1!==",autoplay,controls,loop,muted,default,".indexOf(","+d+","))f=f!==h?g:k;b[d]=f}return b};
|
||||
vjs.cd=function(a,b){var c="";document.defaultView&&document.defaultView.getComputedStyle?c=document.defaultView.getComputedStyle(a,"").getPropertyValue(b):a.currentStyle&&(b=b.replace(/\-(\w)/g,function(a,b){return b.toUpperCase()}),c=a.currentStyle[b]);return c};vjs.rb=function(a,b){b.firstChild?b.insertBefore(a,b.firstChild):b.appendChild(a)};vjs.Cb={};vjs.j=function(a){0===a.indexOf("#")&&(a=a.slice(1));return document.getElementById(a)};
|
||||
vjs.pb=function(a,b){b=b||a;var c=Math.floor(a%60),d=Math.floor(a/60%60),f=Math.floor(a/3600),l=Math.floor(b/60%60),j=Math.floor(b/3600),f=0<f||0<j?f+":":"";return f+(((f||10<=l)&&10>d?"0"+d:d)+":")+(10>c?"0"+c:c)};vjs.mc=function(){document.body.focus();document.onselectstart=q(k)};vjs.Oc=function(){document.onselectstart=q(g)};vjs.trim=function(a){return a.toString().replace(/^\s+/,"").replace(/\s+$/,"")};vjs.round=function(a,b){b||(b=0);return Math.round(a*Math.pow(10,b))/Math.pow(10,b)};
|
||||
vjs.Jb=function(a){return{length:1,start:q(0),end:function(){return a}}};
|
||||
vjs.get=function(a,b,c){var d=0===a.indexOf("file:")||0===window.location.href.indexOf("file:")&&-1===a.indexOf("http");"undefined"===typeof XMLHttpRequest&&(window.XMLHttpRequest=function(){try{return new window.ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(a){}try{return new window.ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(b){}try{return new window.ActiveXObject("Msxml2.XMLHTTP")}catch(c){}throw Error("This browser does not support XMLHttpRequest.");});var f=new XMLHttpRequest;try{f.open("GET",a)}catch(l){c(l)}f.onreadystatechange=
|
||||
function(){4===f.readyState&&(200===f.status||d&&0===f.status?b(f.responseText):c&&c())};try{f.send()}catch(j){c&&c(j)}};vjs.Jc=function(a){var b=window.localStorage||k;if(b)try{b.volume=a}catch(c){22==c.code||1014==c.code?vjs.log("LocalStorage Full (VideoJS)",c):vjs.log("LocalStorage Error (VideoJS)",c)}};vjs.Pb=function(a){a.match(/^https?:\/\//)||(a=vjs.d("div",{innerHTML:'<a href="'+a+'">x</a>'}).firstChild.href);return a};
|
||||
vjs.log=function(){vjs.log.history=vjs.log.history||[];vjs.log.history.push(arguments);window.console&&window.console.log(Array.prototype.slice.call(arguments))};vjs.sc="getBoundingClientRect"in document.documentElement?function(a){var b;try{b=a.getBoundingClientRect()}catch(c){}if(!b)return 0;a=document.body;return b.left+(window.pageXOffset||a.scrollLeft)-(document.documentElement.clientLeft||a.clientLeft||0)}:function(a){for(var b=a.offsetLeft;a=a.offsetParent;)b+=a.offsetLeft;return b};vjs.e=function(a,b,c){var d=vjs.getData(a);d.q||(d.q={});d.q[b]||(d.q[b]=[]);c.p||(c.p=vjs.p++);d.q[b].push(c);d.N||(d.disabled=k,d.N=function(b){if(!d.disabled){b=vjs.Mb(b);var c=d.q[b.type];if(c){for(var j=[],p=0,m=c.length;p<m;p++)j[p]=c[p];c=0;for(p=j.length;c<p;c++)j[c].call(a,b)}}});1==d.q[b].length&&(document.addEventListener?a.addEventListener(b,d.N,k):document.attachEvent&&a.attachEvent("on"+b,d.N))};
|
||||
vjs.o=function(a,b,c){if(vjs.Sb(a)){var d=vjs.getData(a);if(d.q)if(b){var f=d.q[b];if(f){if(c){if(c.p)for(d=0;d<f.length;d++)f[d].p===c.p&&f.splice(d--,1)}else d.q[b]=[];vjs.Hb(a,b)}}else for(f in d.q)b=f,d.q[b]=[],vjs.Hb(a,b)}};vjs.Hb=function(a,b){var c=vjs.getData(a);0===c.q[b].length&&(delete c.q[b],document.removeEventListener?a.removeEventListener(b,c.N,k):document.detachEvent&&a.detachEvent("on"+b,c.N));vjs.sb(c.q)&&(delete c.q,delete c.N,delete c.disabled);vjs.sb(c)&&vjs.Xb(a)};
|
||||
vjs.Mb=function(a){function b(){return g}function c(){return k}if(!a||!a.tb){var d=a||window.event,f;for(f in d)a[f]=d[f];a.target||(a.target=a.srcElement||document);a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement;a.preventDefault=function(){a.returnValue=k;a.Tb=b};a.Tb=c;a.stopPropagation=function(){a.cancelBubble=g;a.tb=b};a.tb=c;a.stopImmediatePropagation=function(){a.vc=b;a.stopPropagation()};a.vc=c;a.clientX!=h&&(d=document.documentElement,f=document.body,a.pageX=a.clientX+
|
||||
(d&&d.scrollLeft||f&&f.scrollLeft||0)-(d&&d.clientLeft||f&&f.clientLeft||0),a.pageY=a.clientY+(d&&d.scrollTop||f&&f.scrollTop||0)-(d&&d.clientTop||f&&f.clientTop||0));a.which=a.charCode||a.keyCode;a.button!=h&&(a.button=a.button&1?0:a.button&4?1:a.button&2?2:0)}return a};
|
||||
vjs.i=function(a,b){var c=vjs.Sb(a)?vjs.getData(a):{},d=a.parentNode||a.ownerDocument;"string"===typeof b&&(b={type:b,target:a});b=vjs.Mb(b);c.N&&c.N.call(a,b);if(d&&!b.tb())vjs.i(d,b);else if(!d&&!b.Tb()&&(c=vjs.getData(b.target),b.target[b.type])){c.disabled=g;if("function"===typeof b.target[b.type])b.target[b.type]();c.disabled=k}};vjs.H=function(a,b,c){vjs.e(a,b,function(){vjs.o(a,b,arguments.callee);c.apply(this,arguments)})};vjs.c=function(a,b,c){this.a=a;b=this.options=vjs.s(this.options||{},b);this.O=b.id||(b.j&&b.j.id?b.j.id:a.id+"_component_"+vjs.p++);this.zc=b.name||h;this.b=b.j?b.j:this.d();this.C=[];this.kb={};this.M={};if((a=this.options)&&a.children){var d=this;vjs.Oa(a.children,function(a,b){b!==k&&!b.xc&&(d[a]=d.R(a,b))})}this.P(c)};r=vjs.c.prototype;
|
||||
r.D=function(){if(this.C)for(var a=this.C.length-1;0<=a;a--)this.C[a].D();this.M=this.kb=this.C=h;this.o();this.b.parentNode&&this.b.parentNode.removeChild(this.b);vjs.Xb(this.b);this.b=h};r.d=function(a,b){return vjs.d(a,b)};r.j=n("b");r.id=n("O");r.name=n("zc");r.children=n("C");
|
||||
r.R=function(a,b){var c,d,f;"string"===typeof a?(d=a,b=b||{},c=b.Yc||vjs.T(d),b.name=d,c=new window.videojs[c](this.a||this,b)):c=a;d=c.name();f=c.id();this.C.push(c);f&&(this.kb[f]=c);d&&(this.M[d]=c);this.b.appendChild(c.j());return c};r.removeChild=function(a){"string"===typeof a&&(a=this.M[a]);if(a&&this.C){for(var b=k,c=this.C.length-1;0<=c;c--)if(this.C[c]===a){b=g;this.C.splice(c,1);break}b&&(this.kb[a.id]=h,this.M[a.name]=h,(b=a.j())&&b.parentNode===this.b&&this.b.removeChild(a.j()))}};
|
||||
r.v=q("");r.e=function(a,b){vjs.e(this.b,a,vjs.bind(this,b));return this};r.o=function(a,b){vjs.o(this.b,a,b);return this};r.H=function(a,b){vjs.H(this.b,a,vjs.bind(this,b));return this};r.i=function(a,b){vjs.i(this.b,a,b);return this};r.P=function(a){a&&(this.ia?a.call(this):(this.Ya===e&&(this.Ya=[]),this.Ya.push(a)));return this};function z(a){a.ia=g;var b=a.Ya;if(b&&0<b.length){for(var c=0,d=b.length;c<d;c++)b[c].call(a);a.Ya=[];a.i("ready")}}r.u=function(a){vjs.u(this.b,a);return this};
|
||||
r.z=function(a){vjs.z(this.b,a);return this};r.show=function(){this.b.style.display="block";return this};r.w=function(){this.b.style.display="none";return this};r.Pa=function(){this.z("vjs-fade-out");this.u("vjs-fade-in");return this};r.nb=function(){this.z("vjs-fade-in");this.u("vjs-fade-out");return this};r.Ub=function(){var a=this.b.style;a.display="block";a.opacity=1;a.Qc="visible";return this};function A(a){a=a.b.style;a.display="";a.opacity="";a.Qc=""}
|
||||
r.width=function(a,b){return B(this,"width",a,b)};r.height=function(a,b){return B(this,"height",a,b)};r.pc=function(a,b){return this.width(a,g).height(b)};function B(a,b,c,d){if(c!==e)return a.b.style[b]=-1!==(""+c).indexOf("%")||-1!==(""+c).indexOf("px")?c:c+"px",d||a.i("resize"),a;if(!a.b)return 0;c=a.b.style[b];d=c.indexOf("px");return-1!==d?parseInt(c.slice(0,d),10):parseInt(a.b["offset"+vjs.T(b)],10)};vjs.ea=function(a,b,c){this.I=a;var d={};vjs.s(d,vjs.options);vjs.s(d,da(a));vjs.s(d,b);this.n={};vjs.c.call(this,this,d,c);this.e("ended",this.Bc);this.e("play",this.Ab);this.e("pause",this.zb);this.e("progress",this.Cc);this.e("durationchange",this.Ac);this.e("error",this.xb);vjs.Va[this.O]=this};v(vjs.ea,vjs.c);r=vjs.ea.prototype;r.D=function(){vjs.Va[this.O]=h;this.I&&this.I.a&&(this.I.a=h);this.b&&this.b.a&&(this.b.a=h);clearInterval(this.Xa);this.k&&this.k.D();vjs.ea.f.D.call(this)};
|
||||
function da(a){var b={sources:[],tracks:[]};vjs.s(b,vjs.qb(a));if(a.hasChildNodes())for(var c,d=a.childNodes,f=0,l=d.length;f<l;f++)a=d[f],c=a.nodeName.toLowerCase(),"source"===c?b.sources.push(vjs.qb(a)):"track"===c&&b.tracks.push(vjs.qb(a));return b}
|
||||
r.d=function(){var a=this.b=vjs.ea.f.d.call(this,"div"),b=this.I;b.removeAttribute("controls");b.removeAttribute("poster");b.removeAttribute("width");b.removeAttribute("height");if(b.hasChildNodes())for(var c=b.childNodes.length,d=0,f=b.childNodes;d<c;d++)("source"==f[0].nodeName.toLowerCase()||"track"==f[0].nodeName.toLowerCase())&&b.removeChild(f[0]);b.id=b.id||"vjs_video_"+vjs.p++;a.id=b.id;a.className=b.className;b.id+="_html5_api";b.className="vjs-tech";b.a=a.a=this;this.u("vjs-paused");this.width(this.options.width,
|
||||
g);this.height(this.options.height,g);b.parentNode&&b.parentNode.insertBefore(a,b);vjs.rb(b,a);return a};
|
||||
function C(a,b,c){a.k?D(a):"Html5"!==b&&a.I&&(a.b.removeChild(a.I),a.I=h);a.V=b;a.ia=k;var d=vjs.s({source:c,Dc:a.b},a.options[b.toLowerCase()]);c&&(c.src==a.n.src&&0<a.n.currentTime&&(d.startTime=a.n.currentTime),a.n.src=c.src);a.k=new window.videojs[b](a,d);a.k.P(function(){z(this.a);if(!this.G.Wb){var a=this.a;a.vb=g;a.Xa=setInterval(vjs.bind(a,function(){this.n.hb<this.buffered().end(0)?this.i("progress"):1==E(this)&&(clearInterval(this.Xa),this.i("progress"))}),500);a.k.H("progress",function(){this.G.Wb=
|
||||
g;var a=this.a;a.vb=k;clearInterval(a.Xa)})}this.G.bc||(a=this.a,a.wb=g,a.e("play",a.cc),a.e("pause",a.$a),a.k.H("timeupdate",function(){this.G.bc=g;F(this.a)}))})}function D(a){a.k.D();a.vb&&(a.vb=k,clearInterval(a.Xa));a.wb&&F(a);a.k=k}function F(a){a.wb=k;a.$a();a.o("play",a.cc);a.o("pause",a.$a)}r.cc=function(){this.Kb&&this.$a();this.Kb=setInterval(vjs.bind(this,function(){this.i("timeupdate")}),250)};r.$a=function(){clearInterval(this.Kb)};
|
||||
r.Bc=function(){this.options.loop&&(this.currentTime(0),this.play())};r.Ab=function(){vjs.z(this.b,"vjs-paused");vjs.u(this.b,"vjs-playing")};r.zb=function(){vjs.z(this.b,"vjs-playing");vjs.u(this.b,"vjs-paused")};r.Cc=function(){1==E(this)&&this.i("loadedalldata")};r.Ac=function(){this.duration(G(this,"duration"))};r.xb=function(a){vjs.log("Video Error",a)};function H(a,b,c){if(a.k.ia)try{a.k[b](c)}catch(d){vjs.log(d)}else a.k.P(function(){this[b](c)})}
|
||||
function G(a,b){if(a.k.ia)try{return a.k[b]()}catch(c){if(a.k[b]===e)vjs.log("Video.js: "+b+" method not defined for "+a.V+" playback technology.",c);else{if("TypeError"==c.name)throw vjs.log("Video.js: "+b+" unavailable on "+a.V+" playback technology element.",c),a.k.ia=k,c;vjs.log(c)}}}r.play=function(){H(this,"play");return this};r.pause=function(){H(this,"pause");return this};r.paused=function(){return G(this,"paused")===k?k:g};
|
||||
r.currentTime=function(a){return a!==e?(this.n.gd=a,H(this,"setCurrentTime",a),this.wb&&this.i("timeupdate"),this):this.n.currentTime=G(this,"currentTime")||0};r.duration=function(a){return a!==e?(this.n.duration=parseFloat(a),this):this.n.duration};r.buffered=function(){var a=G(this,"buffered"),b=this.n.hb=this.n.hb||0;a&&(0<a.length&&a.end(0)!==b)&&(b=a.end(0),this.n.hb=b);return vjs.Jb(b)};function E(a){return a.duration()?a.buffered().end(0)/a.duration():0}
|
||||
r.volume=function(a){if(a!==e)return a=Math.max(0,Math.min(1,parseFloat(a))),this.n.volume=a,H(this,"setVolume",a),vjs.Jc(a),this;a=parseFloat(G(this,"volume"));return isNaN(a)?1:a};r.muted=function(a){return a!==e?(H(this,"setMuted",a),this):G(this,"muted")||k};r.ab=function(){return G(this,"supportsFullScreen")||k};
|
||||
r.Za=function(){var a=vjs.Cb.Za;this.U=g;a?(vjs.e(document,a.ha,vjs.bind(this,function(){this.U=document[a.U];this.U===k&&vjs.o(document,a.ha,arguments.callee);this.i("fullscreenchange")})),this.k.G.Ob===k&&this.options.flash.iFrameMode!==g&&(this.pause(),D(this),vjs.e(document,a.ha,vjs.bind(this,function(){vjs.o(document,a.ha,arguments.callee);C(this,this.V,{src:this.n.src})}))),this.b[a.Fc]()):this.k.ab()?(this.i("fullscreenchange"),H(this,"enterFullScreen")):(this.i("fullscreenchange"),this.uc=
|
||||
g,this.qc=document.documentElement.style.overflow,vjs.e(document,"keydown",vjs.bind(this,this.Nb)),document.documentElement.style.overflow="hidden",vjs.u(document.body,"vjs-full-window"),vjs.u(this.b,"vjs-fullscreen"),this.i("enterFullWindow"));return this};
|
||||
function I(a){var b=vjs.Cb.Za;a.U=k;b?(a.k.G.Ob===k&&a.options.flash.iFrameMode!==g&&(a.pause(),D(a),vjs.e(document,b.ha,vjs.bind(a,function(){vjs.o(document,b.ha,arguments.callee);C(this,this.V,{src:this.n.src})}))),document[b.nc]()):(a.k.ab()?H(a,"exitFullScreen"):J(a),a.i("fullscreenchange"))}r.Nb=function(a){27===a.keyCode&&(this.U===g?I(this):J(this))};
|
||||
function J(a){a.uc=k;vjs.o(document,"keydown",a.Nb);document.documentElement.style.overflow=a.qc;vjs.z(document.body,"vjs-full-window");vjs.z(a.b,"vjs-fullscreen");a.i("exitFullWindow")}
|
||||
r.src=function(a){if(a instanceof Array){var b;a:{b=a;for(var c=0,d=this.options.techOrder;c<d.length;c++){var f=vjs.T(d[c]),l=window.videojs[f];if(l.isSupported())for(var j=0,p=b;j<p.length;j++){var m=p[j];if(l.canPlaySource(m)){b={source:m,k:f};break a}}}b=k}b?(a=b.source,b=b.k,b==this.V?this.src(a):C(this,b,a)):this.b.appendChild(vjs.d("p",{innerHTML:'Sorry, no compatible source and playback technology were found for this video. Try using another browser like <a href="http://www.google.com/chrome">Google Chrome</a> or download the latest <a href="http://get.adobe.com/flashplayer/">Adobe Flash Player</a>.'}))}else a instanceof
|
||||
Object?window.videojs[this.V].canPlaySource(a)?this.src(a.src):this.src([a]):(this.n.src=a,this.ia?(H(this,"src",a),"auto"==this.options.preload&&this.load(),this.options.autoplay&&this.play()):this.P(function(){this.src(a)}));return this};r.load=function(){H(this,"load");return this};r.currentSrc=function(){return G(this,"currentSrc")||this.n.src||""};r.Wa=function(a){return a!==e?(H(this,"setPreload",a),this.options.preload=a,this):G(this,"preload")};
|
||||
r.autoplay=function(a){return a!==e?(H(this,"setAutoplay",a),this.options.autoplay=a,this):G(this,"autoplay")};r.loop=function(a){return a!==e?(H(this,"setLoop",a),this.options.loop=a,this):G(this,"loop")};r.controls=function(){return this.options.controls};r.poster=function(){return G(this,"poster")};r.error=function(){return G(this,"error")};var K,L,M,N;
|
||||
if(document.Wc!==e)K="requestFullscreen",L="exitFullscreen",M="fullscreenchange",N="fullScreen";else for(var O=["moz","webkit"],P=O.length-1;0<=P;P--){var Q=O[P];if(("moz"!=Q||document.mozFullScreenEnabled)&&document[Q+"CancelFullScreen"]!==e)K=Q+"RequestFullScreen",L=Q+"CancelFullScreen",M=Q+"fullscreenchange",N="webkit"==Q?Q+"IsFullScreen":Q+"FullScreen"}K&&(vjs.Cb.Za={Fc:K,nc:L,ha:M,U:N});
|
||||
vjs.Db=function(a,b,c){vjs.c.call(this,a,b,c);if(!a.options.sources||0===a.options.sources.length){b=0;for(c=a.options.techOrder;b<c.length;b++){var d=vjs.T(c[b]),f=window.videojs[d];if(f&&f.isSupported()){C(a,d);break}}}else a.src(a.options.sources)};v(vjs.Db,vjs.c);vjs.J=function(a,b,c){vjs.c.call(this,a,b,c)};v(vjs.J,vjs.c);vjs.J.prototype.m=function(){this.a.options.controls&&(this.a.paused()?this.a.play():this.a.pause())};vjs.media={};vjs.media.bb="play pause paused currentTime setCurrentTime duration buffered volume setVolume muted setMuted width height supportsFullScreen enterFullScreen src load currentSrc preload setPreload autoplay setAutoplay loop setLoop error networkState readyState seeking initialTime startOffsetTime played seekable ended videoTracks audioTracks videoWidth videoHeight textTracks defaultPlaybackRate playbackRate mediaGroup controller controls defaultMuted".split(" ");
|
||||
function ea(){var a=vjs.media.bb[i];return function(){throw Error('The "'+a+"\" method is not available on the playback technology's API");}}for(var i=vjs.media.bb.length-1;0<=i;i--)vjs.J.prototype[vjs.media.bb[i]]=ea();vjs.h=function(a,b,c){vjs.J.call(this,a,b,c);(b=b.source)&&this.b.currentSrc==b.src?a.i("loadstart"):b&&(this.b.src=b.src);a.P(function(){this.options.autoplay&&this.paused()&&(this.I.poster=h,this.play())});this.e("click",this.m);for(a=vjs.h.Z.length-1;0<=a;a--)vjs.e(this.b,vjs.h.Z[a],vjs.bind(this.a,this.Lb));z(this)};v(vjs.h,vjs.J);r=vjs.h.prototype;r.D=function(){for(var a=vjs.h.Z.length-1;0<=a;a--)vjs.o(this.b,vjs.h.Z[a],vjs.bind(this.a,this.Lb));vjs.h.f.D.call(this)};
|
||||
r.d=function(){var a=this.a,b=a.I;if(!b||this.G.yc===k)b&&a.j().removeChild(b),b=vjs.createElement("video",{id:b.id||a.id+"_html5_api",className:b.className||"vjs-tech"}),vjs.rb(b,a.j);for(var c=["autoplay","preload","loop","muted"],d=c.length-1;0<=d;d--){var f=c[d];a.options[f]!==h&&(b[f]=a.options[f])}return b};r.Lb=function(a){this.i(a);a.stopPropagation()};r.play=function(){this.b.play()};r.pause=function(){this.b.pause()};r.paused=function(){return this.b.paused};r.currentTime=function(){return this.b.currentTime};
|
||||
r.Ic=function(a){try{this.b.currentTime=a}catch(b){vjs.log(b,"Video is not ready. (Video.js)")}};r.duration=function(){return this.b.duration||0};r.buffered=function(){return this.b.buffered};r.volume=function(){return this.b.volume};r.Nc=function(a){this.b.volume=a};r.muted=function(){return this.b.muted};r.Lc=function(a){this.b.muted=a};r.width=function(){return this.b.offsetWidth};r.height=function(){return this.b.offsetHeight};
|
||||
r.ab=function(){return"function"==typeof this.b.webkitEnterFullScreen&&!navigator.userAgent.match("Chrome")&&!navigator.userAgent.match("Mac OS X 10.5")?g:k};r.src=function(a){this.b.src=a};r.load=function(){this.b.load()};r.currentSrc=function(){return this.b.currentSrc};r.Wa=function(){return this.b.Wa};r.Mc=function(a){this.b.Wa=a};r.autoplay=function(){return this.b.autoplay};r.Hc=function(a){this.b.autoplay=a};r.loop=function(){return this.b.loop};r.Kc=function(a){this.b.loop=a};r.error=function(){return this.b.error};
|
||||
r.controls=function(){return this.a.options.controls};vjs.h.isSupported=function(){return!!document.createElement("video").canPlayType};vjs.h.ib=function(a){return!!document.createElement("video").canPlayType(a.type)};vjs.h.Z="loadstart suspend abort error emptied stalled loadedmetadata loadeddata canplay canplaythrough playing waiting seeking seeked ended durationchange timeupdate progress play pause ratechange volumechange".split(" ");
|
||||
vjs.h.prototype.G={ad:vjs.kc.webkitEnterFullScreen?!vjs.Ja.match("Chrome")&&!vjs.Ja.match("Mac OS X 10.5")?g:k:k,yc:!vjs.gc};vjs.ec&&3>vjs.dc&&(document.createElement("video").constructor.prototype.canPlayType=function(a){return a&&-1!=a.toLowerCase().indexOf("video/mp4")?"maybe":""});vjs.g=function(a,b,c){vjs.J.call(this,a,b,c);c=b.source;var d=b.Dc,f=this.b=vjs.d("div",{id:a.id()+"_temp_flash"}),l=a.id()+"_flash_api";a=a.options;var j=vjs.s({readyFunction:"videojs.Flash.onReady",eventProxyFunction:"videojs.Flash.onEvent",errorEventProxyFunction:"videojs.Flash.onError",autoplay:a.autoplay,preload:a.Wa,loop:a.loop,muted:a.muted},b.flashVars),p=vjs.s({wmode:"opaque",bgcolor:"#000000"},b.params),m=vjs.s({id:l,name:l,"class":"vjs-tech"},b.attributes);c&&(j.src=encodeURIComponent(vjs.Pb(c.src)));
|
||||
vjs.rb(f,d);b.startTime&&this.P(function(){this.load();this.play();this.currentTime(b.startTime)});if(b.ed===g&&!vjs.fc){var s=vjs.d("iframe",{id:l+"_iframe",name:l+"_iframe",className:"vjs-tech",scrolling:"no",marginWidth:0,marginHeight:0,frameBorder:0});j.readyFunction="ready";j.eventProxyFunction="events";j.errorEventProxyFunction="errors";vjs.e(s,"load",vjs.bind(this,function(){var a,c=s.contentWindow;a=s.contentDocument?s.contentDocument:s.contentWindow.document;a.write(vjs.g.Qb(b.swf,j,p,m));
|
||||
c.a=this.a;c.P=vjs.bind(this.a,function(b){b=a.getElementById(b);var c=this.k;c.j=b;vjs.e(b,"click",c.bind(c.m));vjs.g.jb(c)});c.$c=vjs.bind(this.a,function(a,b){this&&"flash"===this.V&&this.i(b)});c.Zc=vjs.bind(this.a,function(a,b){vjs.log("Flash Error",b)})}));f.parentNode.replaceChild(s,f)}else vjs.g.rc(b.swf,f,j,p,m)};v(vjs.g,vjs.J);r=vjs.g.prototype;r.D=function(){vjs.g.f.D.call(this)};r.play=function(){this.b.vjs_play()};r.pause=function(){this.b.vjs_pause()};
|
||||
r.src=function(a){a=vjs.Pb(a);this.b.vjs_src(a);if(this.a.autoplay()){var b=this;setTimeout(function(){b.play()},0)}};r.load=function(){this.b.vjs_load()};r.poster=function(){this.b.vjs_getProperty("poster")};r.buffered=function(){return vjs.Jb(this.b.vjs_getProperty("buffered"))};r.ab=q(k);var R=vjs.g.prototype,S="preload currentTime defaultPlaybackRate playbackRate autoplay loop mediaGroup controller controls volume muted defaultMuted".split(" "),T="error currentSrc networkState readyState seeking initialTime duration startOffsetTime paused played seekable ended videoTracks audioTracks videoWidth videoHeight textTracks".split(" ");
|
||||
function fa(){var a=S[i],b=a.charAt(0).toUpperCase()+a.slice(1);R["set"+b]=function(b){return this.b.vjs_setProperty(a,b)}}function U(a){R[a]=function(){return this.b.vjs_getProperty(a)}}for(i=0;i<S.length;i++)U(S[i]),fa();for(i=0;i<T.length;i++)U(T[i]);vjs.g.isSupported=function(){return 10<=vjs.g.version()[0]};vjs.g.ib=function(a){if(a.type in vjs.g.prototype.G.tc)return"maybe"};vjs.g.prototype.G={tc:{"video/flv":"FLV","video/x-flv":"FLV","video/mp4":"MP4","video/m4v":"MP4"},Wb:k,bc:k,Ob:k,hd:!vjs.Ja.match("Firefox")};
|
||||
vjs.g.onReady=function(a){a=vjs.j(a);var b=a.a||a.parentNode.a,c=b.k;a.a=b;c.b=a;c.e("click",c.m);vjs.g.jb(c)};vjs.g.jb=function(a){a.j().vjs_getProperty?z(a):setTimeout(function(){vjs.g.jb(a)},50)};vjs.g.onEvent=function(a,b){vjs.j(a).a.i(b)};vjs.g.onError=function(a,b){vjs.j(a).a.i("error");vjs.log("Flash Error",b,a)};
|
||||
vjs.g.version=function(){var a="0,0,0";try{a=(new window.ActiveXObject("ShockwaveFlash.ShockwaveFlash")).GetVariable("$version").replace(/\D+/g,",").match(/^,?(.+),?$/)[1]}catch(b){try{navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin&&(a=(navigator.plugins["Shockwave Flash 2.0"]||navigator.plugins["Shockwave Flash"]).description.replace(/\D+/g,",").match(/^,?(.+),?$/)[1])}catch(c){}}return a.split(",")};
|
||||
vjs.g.rc=function(a,b,c,d,f){a=vjs.g.Qb(a,c,d,f);a=vjs.d("div",{innerHTML:a}).childNodes[0];c=b.parentNode;b.parentNode.replaceChild(a,b);var l=c.childNodes[0];setTimeout(function(){l.style.display="block"},1E3)};
|
||||
vjs.g.Qb=function(a,b,c,d){var f="",l="",j="";b&&vjs.Oa(b,function(a,b){f+=a+"="+b+"&"});c=vjs.s({movie:a,flashvars:f,allowScriptAccess:"always",allowNetworking:"all"},c);vjs.Oa(c,function(a,b){l+='<param name="'+a+'" value="'+b+'" />'});d=vjs.s({data:a,width:"100%",height:"100%"},d);vjs.Oa(d,function(a,b){j+=a+'="'+b+'" '});return'<object type="application/x-shockwave-flash"'+j+">"+l+"</object>"};vjs.Y=function(a,b){vjs.c.call(this,a,b)};v(vjs.Y,vjs.c);vjs.Y.prototype.v=function(){return"vjs-control "+vjs.Y.f.v.call(this)};vjs.Q=function(a,b){vjs.c.call(this,a,b);a.H("play",vjs.bind(this,function(){this.Pa();this.a.e("mouseover",vjs.bind(this,this.Pa));this.a.e("mouseout",vjs.bind(this,this.nb))}))};v(vjs.Q,vjs.c);r=vjs.Q.prototype;
|
||||
r.options={xc:"play",children:{playToggle:{},fullscreenToggle:{},currentTimeDisplay:{},timeDivider:{},durationDisplay:{},remainingTimeDisplay:{},progressControl:{},volumeControl:{},muteToggle:{}}};r.d=function(){return vjs.d("div",{className:"vjs-control-bar"})};r.Pa=function(){vjs.Q.f.Pa.call(this);this.a.i("controlsvisible")};r.nb=function(){vjs.Q.f.nb.call(this);this.a.i("controlshidden")};r.Ub=function(){this.b.style.opacity="1"};
|
||||
vjs.l=function(a,b){vjs.Y.call(this,a,b);this.e("click",this.m);this.e("focus",this.Sa);this.e("blur",this.Ra)};v(vjs.l,vjs.Y);r=vjs.l.prototype;r.d=function(a,b){b=vjs.s({className:this.v(),innerHTML:'<div><span class="vjs-control-text">'+(this.S||"Need Text")+"</span></div>",Gc:"button",tabIndex:0},b);return vjs.l.f.d.call(this,a,b)};r.m=function(){};r.Sa=function(){vjs.e(document,"keyup",vjs.bind(this,this.Ba))};r.Ba=function(a){if(32==a.which||13==a.which)a.preventDefault(),this.m()};
|
||||
r.Ra=function(){vjs.o(document,"keyup",vjs.bind(this,this.Ba))};vjs.da=function(a,b){vjs.l.call(this,a,b)};v(vjs.da,vjs.l);vjs.da.prototype.S="Play";vjs.da.prototype.v=function(){return"vjs-play-button "+vjs.da.f.v.call(this)};vjs.da.prototype.m=function(){this.a.play()};vjs.ca=function(a,b){vjs.l.call(this,a,b)};v(vjs.ca,vjs.l);vjs.ca.prototype.S="Play";vjs.ca.prototype.v=function(){return"vjs-pause-button "+vjs.ca.f.v.call(this)};vjs.ca.prototype.m=function(){this.a.pause()};
|
||||
vjs.Fa=function(a,b){vjs.l.call(this,a,b);a.e("play",vjs.bind(this,this.Ab));a.e("pause",vjs.bind(this,this.zb))};v(vjs.Fa,vjs.l);r=vjs.Fa.prototype;r.S="Play";r.v=function(){return"vjs-play-control "+vjs.Fa.f.v.call(this)};r.m=function(){this.a.paused()?this.a.play():this.a.pause()};r.Ab=function(){vjs.z(this.b,"vjs-paused");vjs.u(this.b,"vjs-playing")};r.zb=function(){vjs.z(this.b,"vjs-playing");vjs.u(this.b,"vjs-paused")};vjs.$=function(a,b){vjs.l.call(this,a,b)};v(vjs.$,vjs.l);
|
||||
vjs.$.prototype.S="Fullscreen";vjs.$.prototype.v=function(){return"vjs-fullscreen-control "+vjs.$.f.v.call(this)};vjs.$.prototype.m=function(){this.a.U?I(this.a):this.a.Za()};vjs.X=function(a,b){vjs.l.call(this,a,b);a.e("play",vjs.bind(this,this.w));a.e("ended",vjs.bind(this,this.show))};v(vjs.X,vjs.l);vjs.X.prototype.d=function(){return vjs.X.f.d.call(this,"div",{className:"vjs-big-play-button",innerHTML:"<span></span>"})};
|
||||
vjs.X.prototype.m=function(){this.a.currentTime()&&this.a.currentTime(0);this.a.play()};vjs.ra=function(a,b){vjs.c.call(this,a,b);a.e("canplay",vjs.bind(this,this.w));a.e("canplaythrough",vjs.bind(this,this.w));a.e("playing",vjs.bind(this,this.w));a.e("seeked",vjs.bind(this,this.w));a.e("seeking",vjs.bind(this,this.show));a.e("seeked",vjs.bind(this,this.w));a.e("error",vjs.bind(this,this.show));a.e("waiting",vjs.bind(this,this.show))};v(vjs.ra,vjs.c);
|
||||
vjs.ra.prototype.d=function(){var a,b;"string"==typeof this.a.j().style.WebkitBorderRadius||"string"==typeof this.a.j().style.MozBorderRadius||"string"==typeof this.a.j().style.Uc||"string"==typeof this.a.j().style.Vc?(a="vjs-loading-spinner",b='<div class="ball1"></div><div class="ball2"></div><div class="ball3"></div><div class="ball4"></div><div class="ball5"></div><div class="ball6"></div><div class="ball7"></div><div class="ball8"></div>'):(a="vjs-loading-spinner-fallback",b="");return vjs.ra.f.d.call(this,
|
||||
"div",{className:a,innerHTML:b})};vjs.oa=function(a,b){vjs.c.call(this,a,b);a.e("timeupdate",vjs.bind(this,this.Da))};v(vjs.oa,vjs.c);vjs.oa.prototype.d=function(){var a=vjs.oa.f.d.call(this,"div",{className:"vjs-current-time vjs-time-controls vjs-control"});this.content=vjs.d("div",{className:"vjs-current-time-display",innerHTML:"0:00"});a.appendChild(vjs.d("div").appendChild(this.content));return a};
|
||||
vjs.oa.prototype.Da=function(){var a=this.a.Yb?this.a.n.currentTime:this.a.currentTime();this.content.innerHTML=vjs.pb(a,this.a.duration())};vjs.pa=function(a,b){vjs.c.call(this,a,b);a.e("timeupdate",vjs.bind(this,this.Da))};v(vjs.pa,vjs.c);vjs.pa.prototype.d=function(){var a=vjs.pa.f.d.call(this,"div",{className:"vjs-duration vjs-time-controls vjs-control"});this.content=vjs.d("div",{className:"vjs-duration-display",innerHTML:"0:00"});a.appendChild(vjs.d("div").appendChild(this.content));return a};
|
||||
vjs.pa.prototype.Da=function(){this.a.duration()&&(this.content.innerHTML=vjs.pb(this.a.duration()))};vjs.Ia=function(a,b){vjs.c.call(this,a,b)};v(vjs.Ia,vjs.c);vjs.Ia.prototype.d=function(){return vjs.Ia.f.d.call(this,"div",{className:"vjs-time-divider",innerHTML:"<div><span>/</span></div>"})};vjs.va=function(a,b){vjs.c.call(this,a,b);a.e("timeupdate",vjs.bind(this,this.Da))};v(vjs.va,vjs.c);
|
||||
vjs.va.prototype.d=function(){var a=vjs.va.f.d.call(this,"div",{className:"vjs-remaining-time vjs-time-controls vjs-control"});this.content=vjs.d("div",{className:"vjs-remaining-time-display",innerHTML:"-0:00"});a.appendChild(vjs.d("div").appendChild(this.content));return a};vjs.va.prototype.Da=function(){this.a.duration()&&(this.content.innerHTML="-"+vjs.pb(this.a.duration()-this.a.currentTime()))};
|
||||
vjs.K=function(a,b){vjs.c.call(this,a,b);this.lc=this.M[this.options.barName];this.handle=this.M[this.options.handleName];a.e(this.Vb,vjs.bind(this,this.update));this.e("mousedown",this.yb);this.e("focus",this.Sa);this.e("blur",this.Ra);this.a.e("controlsvisible",vjs.bind(this,this.update));a.P(vjs.bind(this,this.update))};v(vjs.K,vjs.c);r=vjs.K.prototype;r.d=function(a,b){b=vjs.s({Gc:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100,tabIndex:0},b);return vjs.K.f.d.call(this,a,b)};
|
||||
r.yb=function(a){a.preventDefault();vjs.mc();vjs.e(document,"mousemove",vjs.bind(this,this.Ta));vjs.e(document,"mouseup",vjs.bind(this,this.Ua));this.Ta(a)};r.Ua=function(){vjs.Oc();vjs.o(document,"mousemove",this.Ta,k);vjs.o(document,"mouseup",this.Ua,k);this.update()};
|
||||
r.update=function(){var a,b=this.Rb(),c=this.handle,d=this.lc;isNaN(b)&&(b=0);a=b;if(c){a=this.b.offsetWidth;var f=c.j().offsetWidth;a=f?f/a:0;b*=1-a;a=b+a/2;c.j().style.left=vjs.round(100*b,2)+"%"}d.j().style.width=vjs.round(100*a,2)+"%"};function V(a,b){var c=a.b,d=vjs.sc(c),c=c.offsetWidth,f=a.handle;f&&(f=f.j().offsetWidth,d+=f/2,c-=f);return Math.max(0,Math.min(1,(b.pageX-d)/c))}r.Sa=function(){vjs.e(document,"keyup",vjs.bind(this,this.Ba))};
|
||||
r.Ba=function(a){37==a.which?(a.preventDefault(),this.$b()):39==a.which&&(a.preventDefault(),this.ac())};r.Ra=function(){vjs.o(document,"keyup",vjs.bind(this,this.Ba))};vjs.ua=function(a,b){vjs.c.call(this,a,b)};v(vjs.ua,vjs.c);vjs.ua.prototype.options={children:{seekBar:{}}};vjs.ua.prototype.d=function(){return vjs.ua.f.d.call(this,"div",{className:"vjs-progress-control vjs-control"})};vjs.fa=function(a,b){vjs.K.call(this,a,b)};v(vjs.fa,vjs.K);r=vjs.fa.prototype;
|
||||
r.options={children:{loadProgressBar:{},playProgressBar:{},seekHandle:{}},barName:"playProgressBar",handleName:"seekHandle"};r.Vb="timeupdate";r.d=function(){return vjs.fa.f.d.call(this,"div",{className:"vjs-progress-holder"})};r.Rb=function(){return this.a.currentTime()/this.a.duration()};r.yb=function(a){vjs.fa.f.yb.call(this,a);this.a.Yb=g;this.Pc=!this.a.paused();this.a.pause()};r.Ta=function(a){a=V(this,a)*this.a.duration();a==this.a.duration()&&(a-=0.1);this.a.currentTime(a)};
|
||||
r.Ua=function(a){vjs.fa.f.Ua.call(this,a);this.a.Yb=k;this.Pc&&this.a.play()};r.ac=function(){this.a.currentTime(this.a.currentTime()+1)};r.$b=function(){this.a.currentTime(this.a.currentTime()-1)};vjs.qa=function(a,b){vjs.c.call(this,a,b);a.e("progress",vjs.bind(this,this.update))};v(vjs.qa,vjs.c);vjs.qa.prototype.d=function(){return vjs.qa.f.d.call(this,"div",{className:"vjs-load-progress",innerHTML:'<span class="vjs-control-text">Loaded: 0%</span>'})};
|
||||
vjs.qa.prototype.update=function(){this.b.style&&(this.b.style.width=vjs.round(100*E(this.a),2)+"%")};vjs.Ea=function(a,b){vjs.c.call(this,a,b)};v(vjs.Ea,vjs.c);vjs.Ea.prototype.d=function(){return vjs.Ea.f.d.call(this,"div",{className:"vjs-play-progress",innerHTML:'<span class="vjs-control-text">Progress: 0%</span>'})};vjs.Ga=function(a,b){vjs.c.call(this,a,b)};v(vjs.Ga,vjs.c);vjs.Ga.prototype.d=function(){return vjs.Ga.f.d.call(this,"div",{className:"vjs-seek-handle",innerHTML:'<span class="vjs-control-text">00:00</span>'})};
|
||||
vjs.xa=function(a,b){vjs.c.call(this,a,b)};v(vjs.xa,vjs.c);vjs.xa.prototype.options={children:{volumeBar:{}}};vjs.xa.prototype.d=function(){return vjs.xa.f.d.call(this,"div",{className:"vjs-volume-control vjs-control"})};vjs.Ka=function(a,b){vjs.K.call(this,a,b)};v(vjs.Ka,vjs.K);r=vjs.Ka.prototype;r.options={children:{volumeLevel:{},volumeHandle:{}},barName:"volumeLevel",handleName:"volumeHandle"};r.Vb="volumechange";r.d=function(){return vjs.Ka.f.d.call(this,"div",{className:"vjs-volume-bar"})};
|
||||
r.Ta=function(a){this.a.volume(V(this,a))};r.Rb=function(){return this.a.volume()};r.ac=function(){this.a.volume(this.a.volume()+0.1)};r.$b=function(){this.a.volume(this.a.volume()-0.1)};vjs.Ma=function(a,b){vjs.c.call(this,a,b)};v(vjs.Ma,vjs.c);vjs.Ma.prototype.d=function(){return vjs.Ma.f.d.call(this,"div",{className:"vjs-volume-level",innerHTML:'<span class="vjs-control-text"></span>'})};vjs.La=function(a,b){vjs.c.call(this,a,b)};v(vjs.La,vjs.c);
|
||||
vjs.La.prototype.d=function(){return vjs.La.f.d.call(this,"div",{className:"vjs-volume-handle",innerHTML:'<span class="vjs-control-text"></span>'})};vjs.ba=function(a,b){vjs.l.call(this,a,b);a.e("volumechange",vjs.bind(this,this.update))};v(vjs.ba,vjs.l);vjs.ba.prototype.d=function(){return vjs.ba.f.d.call(this,"div",{className:"vjs-mute-control vjs-control",innerHTML:'<div><span class="vjs-control-text">Mute</span></div>'})};vjs.ba.prototype.m=function(){this.a.muted(this.a.muted()?k:g)};
|
||||
vjs.ba.prototype.update=function(){var a=this.a.volume(),b=3;0===a||this.a.muted()?b=0:0.33>a?b=1:0.67>a&&(b=2);for(a=0;4>a;a++)vjs.z(this.b,"vjs-vol-"+a);vjs.u(this.b,"vjs-vol-"+b)};vjs.ta=function(a,b){vjs.l.call(this,a,b);this.a.options.poster||this.w();a.e("play",vjs.bind(this,this.w))};v(vjs.ta,vjs.l);vjs.ta.prototype.d=function(){var a=vjs.d("img",{className:"vjs-poster",tabIndex:-1});this.a.options.poster&&(a.src=this.a.options.poster);return a};vjs.ta.prototype.m=function(){this.a.play()};
|
||||
vjs.aa=function(a,b){vjs.c.call(this,a,b)};v(vjs.aa,vjs.c);function W(a,b){a.R(b);b.e("click",vjs.bind(a,function(){A(this)}))}vjs.aa.prototype.d=function(){return vjs.aa.f.d.call(this,"ul",{className:"vjs-menu"})};vjs.B=function(a,b){vjs.l.call(this,a,b);b.selected&&this.u("vjs-selected")};v(vjs.B,vjs.l);vjs.B.prototype.d=function(a,b){return vjs.B.f.d.call(this,"li",vjs.s({className:"vjs-menu-item",innerHTML:this.options.label},b))};vjs.B.prototype.m=function(){this.selected(g)};
|
||||
vjs.B.prototype.selected=function(a){a?this.u("vjs-selected"):this.z("vjs-selected")};function X(a){a.Ca=a.Ca||[];return a.Ca}function Y(a,b,c){for(var d=a.Ca,f=0,l=d.length,j,p;f<l;f++)j=d[f],j.id()===b?(j.show(),p=j):c&&(j.A()==c&&0<j.mode())&&j.disable();(b=p?p.A():c?c:k)&&a.i(b+"trackchange")}vjs.t=function(a,b){vjs.c.call(this,a,b);this.O=b.id||"vjs_"+b.kind+"_"+b.language+"_"+vjs.p++;this.Zb=b.src;this.oc=b["default"]||b.dflt;this.kd=b.title;this.fd=b.srclang;this.wc=b.label;this.ga=[];this.Eb=[];this.ka=this.la=0};v(vjs.t,vjs.c);r=vjs.t.prototype;r.A=n("r");r.src=n("Zb");
|
||||
r.mb=n("oc");r.label=n("wc");r.readyState=n("la");r.mode=n("ka");r.d=function(){return vjs.t.f.d.call(this,"div",{className:"vjs-"+this.r+" vjs-text-track"})};r.show=function(){Z(this);this.ka=2;vjs.t.f.show.call(this)};r.w=function(){Z(this);this.ka=1;vjs.t.f.w.call(this)};r.disable=function(){2==this.ka&&this.w();this.a.o("timeupdate",vjs.bind(this,this.update,this.O));this.a.o("ended",vjs.bind(this,this.reset,this.O));this.reset();this.a.M.textTrackDisplay.removeChild(this);this.ka=0};
|
||||
function Z(a){0===a.la&&a.load();0===a.ka&&(a.a.e("timeupdate",vjs.bind(a,a.update,a.O)),a.a.e("ended",vjs.bind(a,a.reset,a.O)),("captions"===a.r||"subtitles"===a.r)&&a.a.M.textTrackDisplay.R(a))}r.load=function(){0===this.la&&(this.la=1,vjs.get(this.Zb,vjs.bind(this,this.Ec),vjs.bind(this,this.xb)))};r.xb=function(a){this.error=a;this.la=3;this.i("error")};
|
||||
r.Ec=function(a){var b,c;a=a.split("\n");for(var d="",f=1,l=a.length;f<l;f++)if(d=vjs.trim(a[f])){-1==d.indexOf("--\x3e")?(b=d,d=vjs.trim(a[++f])):b=this.ga.length;b={id:b,index:this.ga.length};c=d.split(" --\x3e ");b.startTime=ga(c[0]);b.za=ga(c[1]);for(c=[];a[++f]&&(d=vjs.trim(a[f]));)c.push(d);b.text=c.join("<br/>");this.ga.push(b)}this.la=2;this.i("loaded")};
|
||||
function ga(a){var b=a.split(":");a=0;var c,d,f;3==b.length?(c=b[0],d=b[1],b=b[2]):(c=0,d=b[0],b=b[1]);b=b.split(/\s+/);b=b.splice(0,1)[0];b=b.split(/\.|,/);f=parseFloat(b[1]);b=b[0];a+=3600*parseFloat(c);a+=60*parseFloat(d);a+=parseFloat(b);f&&(a+=f/1E3);return a}
|
||||
r.update=function(){if(0<this.ga.length){var a=this.a.currentTime();if(this.Bb===e||a<this.Bb||this.Qa<=a){var b=this.ga,c=this.a.duration(),d=0,f=k,l=[],j,p,m,s;a>=this.Qa||this.Qa===e?s=this.ob!==e?this.ob:0:(f=g,s=this.ub!==e?this.ub:b.length-1);for(;;){m=b[s];if(m.za<=a)d=Math.max(d,m.za),m.Na&&(m.Na=k);else if(a<m.startTime){if(c=Math.min(c,m.startTime),m.Na&&(m.Na=k),!f)break}else f?(l.splice(0,0,m),p===e&&(p=s),j=s):(l.push(m),j===e&&(j=s),p=s),c=Math.min(c,m.za),d=Math.max(d,m.startTime),
|
||||
m.Na=g;if(f)if(0===s)break;else s--;else if(s===b.length-1)break;else s++}this.Eb=l;this.Qa=c;this.Bb=d;this.ob=j;this.ub=p;a=this.Eb;b="";c=0;for(d=a.length;c<d;c++)b+='<span class="vjs-tt-cue">'+a[c].text+"</span>";this.b.innerHTML=b;this.i("cuechange")}}};r.reset=function(){this.Qa=0;this.Bb=this.a.duration();this.ub=this.ob=0};vjs.cb=function(a,b){vjs.t.call(this,a,b)};v(vjs.cb,vjs.t);vjs.cb.prototype.r="captions";vjs.gb=function(a,b){vjs.t.call(this,a,b)};v(vjs.gb,vjs.t);vjs.gb.prototype.r="subtitles";
|
||||
vjs.fb=function(a,b){vjs.t.call(this,a,b)};v(vjs.fb,vjs.t);vjs.fb.prototype.r="chapters";vjs.Ha=function(a,b,c){vjs.c.call(this,a,b,c);if(a.options.tracks&&0<a.options.tracks.length){b=this.a;a=a.options.tracks;var d;for(c=0;c<a.length;c++){d=a[c];var f=b,l=d.kind,j=d.label,p=d.language,m=d;d=f.Ca=f.Ca||[];m=m||{};m.kind=l;m.label=j;m.language=p;l=vjs.T(l||"subtitles");f=new window.videojs[l+"Track"](f,m);d.push(f)}}};v(vjs.Ha,vjs.c);
|
||||
vjs.Ha.prototype.d=function(){return vjs.Ha.f.d.call(this,"div",{className:"vjs-text-track-display"})};vjs.L=function(a,b){var c=this.W=b.track;b.label=c.label();b.selected=c.mb();vjs.B.call(this,a,b);this.a.e(c.A()+"trackchange",vjs.bind(this,this.update))};v(vjs.L,vjs.B);vjs.L.prototype.m=function(){vjs.L.f.m.call(this);Y(this.a,this.W.id(),this.W.A())};vjs.L.prototype.update=function(){2==this.W.mode()?this.selected(g):this.selected(k)};
|
||||
vjs.sa=function(a,b){b.track={A:function(){return b.kind},a:a,label:q("Off"),mb:q(k),mode:q(k)};vjs.L.call(this,a,b)};v(vjs.sa,vjs.L);vjs.sa.prototype.m=function(){vjs.sa.f.m.call(this);Y(this.a,this.W.id(),this.W.A())};vjs.sa.prototype.update=function(){for(var a=X(this.a),b=0,c=a.length,d,f=g;b<c;b++)d=a[b],d.A()==this.W.A()&&2==d.mode()&&(f=k);f?this.selected(g):this.selected(k)};vjs.F=function(a,b){vjs.l.call(this,a,b);this.ja=this.lb();0===this.Aa.length&&this.w()};v(vjs.F,vjs.l);r=vjs.F.prototype;
|
||||
r.lb=function(){var a=new vjs.aa(this.a);a.j().appendChild(vjs.d("li",{className:"vjs-menu-title",innerHTML:vjs.T(this.r)}));W(a,new vjs.sa(this.a,{kind:this.r}));this.Aa=this.Ib();for(var b=0;b<this.Aa.length;b++)W(a,this.Aa[b]);this.R(a);return a};r.Ib=function(){for(var a=[],b,c=0;c<X(this.a).length;c++)b=X(this.a)[c],b.A()===this.r&&a.push(new vjs.L(this.a,{track:b}));return a};r.v=function(){return this.className+" vjs-menu-button "+vjs.F.f.v.call(this)};
|
||||
r.Sa=function(){this.ja.Ub();vjs.H(this.ja.b.childNodes[this.ja.b.childNodes.length-1],"blur",vjs.bind(this,function(){A(this.ja)}))};r.Ra=function(){};r.m=function(){this.H("mouseout",vjs.bind(this,function(){A(this.ja);this.b.blur()}))};vjs.ma=function(a,b){vjs.F.call(this,a,b)};v(vjs.ma,vjs.F);vjs.ma.prototype.r="captions";vjs.ma.prototype.S="Captions";vjs.ma.prototype.className="vjs-captions-button";vjs.wa=function(a,b){vjs.F.call(this,a,b)};v(vjs.wa,vjs.F);vjs.wa.prototype.r="subtitles";
|
||||
vjs.wa.prototype.S="Subtitles";vjs.wa.prototype.className="vjs-subtitles-button";vjs.eb=function(a,b){vjs.F.call(this,a,b)};v(vjs.eb,vjs.F);r=vjs.eb.prototype;r.r="chapters";r.S="Chapters";r.className="vjs-chapters-button";r.Ib=function(){for(var a=[],b,c=0;c<X(this.a).length;c++)b=X(this.a)[c],b.A()===this.r&&a.push(new vjs.L(this.a,{track:b}));return a};
|
||||
r.lb=function(){for(var a=X(this.a),b=0,c=a.length,d,f,l=this.Aa=[];b<c;b++)if(d=a[b],d.A()==this.r&&d.mb()){if(2>d.readyState()){this.Xc=d;d.e("loaded",vjs.bind(this,this.lb));return}f=d;break}a=this.ja=new vjs.aa(this.a);a.b.appendChild(vjs.d("li",{className:"vjs-menu-title",innerHTML:vjs.T(this.r)}));if(f){d=f.ga;for(var j,b=0,c=d.length;b<c;b++)j=d[b],j=new vjs.na(this.a,{track:f,cue:j}),l.push(j),a.R(j)}this.R(a);0<this.Aa.length&&this.show();return a};
|
||||
vjs.na=function(a,b){var c=this.W=b.track,d=this.cue=b.cue,f=a.currentTime();b.label=d.text;b.selected=d.startTime<=f&&f<d.za;vjs.B.call(this,a,b);c.e("cuechange",vjs.bind(this,this.update))};v(vjs.na,vjs.B);vjs.na.prototype.m=function(){vjs.na.f.m.call(this);this.a.currentTime(this.cue.startTime);this.update(this.cue.startTime)};vjs.na.prototype.update=function(){var a=this.cue,b=this.a.currentTime();a.startTime<=b&&b<a.za?this.selected(g):this.selected(k)};
|
||||
vjs.s(vjs.Q.prototype.options.children,{subtitlesButton:{},captionsButton:{},chaptersButton:{}});vjs.Fb=function(){var a,b,c=document.getElementsByTagName("video");if(c&&0<c.length)for(var d=0,f=c.length;d<f;d++)if((b=c[d])&&b.getAttribute)b.a===e&&(a=b.getAttribute("data-setup"),a!==h&&(a=vjs.JSON.parse(a||"{}"),aa(b,a)));else{vjs.Gb();break}else vjs.Rc||vjs.Gb()};vjs.Gb=function(){setTimeout(vjs.Fb,1)};vjs.H(window,"load",function(){vjs.Rc=g});vjs.Fb();if(JSON&&"function"===JSON.parse)vjs.JSON=JSON;else{vjs.JSON={};var $=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;vjs.JSON.parse=function(a,b){function c(a,d){var j,p,m=a[d];if(m&&"object"===typeof m)for(j in m)Object.prototype.hasOwnProperty.call(m,j)&&(p=c(m,j),p!==e?m[j]=p:delete m[j]);return b.call(a,d,m)}var d;a=String(a);$.lastIndex=0;$.test(a)&&(a=a.replace($,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)}));
|
||||
if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return d=eval("("+a+")"),"function"===typeof b?c({"":d},""):d;throw new SyntaxError("JSON.parse");}};u("videojs",vjs);u("_V_",vjs);u("videojs.options",vjs.options);u("videojs.cache",vjs.ya);u("videojs.Component",vjs.c);vjs.c.prototype.dispose=vjs.c.prototype.D;vjs.c.prototype.createEl=vjs.c.prototype.d;vjs.c.prototype.getEl=vjs.c.prototype.dd;vjs.c.prototype.addChild=vjs.c.prototype.R;vjs.c.prototype.getChildren=vjs.c.prototype.bd;vjs.c.prototype.on=vjs.c.prototype.e;vjs.c.prototype.off=vjs.c.prototype.o;vjs.c.prototype.one=vjs.c.prototype.H;vjs.c.prototype.trigger=vjs.c.prototype.i;
|
||||
vjs.c.prototype.show=vjs.c.prototype.show;vjs.c.prototype.hide=vjs.c.prototype.w;vjs.c.prototype.width=vjs.c.prototype.width;vjs.c.prototype.height=vjs.c.prototype.height;vjs.c.prototype.dimensions=vjs.c.prototype.pc;u("videojs.Player",vjs.ea);u("videojs.MediaLoader",vjs.Db);u("videojs.PosterImage",vjs.ta);u("videojs.LoadingSpinner",vjs.ra);u("videojs.BigPlayButton",vjs.X);u("videojs.ControlBar",vjs.Q);u("videojs.TextTrackDisplay",vjs.Ha);u("videojs.Control",vjs.Y);u("videojs.ControlBar",vjs.Q);
|
||||
u("videojs.Button",vjs.l);u("videojs.PlayButton",vjs.da);u("videojs.PauseButton",vjs.ca);u("videojs.PlayToggle",vjs.Fa);u("videojs.FullscreenToggle",vjs.$);u("videojs.BigPlayButton",vjs.X);u("videojs.LoadingSpinner",vjs.ra);u("videojs.CurrentTimeDisplay",vjs.oa);u("videojs.DurationDisplay",vjs.pa);u("videojs.TimeDivider",vjs.Ia);u("videojs.RemainingTimeDisplay",vjs.va);u("videojs.Slider",vjs.K);u("videojs.ProgressControl",vjs.ua);u("videojs.SeekBar",vjs.fa);u("videojs.LoadProgressBar",vjs.qa);
|
||||
u("videojs.PlayProgressBar",vjs.Ea);u("videojs.SeekHandle",vjs.Ga);u("videojs.VolumeControl",vjs.xa);u("videojs.VolumeBar",vjs.Ka);u("videojs.VolumeLevel",vjs.Ma);u("videojs.VolumeHandle",vjs.La);u("videojs.MuteToggle",vjs.ba);u("videojs.PosterImage",vjs.ta);u("videojs.Menu",vjs.aa);u("videojs.MenuItem",vjs.B);u("videojs.SubtitlesButton",vjs.wa);u("videojs.CaptionsButton",vjs.ma);u("videojs.ChaptersButton",vjs.eb);u("videojs.MediaTechController",vjs.J);u("videojs.Html5",vjs.h);vjs.h.Events=vjs.h.Z;
|
||||
vjs.h.isSupported=vjs.h.isSupported;vjs.h.canPlaySource=vjs.h.ib;vjs.h.prototype.setCurrentTime=vjs.h.prototype.Ic;vjs.h.prototype.setVolume=vjs.h.prototype.Nc;vjs.h.prototype.setMuted=vjs.h.prototype.Lc;vjs.h.prototype.setPreload=vjs.h.prototype.Mc;vjs.h.prototype.setAutoplay=vjs.h.prototype.Hc;vjs.h.prototype.setLoop=vjs.h.prototype.Kc;u("videojs.Flash",vjs.g);vjs.g.Events=vjs.g.Z;vjs.g.isSupported=vjs.g.isSupported;vjs.g.canPlaySource=vjs.g.ib;vjs.g.onReady=vjs.g.onReady;
|
||||
u("videojs.TextTrack",vjs.t);vjs.t.prototype.label=vjs.t.prototype.label;u("videojs.CaptionsTrack",vjs.cb);u("videojs.SubtitlesTrack",vjs.gb);u("videojs.ChaptersTrack",vjs.fb);})();//@ sourceMappingURL=video.compiled.js.map
|
117
test/video.test.js
Normal file
117
test/video.test.js
Normal file
@ -0,0 +1,117 @@
|
||||
(function() {var c=void 0,f=!0,h=null,j=!1;function k(a){return function(){return this[a]}}function l(a){return function(){return a}}var n,aa=this;aa.$b=f;function s(a,b){var d=a.split("."),e=aa;!(d[0]in e)&&e.execScript&&e.execScript("var "+d[0]);for(var g;d.length&&(g=d.shift());)!d.length&&b!==c?e[g]=b:e=e[g]?e[g]:e[g]={}}function t(a,b){function d(){}d.prototype=b.prototype;a.h=b.prototype;a.prototype=new d;a.prototype.constructor=a};document.createElement("video");document.createElement("audio");function u(a,b,d){if("string"===typeof a){0===a.indexOf("#")&&(a=a.slice(1));if(u.P[a])return u.P[a];a=u.f(a)}if(!a||!a.nodeName)throw new TypeError("The element or ID supplied is not valid. (videojs)");return a.a||new v(a,b,d)}var x=u;
|
||||
u.options={techOrder:["html5","flash"],html5:{},flash:{sc:"http://vjs.zencdn.net/c/video-js.swf"},width:300,height:150,defaultVolume:0,children:{mediaLoader:{},posterImage:{},textTrackDisplay:{},loadingSpinner:{},bigPlayButton:{},controlBar:{}}};u.P={};u.zb={};u.e=function(a,b,d){var e=u.getData(a);e.q||(e.q={});e.q[b]||(e.q[b]=[]);d.p||(d.p=u.p++);e.q[b].push(d);e.J||(e.disabled=j,e.J=function(b){if(!e.disabled){b=u.Ua(b);var d=e.q[b.type];if(d){for(var m=[],r=0,p=d.length;r<p;r++)m[r]=d[r];d=0;for(r=m.length;d<r;d++)m[d].call(a,b)}}});1==e.q[b].length&&(document.addEventListener?a.addEventListener(b,e.J,j):document.attachEvent&&a.attachEvent("on"+b,e.J))};
|
||||
u.j=function(a,b,d){if(u.Ya(a)){var e=u.getData(a);if(e.q)if(b){var g=e.q[b];if(g){if(d){if(d.p)for(e=0;e<g.length;e++)g[e].p===d.p&&g.splice(e--,1)}else e.q[b]=[];u.Qa(a,b)}}else for(g in e.q)b=g,e.q[b]=[],u.Qa(a,b)}};u.Qa=function(a,b){var d=u.getData(a);0===d.q[b].length&&(delete d.q[b],document.removeEventListener?a.removeEventListener(b,d.J,j):document.detachEvent&&a.detachEvent("on"+b,d.J));u.ja(d.q)&&(delete d.q,delete d.J,delete d.disabled);u.ja(d)&&u.Ma(a)};
|
||||
u.Ua=function(a){function b(){return f}function d(){return j}if(!a||!a.Da){var e=a||window.event,g;for(g in e)a[g]=e[g];a.target||(a.target=a.srcElement||document);a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement;a.preventDefault=function(){a.returnValue=j;a.Za=b};a.Za=d;a.stopPropagation=function(){a.cancelBubble=f;a.Da=b};a.Da=d;a.stopImmediatePropagation=function(){a.Db=b;a.stopPropagation()};a.Db=d;a.clientX!=h&&(e=document.documentElement,g=document.body,a.pageX=a.clientX+(e&&
|
||||
e.scrollLeft||g&&g.scrollLeft||0)-(e&&e.clientLeft||g&&g.clientLeft||0),a.pageY=a.clientY+(e&&e.scrollTop||g&&g.scrollTop||0)-(e&&e.clientTop||g&&g.clientTop||0));a.which=a.charCode||a.keyCode;a.button!=h&&(a.button=a.button&1?0:a.button&4?1:a.button&2?2:0)}return a};
|
||||
u.g=function(a,b){var d=u.Ya(a)?u.getData(a):{},e=a.parentNode||a.ownerDocument;"string"===typeof b&&(b={type:b,target:a});b=u.Ua(b);d.J&&d.J.call(a,b);if(e&&!b.Da())u.g(e,b);else if(!e&&!b.Za()&&(d=u.getData(b.target),b.target[b.type])){d.disabled=f;if("function"===typeof b.target[b.type])b.target[b.type]();d.disabled=j}};u.z=function(a,b,d){u.e(a,b,function(){u.j(a,b,arguments.callee);d.apply(this,arguments)})};u.ic={};u.d=function(a,b){var d=document.createElement(a||"div"),e;for(e in b)b.hasOwnProperty(e)&&(d[e]=b[e]);return d};u.I=function(a){return a.charAt(0).toUpperCase()+a.slice(1)};u.Y=function(a,b){if(a)for(var d in a)a.hasOwnProperty(d)&&b.call(this,d,a[d])};u.s=function(a,b){if(!b)return a;for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);return a};u.bind=function(a,b,d){function e(){return b.apply(a,arguments)}b.p||(b.p=u.p++);e.p=d?d+"_"+b.p:b.p;return e};u.M={};u.p=1;u.expando="vdata"+(new Date).getTime();
|
||||
u.getData=function(a){var b=a[u.expando];b||(b=a[u.expando]=u.p++,u.M[b]={});return u.M[b]};u.Ya=function(a){a=a[u.expando];return!(!a||u.ja(u.M[a]))};u.Ma=function(a){var b=a[u.expando];if(b){delete u.M[b];try{delete a[u.expando]}catch(d){a.removeAttribute?a.removeAttribute(u.expando):a[u.expando]=h}}};u.ja=function(a){for(var b in a)if(a[b]!==h)return j;return f};u.m=function(a,b){-1==(" "+a.className+" ").indexOf(" "+b+" ")&&(a.className=""===a.className?b:a.className+" "+b)};
|
||||
u.u=function(a,b){if(-1!=a.className.indexOf(b)){var d=a.className.split(" ");d.splice(d.indexOf(b),1);a.className=d.join(" ")}};u.qb=u.d("video");u.A=navigator.userAgent;u.ob=!!u.A.match(/iPad/i);u.nb=!!u.A.match(/iPhone/i);u.pb=!!u.A.match(/iPod/i);u.mb=u.ob||u.nb||u.pb;var ba=u,ca;var da=u.A.match(/OS (\d+)_/i);ca=da&&da[1]?da[1]:c;ba.bc=ca;u.kb=!!u.A.match(/Android.*AppleWebKit/i);var ea=u,fa=u.A.match(/Android (\d+)\./i);ea.jb=fa&&fa[1]?fa[1]:h;u.lb=function(){return!!u.A.match("Firefox")};
|
||||
u.N=function(a){var b={};if(a&&a.attributes&&0<a.attributes.length)for(var d=a.attributes,e,g,q=d.length-1;0<=q;q--){e=d[q].name;g=d[q].value;if("boolean"===typeof a[e]||-1!==",autoplay,controls,loop,muted,default,".indexOf(","+e+","))g=g!==h?f:j;b[e]=g}return b};
|
||||
u.Ca=function(a,b){var d="";document.defaultView&&document.defaultView.getComputedStyle?d=document.defaultView.getComputedStyle(a,"").getPropertyValue(b):a.currentStyle&&(b=b.replace(/\-(\w)/g,function(a,b){return b.toUpperCase()}),d=a.currentStyle[b]);return d};u.$=function(a,b){b.firstChild?b.insertBefore(a,b.firstChild):b.appendChild(a)};u.Na={};u.f=function(a){0===a.indexOf("#")&&(a=a.slice(1));return document.getElementById(a)};
|
||||
u.o=function(a,b){b=b||a;var d=Math.floor(a%60),e=Math.floor(a/60%60),g=Math.floor(a/3600),q=Math.floor(b/60%60),m=Math.floor(b/3600),g=0<g||0<m?g+":":"";return g+(((g||10<=q)&&10>e?"0"+e:e)+":")+(10>d?"0"+d:d)};u.ub=function(){document.body.focus();document.onselectstart=l(j)};u.Wb=function(){document.onselectstart=l(f)};u.trim=function(a){return a.toString().replace(/^\s+/,"").replace(/\s+$/,"")};u.round=function(a,b){b||(b=0);return Math.round(a*Math.pow(10,b))/Math.pow(10,b)};
|
||||
u.ya=function(a){return{length:1,start:l(0),end:function(){return a}}};
|
||||
u.get=function(a,b,d){var e=0===a.indexOf("file:")||0===window.location.href.indexOf("file:")&&-1===a.indexOf("http");"undefined"===typeof XMLHttpRequest&&(window.XMLHttpRequest=function(){try{return new window.ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(a){}try{return new window.ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(b){}try{return new window.ActiveXObject("Msxml2.XMLHTTP")}catch(d){}throw Error("This browser does not support XMLHttpRequest.");});var g=new XMLHttpRequest;try{g.open("GET",a)}catch(q){d(q)}g.onreadystatechange=
|
||||
function(){4===g.readyState&&(200===g.status||e&&0===g.status?b(g.responseText):d&&d())};try{g.send()}catch(m){d&&d(m)}};u.Rb=function(a){var b=window.localStorage||j;if(b)try{b.volume=a}catch(d){22==d.code||1014==d.code?u.log("LocalStorage Full (VideoJS)",d):u.log("LocalStorage Error (VideoJS)",d)}};u.ia=function(a){a.match(/^https?:\/\//)||(a=u.d("div",{innerHTML:'<a href="'+a+'">x</a>'}).firstChild.href);return a};
|
||||
u.log=function(){u.log.history=u.log.history||[];u.log.history.push(arguments);window.console&&window.console.log(Array.prototype.slice.call(arguments))};u.Ab="getBoundingClientRect"in document.documentElement?function(a){var b;try{b=a.getBoundingClientRect()}catch(d){}if(!b)return 0;a=document.body;return b.left+(window.pageXOffset||a.scrollLeft)-(document.documentElement.clientLeft||a.clientLeft||0)}:function(a){for(var b=a.offsetLeft;a=a.offsetParent;)b+=a.offsetLeft;return b};function y(a,b,d){this.a=a;b=this.options=u.s(this.options||{},b);this.K=b.id||(b.f&&b.f.id?b.f.id:a.id+"_component_"+u.p++);this.Hb=b.name||h;this.b=b.f?b.f:this.d();this.B=[];this.ga={};this.D={};if((a=this.options)&&a.children){var e=this;u.Y(a.children,function(a,b){b!==j&&!b.Fb&&(e[a]=e.C(a,b))})}this.G(d)}n=y.prototype;
|
||||
n.l=function(){if(this.B)for(var a=this.B.length-1;0<=a;a--)this.B[a].l();this.D=this.ga=this.B=h;this.j();this.b.parentNode&&this.b.parentNode.removeChild(this.b);u.Ma(this.b);this.b=h};n.d=function(a,b){return u.d(a,b)};n.f=k("b");n.id=k("K");n.name=k("Hb");n.children=k("B");
|
||||
n.C=function(a,b){var d,e,g;"string"===typeof a?(e=a,b=b||{},d=b.hc||u.I(e),b.name=e,d=new window.videojs[d](this.a||this,b)):d=a;e=d.name();g=d.id();this.B.push(d);g&&(this.ga[g]=d);e&&(this.D[e]=d);this.b.appendChild(d.f());return d};n.removeChild=function(a){"string"===typeof a&&(a=this.D[a]);if(a&&this.B){for(var b=j,d=this.B.length-1;0<=d;d--)if(this.B[d]===a){b=f;this.B.splice(d,1);break}b&&(this.ga[a.id]=h,this.D[a.name]=h,(b=a.f())&&b.parentNode===this.b&&this.b.removeChild(a.f()))}};
|
||||
n.v=l("");n.e=function(a,b){u.e(this.b,a,u.bind(this,b));return this};n.j=function(a,b){u.j(this.b,a,b);return this};n.z=function(a,b){u.z(this.b,a,u.bind(this,b));return this};n.g=function(a,b){u.g(this.b,a,b);return this};n.G=function(a){a&&(this.U?a.call(this):(this.qa===c&&(this.qa=[]),this.qa.push(a)));return this};function z(a){a.U=f;var b=a.qa;if(b&&0<b.length){for(var d=0,e=b.length;d<e;d++)b[d].call(a);a.qa=[];a.g("ready")}}n.m=function(a){u.m(this.b,a);return this};
|
||||
n.u=function(a){u.u(this.b,a);return this};n.show=function(){this.b.style.display="block";return this};n.t=function(){this.b.style.display="none";return this};n.ha=function(){this.u("vjs-fade-out");this.m("vjs-fade-in");return this};n.Aa=function(){this.u("vjs-fade-in");this.m("vjs-fade-out");return this};n.$a=function(){var a=this.b.style;a.display="block";a.opacity=1;a.Yb="visible";return this};function ga(a){a=a.b.style;a.display="";a.opacity="";a.Yb=""}
|
||||
n.width=function(a,b){return ha(this,"width",a,b)};n.height=function(a,b){return ha(this,"height",a,b)};n.xb=function(a,b){return this.width(a,f).height(b)};function ha(a,b,d,e){if(d!==c)return a.b.style[b]=-1!==(""+d).indexOf("%")||-1!==(""+d).indexOf("px")?d:d+"px",e||a.g("resize"),a;if(!a.b)return 0;d=a.b.style[b];e=d.indexOf("px");return-1!==e?parseInt(d.slice(0,e),10):parseInt(a.b["offset"+u.I(b)],10)};function v(a,b,d){this.H=a;var e={};u.s(e,u.options);u.s(e,ia(a));u.s(e,b);this.n={};y.call(this,this,e,d);this.e("ended",this.Jb);this.e("play",this.Ka);this.e("pause",this.Ja);this.e("progress",this.Kb);this.e("durationchange",this.Ib);this.e("error",this.Ha);u.P[this.K]=this}t(v,y);n=v.prototype;n.l=function(){u.P[this.K]=h;this.H&&this.H.a&&(this.H.a=h);this.b&&this.b.a&&(this.b.a=h);clearInterval(this.pa);this.i&&this.i.l();v.h.l.call(this)};
|
||||
function ia(a){var b={sources:[],tracks:[]};u.s(b,u.N(a));if(a.hasChildNodes())for(var d,e=a.childNodes,g=0,q=e.length;g<q;g++)a=e[g],d=a.nodeName.toLowerCase(),"source"===d?b.sources.push(u.N(a)):"track"===d&&b.tracks.push(u.N(a));return b}
|
||||
n.d=function(){var a=this.b=v.h.d.call(this,"div"),b=this.H;b.removeAttribute("controls");b.removeAttribute("poster");b.removeAttribute("width");b.removeAttribute("height");if(b.hasChildNodes())for(var d=b.childNodes.length,e=0,g=b.childNodes;e<d;e++)("source"==g[0].nodeName.toLowerCase()||"track"==g[0].nodeName.toLowerCase())&&b.removeChild(g[0]);b.id=b.id||"vjs_video_"+u.p++;a.id=b.id;a.className=b.className;b.id+="_html5_api";b.className="vjs-tech";b.a=a.a=this;this.m("vjs-paused");this.width(this.options.width,
|
||||
f);this.height(this.options.height,f);b.parentNode&&b.parentNode.insertBefore(a,b);u.$(b,a);return a};
|
||||
function ja(a,b,d){a.i?ka(a):"Html5"!==b&&a.H&&(a.b.removeChild(a.H),a.H=h);a.Q=b;a.U=j;var e=u.s({source:d,Lb:a.b},a.options[b.toLowerCase()]);d&&(d.src==a.n.src&&0<a.n.currentTime&&(e.startTime=a.n.currentTime),a.n.src=d.src);a.i=new window.videojs[b](a,e);a.i.G(function(){z(this.a);if(!this.F.bb){var a=this.a;a.Fa=f;a.pa=setInterval(u.bind(a,function(){this.n.wa<this.buffered().end(0)?this.g("progress"):1==la(this)&&(clearInterval(this.pa),this.g("progress"))}),500);a.i.z("progress",function(){this.F.bb=
|
||||
f;var a=this.a;a.Fa=j;clearInterval(a.pa)})}this.F.hb||(a=this.a,a.Ga=f,a.e("play",a.ib),a.e("pause",a.sa),a.i.z("timeupdate",function(){this.F.hb=f;ma(this.a)}))})}function ka(a){a.i.l();a.Fa&&(a.Fa=j,clearInterval(a.pa));a.Ga&&ma(a);a.i=j}function ma(a){a.Ga=j;a.sa();a.j("play",a.ib);a.j("pause",a.sa)}n.ib=function(){this.Sa&&this.sa();this.Sa=setInterval(u.bind(this,function(){this.g("timeupdate")}),250)};n.sa=function(){clearInterval(this.Sa)};
|
||||
n.Jb=function(){this.options.loop&&(this.currentTime(0),this.play())};n.Ka=function(){u.u(this.b,"vjs-paused");u.m(this.b,"vjs-playing")};n.Ja=function(){u.u(this.b,"vjs-playing");u.m(this.b,"vjs-paused")};n.Kb=function(){1==la(this)&&this.g("loadedalldata")};n.Ib=function(){this.duration(A(this,"duration"))};n.Ha=function(a){u.log("Video Error",a)};function B(a,b,d){if(a.i.U)try{a.i[b](d)}catch(e){u.log(e)}else a.i.G(function(){this[b](d)})}
|
||||
function A(a,b){if(a.i.U)try{return a.i[b]()}catch(d){if(a.i[b]===c)u.log("Video.js: "+b+" method not defined for "+a.Q+" playback technology.",d);else{if("TypeError"==d.name)throw u.log("Video.js: "+b+" unavailable on "+a.Q+" playback technology element.",d),a.i.U=j,d;u.log(d)}}}n.play=function(){B(this,"play");return this};n.pause=function(){B(this,"pause");return this};n.paused=function(){return A(this,"paused")===j?j:f};
|
||||
n.currentTime=function(a){return a!==c?(this.n.pc=a,B(this,"setCurrentTime",a),this.Ga&&this.g("timeupdate"),this):this.n.currentTime=A(this,"currentTime")||0};n.duration=function(a){return a!==c?(this.n.duration=parseFloat(a),this):this.n.duration};n.buffered=function(){var a=A(this,"buffered"),b=this.n.wa=this.n.wa||0;a&&(0<a.length&&a.end(0)!==b)&&(b=a.end(0),this.n.wa=b);return u.ya(b)};function la(a){return a.duration()?a.buffered().end(0)/a.duration():0}
|
||||
n.volume=function(a){if(a!==c)return a=Math.max(0,Math.min(1,parseFloat(a))),this.n.volume=a,B(this,"setVolume",a),u.Rb(a),this;a=parseFloat(A(this,"volume"));return isNaN(a)?1:a};n.muted=function(a){return a!==c?(B(this,"setMuted",a),this):A(this,"muted")||j};n.ta=function(){return A(this,"supportsFullScreen")||j};
|
||||
n.ra=function(){var a=u.Na.ra;this.O=f;a?(u.e(document,a.T,u.bind(this,function(){this.O=document[a.O];this.O===j&&u.j(document,a.T,arguments.callee);this.g("fullscreenchange")})),this.i.F.Wa===j&&this.options.flash.iFrameMode!==f&&(this.pause(),ka(this),u.e(document,a.T,u.bind(this,function(){u.j(document,a.T,arguments.callee);ja(this,this.Q,{src:this.n.src})}))),this.b[a.Nb]()):this.i.ta()?(this.g("fullscreenchange"),B(this,"enterFullScreen")):(this.g("fullscreenchange"),this.Cb=f,this.yb=document.documentElement.style.overflow,
|
||||
u.e(document,"keydown",u.bind(this,this.Va)),document.documentElement.style.overflow="hidden",u.m(document.body,"vjs-full-window"),u.m(this.b,"vjs-fullscreen"),this.g("enterFullWindow"));return this};function na(a){var b=u.Na.ra;a.O=j;b?(a.i.F.Wa===j&&a.options.flash.iFrameMode!==f&&(a.pause(),ka(a),u.e(document,b.T,u.bind(a,function(){u.j(document,b.T,arguments.callee);ja(this,this.Q,{src:this.n.src})}))),document[b.vb]()):(a.i.ta()?B(a,"exitFullScreen"):oa(a),a.g("fullscreenchange"))}
|
||||
n.Va=function(a){27===a.keyCode&&(this.O===f?na(this):oa(this))};function oa(a){a.Cb=j;u.j(document,"keydown",a.Va);document.documentElement.style.overflow=a.yb;u.u(document.body,"vjs-full-window");u.u(a.b,"vjs-fullscreen");a.g("exitFullWindow")}
|
||||
n.src=function(a){if(a instanceof Array){var b;a:{b=a;for(var d=0,e=this.options.techOrder;d<e.length;d++){var g=u.I(e[d]),q=window.videojs[g];if(q.isSupported())for(var m=0,r=b;m<r.length;m++){var p=r[m];if(q.canPlaySource(p)){b={source:p,i:g};break a}}}b=j}b?(a=b.source,b=b.i,b==this.Q?this.src(a):ja(this,b,a)):this.b.appendChild(u.d("p",{innerHTML:'Sorry, no compatible source and playback technology were found for this video. Try using another browser like <a href="http://www.google.com/chrome">Google Chrome</a> or download the latest <a href="http://get.adobe.com/flashplayer/">Adobe Flash Player</a>.'}))}else a instanceof
|
||||
Object?window.videojs[this.Q].canPlaySource(a)?this.src(a.src):this.src([a]):(this.n.src=a,this.U?(B(this,"src",a),"auto"==this.options.preload&&this.load(),this.options.autoplay&&this.play()):this.G(function(){this.src(a)}));return this};n.load=function(){B(this,"load");return this};n.currentSrc=function(){return A(this,"currentSrc")||this.n.src||""};n.ca=function(a){return a!==c?(B(this,"setPreload",a),this.options.preload=a,this):A(this,"preload")};
|
||||
n.autoplay=function(a){return a!==c?(B(this,"setAutoplay",a),this.options.autoplay=a,this):A(this,"autoplay")};n.loop=function(a){return a!==c?(B(this,"setLoop",a),this.options.loop=a,this):A(this,"loop")};n.controls=function(){return this.options.controls};n.poster=function(){return A(this,"poster")};n.error=function(){return A(this,"error")};var pa,qa,ra,sa;
|
||||
if(document.fc!==c)pa="requestFullscreen",qa="exitFullscreen",ra="fullscreenchange",sa="fullScreen";else for(var ta=["moz","webkit"],ua=ta.length-1;0<=ua;ua--){var C=ta[ua];if(("moz"!=C||document.mozFullScreenEnabled)&&document[C+"CancelFullScreen"]!==c)pa=C+"RequestFullScreen",qa=C+"CancelFullScreen",ra=C+"fullscreenchange",sa="webkit"==C?C+"IsFullScreen":C+"FullScreen"}pa&&(u.Na.ra={Nb:pa,vb:qa,T:ra,O:sa});
|
||||
function va(a,b,d){y.call(this,a,b,d);if(!a.options.sources||0===a.options.sources.length){b=0;for(d=a.options.techOrder;b<d.length;b++){var e=u.I(d[b]),g=window.videojs[e];if(g&&g.isSupported()){ja(a,e);break}}}else a.src(a.options.sources)}t(va,y);function D(a,b){y.call(this,a,b)}t(D,y);D.prototype.v=function(){return"vjs-control "+D.h.v.call(this)};function E(a,b){y.call(this,a,b);a.z("play",u.bind(this,function(){this.ha();this.a.e("mouseover",u.bind(this,this.ha));this.a.e("mouseout",u.bind(this,this.Aa))}))}t(E,y);n=E.prototype;n.options={Fb:"play",children:{playToggle:{},fullscreenToggle:{},currentTimeDisplay:{},timeDivider:{},durationDisplay:{},remainingTimeDisplay:{},progressControl:{},volumeControl:{},muteToggle:{}}};
|
||||
n.d=function(){return u.d("div",{className:"vjs-control-bar"})};n.ha=function(){E.h.ha.call(this);this.a.g("controlsvisible")};n.Aa=function(){E.h.Aa.call(this);this.a.g("controlshidden")};n.$a=function(){this.b.style.opacity="1"};function F(a,b){y.call(this,a,b);this.e("click",this.k);this.e("focus",this.ma);this.e("blur",this.la)}t(F,D);n=F.prototype;
|
||||
n.d=function(a,b){b=u.s({className:this.v(),innerHTML:'<div><span class="vjs-control-text">'+(this.L||"Need Text")+"</span></div>",Ob:"button",tabIndex:0},b);return F.h.d.call(this,a,b)};n.k=function(){};n.ma=function(){u.e(document,"keyup",u.bind(this,this.ba))};n.ba=function(a){if(32==a.which||13==a.which)a.preventDefault(),this.k()};n.la=function(){u.j(document,"keyup",u.bind(this,this.ba))};function G(a,b){F.call(this,a,b)}t(G,F);G.prototype.L="Play";
|
||||
G.prototype.v=function(){return"vjs-play-button "+G.h.v.call(this)};G.prototype.k=function(){this.a.play()};function H(a,b){F.call(this,a,b)}t(H,F);H.prototype.L="Play";H.prototype.v=function(){return"vjs-pause-button "+H.h.v.call(this)};H.prototype.k=function(){this.a.pause()};function wa(a,b){F.call(this,a,b);a.e("play",u.bind(this,this.Ka));a.e("pause",u.bind(this,this.Ja))}t(wa,F);n=wa.prototype;n.L="Play";n.v=function(){return"vjs-play-control "+wa.h.v.call(this)};
|
||||
n.k=function(){this.a.paused()?this.a.play():this.a.pause()};n.Ka=function(){u.u(this.b,"vjs-paused");u.m(this.b,"vjs-playing")};n.Ja=function(){u.u(this.b,"vjs-playing");u.m(this.b,"vjs-paused")};function I(a,b){F.call(this,a,b)}t(I,F);I.prototype.L="Fullscreen";I.prototype.v=function(){return"vjs-fullscreen-control "+I.h.v.call(this)};I.prototype.k=function(){this.a.O?na(this.a):this.a.ra()};function J(a,b){F.call(this,a,b);a.e("play",u.bind(this,this.t));a.e("ended",u.bind(this,this.show))}
|
||||
t(J,F);J.prototype.d=function(){return J.h.d.call(this,"div",{className:"vjs-big-play-button",innerHTML:"<span></span>"})};J.prototype.k=function(){this.a.currentTime()&&this.a.currentTime(0);this.a.play()};
|
||||
function K(a,b){y.call(this,a,b);a.e("canplay",u.bind(this,this.t));a.e("canplaythrough",u.bind(this,this.t));a.e("playing",u.bind(this,this.t));a.e("seeked",u.bind(this,this.t));a.e("seeking",u.bind(this,this.show));a.e("seeked",u.bind(this,this.t));a.e("error",u.bind(this,this.show));a.e("waiting",u.bind(this,this.show))}t(K,y);
|
||||
K.prototype.d=function(){var a,b;"string"==typeof this.a.f().style.WebkitBorderRadius||"string"==typeof this.a.f().style.MozBorderRadius||"string"==typeof this.a.f().style.cc||"string"==typeof this.a.f().style.ec?(a="vjs-loading-spinner",b='<div class="ball1"></div><div class="ball2"></div><div class="ball3"></div><div class="ball4"></div><div class="ball5"></div><div class="ball6"></div><div class="ball7"></div><div class="ball8"></div>'):(a="vjs-loading-spinner-fallback",b="");return K.h.d.call(this,
|
||||
"div",{className:a,innerHTML:b})};function L(a,b){y.call(this,a,b);a.e("timeupdate",u.bind(this,this.ea))}t(L,y);L.prototype.d=function(){var a=L.h.d.call(this,"div",{className:"vjs-current-time vjs-time-controls vjs-control"});this.content=u.d("div",{className:"vjs-current-time-display",innerHTML:"0:00"});a.appendChild(u.d("div").appendChild(this.content));return a};L.prototype.ea=function(){var a=this.a.cb?this.a.n.currentTime:this.a.currentTime();this.content.innerHTML=u.o(a,this.a.duration())};
|
||||
function M(a,b){y.call(this,a,b);a.e("timeupdate",u.bind(this,this.ea))}t(M,y);M.prototype.d=function(){var a=M.h.d.call(this,"div",{className:"vjs-duration vjs-time-controls vjs-control"});this.content=u.d("div",{className:"vjs-duration-display",innerHTML:"0:00"});a.appendChild(u.d("div").appendChild(this.content));return a};M.prototype.ea=function(){this.a.duration()&&(this.content.innerHTML=u.o(this.a.duration()))};function xa(a,b){y.call(this,a,b)}t(xa,y);
|
||||
xa.prototype.d=function(){return xa.h.d.call(this,"div",{className:"vjs-time-divider",innerHTML:"<div><span>/</span></div>"})};function N(a,b){y.call(this,a,b);a.e("timeupdate",u.bind(this,this.ea))}t(N,y);N.prototype.d=function(){var a=N.h.d.call(this,"div",{className:"vjs-remaining-time vjs-time-controls vjs-control"});this.content=u.d("div",{className:"vjs-remaining-time-display",innerHTML:"-0:00"});a.appendChild(u.d("div").appendChild(this.content));return a};
|
||||
N.prototype.ea=function(){this.a.duration()&&(this.content.innerHTML="-"+u.o(this.a.duration()-this.a.currentTime()))};function O(a,b){y.call(this,a,b);this.tb=this.D[this.options.barName];this.handle=this.D[this.options.handleName];a.e(this.ab,u.bind(this,this.update));this.e("mousedown",this.Ia);this.e("focus",this.ma);this.e("blur",this.la);this.a.e("controlsvisible",u.bind(this,this.update));a.G(u.bind(this,this.update))}t(O,y);n=O.prototype;
|
||||
n.d=function(a,b){b=u.s({Ob:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100,tabIndex:0},b);return O.h.d.call(this,a,b)};n.Ia=function(a){a.preventDefault();u.ub();u.e(document,"mousemove",u.bind(this,this.na));u.e(document,"mouseup",u.bind(this,this.oa));this.na(a)};n.oa=function(){u.Wb();u.j(document,"mousemove",this.na,j);u.j(document,"mouseup",this.oa,j);this.update()};
|
||||
n.update=function(){var a,b=this.Xa(),d=this.handle,e=this.tb;isNaN(b)&&(b=0);a=b;if(d){a=this.b.offsetWidth;var g=d.f().offsetWidth;a=g?g/a:0;b*=1-a;a=b+a/2;d.f().style.left=u.round(100*b,2)+"%"}e.f().style.width=u.round(100*a,2)+"%"};function ya(a,b){var d=a.b,e=u.Ab(d),d=d.offsetWidth,g=a.handle;g&&(g=g.f().offsetWidth,e+=g/2,d-=g);return Math.max(0,Math.min(1,(b.pageX-e)/d))}n.ma=function(){u.e(document,"keyup",u.bind(this,this.ba))};
|
||||
n.ba=function(a){37==a.which?(a.preventDefault(),this.fb()):39==a.which&&(a.preventDefault(),this.gb())};n.la=function(){u.j(document,"keyup",u.bind(this,this.ba))};function P(a,b){y.call(this,a,b)}t(P,y);P.prototype.options={children:{seekBar:{}}};P.prototype.d=function(){return P.h.d.call(this,"div",{className:"vjs-progress-control vjs-control"})};function Q(a,b){O.call(this,a,b)}t(Q,O);n=Q.prototype;
|
||||
n.options={children:{loadProgressBar:{},playProgressBar:{},seekHandle:{}},barName:"playProgressBar",handleName:"seekHandle"};n.ab="timeupdate";n.d=function(){return Q.h.d.call(this,"div",{className:"vjs-progress-holder"})};n.Xa=function(){return this.a.currentTime()/this.a.duration()};n.Ia=function(a){Q.h.Ia.call(this,a);this.a.cb=f;this.Xb=!this.a.paused();this.a.pause()};n.na=function(a){a=ya(this,a)*this.a.duration();a==this.a.duration()&&(a-=0.1);this.a.currentTime(a)};
|
||||
n.oa=function(a){Q.h.oa.call(this,a);this.a.cb=j;this.Xb&&this.a.play()};n.gb=function(){this.a.currentTime(this.a.currentTime()+1)};n.fb=function(){this.a.currentTime(this.a.currentTime()-1)};function za(a,b){y.call(this,a,b);a.e("progress",u.bind(this,this.update))}t(za,y);za.prototype.d=function(){return za.h.d.call(this,"div",{className:"vjs-load-progress",innerHTML:'<span class="vjs-control-text">Loaded: 0%</span>'})};
|
||||
za.prototype.update=function(){this.b.style&&(this.b.style.width=u.round(100*la(this.a),2)+"%")};function Aa(a,b){y.call(this,a,b)}t(Aa,y);Aa.prototype.d=function(){return Aa.h.d.call(this,"div",{className:"vjs-play-progress",innerHTML:'<span class="vjs-control-text">Progress: 0%</span>'})};function Ba(a,b){y.call(this,a,b)}t(Ba,y);Ba.prototype.d=function(){return Ba.h.d.call(this,"div",{className:"vjs-seek-handle",innerHTML:'<span class="vjs-control-text">00:00</span>'})};
|
||||
function Ca(a,b){y.call(this,a,b)}t(Ca,y);Ca.prototype.options={children:{volumeBar:{}}};Ca.prototype.d=function(){return Ca.h.d.call(this,"div",{className:"vjs-volume-control vjs-control"})};function Da(a,b){O.call(this,a,b)}t(Da,O);n=Da.prototype;n.options={children:{volumeLevel:{},volumeHandle:{}},barName:"volumeLevel",handleName:"volumeHandle"};n.ab="volumechange";n.d=function(){return Da.h.d.call(this,"div",{className:"vjs-volume-bar"})};n.na=function(a){this.a.volume(ya(this,a))};n.Xa=function(){return this.a.volume()};
|
||||
n.gb=function(){this.a.volume(this.a.volume()+0.1)};n.fb=function(){this.a.volume(this.a.volume()-0.1)};function Ea(a,b){y.call(this,a,b)}t(Ea,y);Ea.prototype.d=function(){return Ea.h.d.call(this,"div",{className:"vjs-volume-level",innerHTML:'<span class="vjs-control-text"></span>'})};function Fa(a,b){y.call(this,a,b)}t(Fa,y);Fa.prototype.d=function(){return Fa.h.d.call(this,"div",{className:"vjs-volume-handle",innerHTML:'<span class="vjs-control-text"></span>'})};
|
||||
function R(a,b){F.call(this,a,b);a.e("volumechange",u.bind(this,this.update))}t(R,F);R.prototype.d=function(){return R.h.d.call(this,"div",{className:"vjs-mute-control vjs-control",innerHTML:'<div><span class="vjs-control-text">Mute</span></div>'})};R.prototype.k=function(){this.a.muted(this.a.muted()?j:f)};R.prototype.update=function(){var a=this.a.volume(),b=3;0===a||this.a.muted()?b=0:0.33>a?b=1:0.67>a&&(b=2);for(a=0;4>a;a++)u.u(this.b,"vjs-vol-"+a);u.m(this.b,"vjs-vol-"+b)};
|
||||
function Ga(a,b){F.call(this,a,b);this.a.options.poster||this.t();a.e("play",u.bind(this,this.t))}t(Ga,F);Ga.prototype.d=function(){var a=u.d("img",{className:"vjs-poster",tabIndex:-1});this.a.options.poster&&(a.src=this.a.options.poster);return a};Ga.prototype.k=function(){this.a.play()};function S(a,b){y.call(this,a,b)}t(S,y);function Ha(a,b){a.C(b);b.e("click",u.bind(a,function(){ga(this)}))}S.prototype.d=function(){return S.h.d.call(this,"ul",{className:"vjs-menu"})};
|
||||
function T(a,b){F.call(this,a,b);b.selected&&this.m("vjs-selected")}t(T,F);T.prototype.d=function(a,b){return T.h.d.call(this,"li",u.s({className:"vjs-menu-item",innerHTML:this.options.label},b))};T.prototype.k=function(){this.selected(f)};T.prototype.selected=function(a){a?this.m("vjs-selected"):this.u("vjs-selected")};function U(a,b,d){y.call(this,a,b,d)}t(U,y);U.prototype.k=function(){this.a.options.controls&&(this.a.paused()?this.a.play():this.a.pause())};u.media={};u.media.ua="play pause paused currentTime setCurrentTime duration buffered volume setVolume muted setMuted width height supportsFullScreen enterFullScreen src load currentSrc preload setPreload autoplay setAutoplay loop setLoop error networkState readyState seeking initialTime startOffsetTime played seekable ended videoTracks audioTracks videoWidth videoHeight textTracks defaultPlaybackRate playbackRate mediaGroup controller controls defaultMuted".split(" ");
|
||||
function Ia(){var a=u.media.ua[i];return function(){throw Error('The "'+a+"\" method is not available on the playback technology's API");}}for(var i=u.media.ua.length-1;0<=i;i--)U.prototype[u.media.ua[i]]=Ia();function V(a,b,d){y.call(this,a,b,d);(b=b.source)&&this.b.currentSrc==b.src?a.g("loadstart"):b&&(this.b.src=b.src);a.G(function(){this.options.autoplay&&this.paused()&&(this.H.poster=h,this.play())});this.e("click",this.k);for(a=Ja.length-1;0<=a;a--)u.e(this.b,Ja[a],u.bind(this.a,this.Ta));z(this)}t(V,U);n=V.prototype;n.l=function(){for(var a=Ja.length-1;0<=a;a--)u.j(this.b,Ja[a],u.bind(this.a,this.Ta));V.h.l.call(this)};
|
||||
n.d=function(){var a=this.a,b=a.H;if(!b||this.F.Gb===j)b&&a.f().removeChild(b),b=u.createElement("video",{id:b.id||a.id+"_html5_api",className:b.className||"vjs-tech"}),u.$(b,a.f);for(var d=["autoplay","preload","loop","muted"],e=d.length-1;0<=e;e--){var g=d[e];a.options[g]!==h&&(b[g]=a.options[g])}return b};n.Ta=function(a){this.g(a);a.stopPropagation()};n.play=function(){this.b.play()};n.pause=function(){this.b.pause()};n.paused=function(){return this.b.paused};n.currentTime=function(){return this.b.currentTime};
|
||||
n.Qb=function(a){try{this.b.currentTime=a}catch(b){u.log(b,"Video is not ready. (Video.js)")}};n.duration=function(){return this.b.duration||0};n.buffered=function(){return this.b.buffered};n.volume=function(){return this.b.volume};n.Vb=function(a){this.b.volume=a};n.muted=function(){return this.b.muted};n.Tb=function(a){this.b.muted=a};n.width=function(){return this.b.offsetWidth};n.height=function(){return this.b.offsetHeight};
|
||||
n.ta=function(){return"function"==typeof this.b.webkitEnterFullScreen&&!navigator.userAgent.match("Chrome")&&!navigator.userAgent.match("Mac OS X 10.5")?f:j};n.src=function(a){this.b.src=a};n.load=function(){this.b.load()};n.currentSrc=function(){return this.b.currentSrc};n.ca=function(){return this.b.ca};n.Ub=function(a){this.b.ca=a};n.autoplay=function(){return this.b.autoplay};n.Pb=function(a){this.b.autoplay=a};n.loop=function(){return this.b.loop};n.Sb=function(a){this.b.loop=a};n.error=function(){return this.b.error};
|
||||
n.controls=function(){return this.a.options.controls};var Ja="loadstart suspend abort error emptied stalled loadedmetadata loadeddata canplay canplaythrough playing waiting seeking seeked ended durationchange timeupdate progress play pause ratechange volumechange".split(" ");V.prototype.F={kc:u.qb.webkitEnterFullScreen?!u.A.match("Chrome")&&!u.A.match("Mac OS X 10.5")?f:j:j,Gb:!u.mb};
|
||||
u.kb&&3>u.jb&&(document.createElement("video").constructor.prototype.canPlayType=function(a){return a&&-1!=a.toLowerCase().indexOf("video/mp4")?"maybe":""});function W(a,b,d){y.call(this,a,b,d);var e=b.source,g=b.Lb;d=this.b=u.d("div",{id:a.id()+"_temp_flash"});var q=a.id()+"_flash_api";a=a.options;var m=u.s({readyFunction:"videojs.Flash.onReady",eventProxyFunction:"videojs.Flash.onEvent",errorEventProxyFunction:"videojs.Flash.onError",autoplay:a.autoplay,preload:a.ca,loop:a.loop,muted:a.muted},b.flashVars),r=u.s({wmode:"opaque",bgcolor:"#000000"},b.params),p=u.s({id:q,name:q,"class":"vjs-tech"},b.attributes);e&&(m.src=encodeURIComponent(u.ia(e.src)));
|
||||
u.$(d,g);b.startTime&&this.G(function(){this.load();this.play();this.currentTime(b.startTime)});if(b.nc===f&&!u.lb){var w=u.d("iframe",{id:q+"_iframe",name:q+"_iframe",className:"vjs-tech",scrolling:"no",marginWidth:0,marginHeight:0,frameBorder:0});m.readyFunction="ready";m.eventProxyFunction="events";m.errorEventProxyFunction="errors";u.e(w,"load",u.bind(this,function(){var a,d=w.contentWindow;a=w.contentDocument?w.contentDocument:w.contentWindow.document;a.write(Ka(b.swf,m,r,p));d.a=this.a;d.G=
|
||||
u.bind(this.a,function(b){b=a.getElementById(b);var d=this.i;d.f=b;u.e(b,"click",d.bind(d.k));La(d)});d.zb=u.bind(this.a,function(a,b){this&&"flash"===this.Q&&this.g(b)});d.jc=u.bind(this.a,function(a,b){u.log("Flash Error",b)})}));d.parentNode.replaceChild(w,d)}else{a=Ka(b.swf,m,r,p);a=u.d("div",{innerHTML:a}).childNodes[0];e=d.parentNode;d.parentNode.replaceChild(a,d);var eb=e.childNodes[0];setTimeout(function(){eb.style.display="block"},1E3)}}t(W,U);n=W.prototype;n.l=function(){W.h.l.call(this)};
|
||||
n.play=function(){this.b.vjs_play()};n.pause=function(){this.b.vjs_pause()};n.src=function(a){a=u.ia(a);this.b.vjs_src(a);if(this.a.autoplay()){var b=this;setTimeout(function(){b.play()},0)}};n.load=function(){this.b.vjs_load()};n.poster=function(){this.b.vjs_getProperty("poster")};n.buffered=function(){return u.ya(this.b.vjs_getProperty("buffered"))};n.ta=l(j);
|
||||
var Ma=W.prototype,Na="preload currentTime defaultPlaybackRate playbackRate autoplay loop mediaGroup controller controls volume muted defaultMuted".split(" "),Oa="error currentSrc networkState readyState seeking initialTime duration startOffsetTime paused played seekable ended videoTracks audioTracks videoWidth videoHeight textTracks".split(" ");function Pa(){var a=Na[i],b=a.charAt(0).toUpperCase()+a.slice(1);Ma["set"+b]=function(b){return this.b.vjs_setProperty(a,b)}}
|
||||
function Qa(a){Ma[a]=function(){return this.b.vjs_getProperty(a)}}for(i=0;i<Na.length;i++)Qa(Na[i]),Pa();for(i=0;i<Oa.length;i++)Qa(Oa[i]);W.prototype.F={Bb:{"video/flv":"FLV","video/x-flv":"FLV","video/mp4":"MP4","video/m4v":"MP4"},bb:j,hb:j,Wa:j,qc:!u.A.match("Firefox")};W.onReady=function(a){a=u.f(a);var b=a.a||a.parentNode.a,d=b.i;a.a=b;d.b=a;d.e("click",d.k);La(d)};function La(a){a.f().vjs_getProperty?z(a):setTimeout(function(){La(a)},50)}W.onEvent=function(a,b){u.f(a).a.g(b)};
|
||||
W.onError=function(a,b){u.f(a).a.g("error");u.log("Flash Error",b,a)};function Ka(a,b,d,e){var g="",q="",m="";b&&u.Y(b,function(a,b){g+=a+"="+b+"&"});d=u.s({movie:a,flashvars:g,allowScriptAccess:"always",allowNetworking:"all"},d);u.Y(d,function(a,b){q+='<param name="'+a+'" value="'+b+'" />'});e=u.s({data:a,width:"100%",height:"100%"},e);u.Y(e,function(a,b){m+=a+'="'+b+'" '});return'<object type="application/x-shockwave-flash"'+m+">"+q+"</object>"};function X(a){a.da=a.da||[];return a.da}function Ra(a,b,d){for(var e=a.da,g=0,q=e.length,m,r;g<q;g++)m=e[g],m.id()===b?(m.show(),r=m):d&&(m.w()==d&&0<m.mode())&&m.disable();(b=r?r.w():d?d:j)&&a.g(b+"trackchange")}function Y(a,b){y.call(this,a,b);this.K=b.id||"vjs_"+b.kind+"_"+b.language+"_"+u.p++;this.eb=b.src;this.wb=b["default"]||b.dflt;this.tc=b.title;this.oc=b.srclang;this.Eb=b.label;this.S=[];this.Oa=[];this.W=this.X=0}t(Y,y);n=Y.prototype;n.w=k("r");n.src=k("eb");n.za=k("wb");n.label=k("Eb");
|
||||
n.readyState=k("X");n.mode=k("W");n.d=function(){return Y.h.d.call(this,"div",{className:"vjs-"+this.r+" vjs-text-track"})};n.show=function(){Sa(this);this.W=2;Y.h.show.call(this)};n.t=function(){Sa(this);this.W=1;Y.h.t.call(this)};n.disable=function(){2==this.W&&this.t();this.a.j("timeupdate",u.bind(this,this.update,this.K));this.a.j("ended",u.bind(this,this.reset,this.K));this.reset();this.a.D.textTrackDisplay.removeChild(this);this.W=0};
|
||||
function Sa(a){0===a.X&&a.load();0===a.W&&(a.a.e("timeupdate",u.bind(a,a.update,a.K)),a.a.e("ended",u.bind(a,a.reset,a.K)),("captions"===a.r||"subtitles"===a.r)&&a.a.D.textTrackDisplay.C(a))}n.load=function(){0===this.X&&(this.X=1,u.get(this.eb,u.bind(this,this.Mb),u.bind(this,this.Ha)))};n.Ha=function(a){this.error=a;this.X=3;this.g("error")};
|
||||
n.Mb=function(a){var b,d;a=a.split("\n");for(var e="",g=1,q=a.length;g<q;g++)if(e=u.trim(a[g])){-1==e.indexOf("--\x3e")?(b=e,e=u.trim(a[++g])):b=this.S.length;b={id:b,index:this.S.length};d=e.split(" --\x3e ");b.startTime=Ta(d[0]);b.Z=Ta(d[1]);for(d=[];a[++g]&&(e=u.trim(a[g]));)d.push(e);b.text=d.join("<br/>");this.S.push(b)}this.X=2;this.g("loaded")};
|
||||
function Ta(a){var b=a.split(":");a=0;var d,e,g;3==b.length?(d=b[0],e=b[1],b=b[2]):(d=0,e=b[0],b=b[1]);b=b.split(/\s+/);b=b.splice(0,1)[0];b=b.split(/\.|,/);g=parseFloat(b[1]);b=b[0];a+=3600*parseFloat(d);a+=60*parseFloat(e);a+=parseFloat(b);g&&(a+=g/1E3);return a}
|
||||
n.update=function(){if(0<this.S.length){var a=this.a.currentTime();if(this.La===c||a<this.La||this.ka<=a){var b=this.S,d=this.a.duration(),e=0,g=j,q=[],m,r,p,w;a>=this.ka||this.ka===c?w=this.Ba!==c?this.Ba:0:(g=f,w=this.Ea!==c?this.Ea:b.length-1);for(;;){p=b[w];if(p.Z<=a)e=Math.max(e,p.Z),p.fa&&(p.fa=j);else if(a<p.startTime){if(d=Math.min(d,p.startTime),p.fa&&(p.fa=j),!g)break}else g?(q.splice(0,0,p),r===c&&(r=w),m=w):(q.push(p),m===c&&(m=w),r=w),d=Math.min(d,p.Z),e=Math.max(e,p.startTime),p.fa=
|
||||
f;if(g)if(0===w)break;else w--;else if(w===b.length-1)break;else w++}this.Oa=q;this.ka=d;this.La=e;this.Ba=m;this.Ea=r;a=this.Oa;b="";d=0;for(e=a.length;d<e;d++)b+='<span class="vjs-tt-cue">'+a[d].text+"</span>";this.b.innerHTML=b;this.g("cuechange")}}};n.reset=function(){this.ka=0;this.La=this.a.duration();this.Ea=this.Ba=0};function Ua(a,b){Y.call(this,a,b)}t(Ua,Y);Ua.prototype.r="captions";function Va(a,b){Y.call(this,a,b)}t(Va,Y);Va.prototype.r="subtitles";function Wa(a,b){Y.call(this,a,b)}
|
||||
t(Wa,Y);Wa.prototype.r="chapters";function Xa(a,b,d){y.call(this,a,b,d);if(a.options.tracks&&0<a.options.tracks.length){b=this.a;a=a.options.tracks;var e;for(d=0;d<a.length;d++){e=a[d];var g=b,q=e.kind,m=e.label,r=e.language,p=e;e=g.da=g.da||[];p=p||{};p.kind=q;p.label=m;p.language=r;q=u.I(q||"subtitles");g=new window.videojs[q+"Track"](g,p);e.push(g)}}}t(Xa,y);Xa.prototype.d=function(){return Xa.h.d.call(this,"div",{className:"vjs-text-track-display"})};
|
||||
function Z(a,b){var d=this.R=b.track;b.label=d.label();b.selected=d.za();T.call(this,a,b);this.a.e(d.w()+"trackchange",u.bind(this,this.update))}t(Z,T);Z.prototype.k=function(){Z.h.k.call(this);Ra(this.a,this.R.id(),this.R.w())};Z.prototype.update=function(){2==this.R.mode()?this.selected(f):this.selected(j)};function Ya(a,b){b.track={w:function(){return b.kind},a:a,label:l("Off"),za:l(j),mode:l(j)};Z.call(this,a,b)}t(Ya,Z);Ya.prototype.k=function(){Ya.h.k.call(this);Ra(this.a,this.R.id(),this.R.w())};
|
||||
Ya.prototype.update=function(){for(var a=X(this.a),b=0,d=a.length,e,g=f;b<d;b++)e=a[b],e.w()==this.R.w()&&2==e.mode()&&(g=j);g?this.selected(f):this.selected(j)};function $(a,b){F.call(this,a,b);this.V=this.xa();0===this.aa.length&&this.t()}t($,F);n=$.prototype;n.xa=function(){var a=new S(this.a);a.f().appendChild(u.d("li",{className:"vjs-menu-title",innerHTML:u.I(this.r)}));Ha(a,new Ya(this.a,{kind:this.r}));this.aa=this.Ra();for(var b=0;b<this.aa.length;b++)Ha(a,this.aa[b]);this.C(a);return a};
|
||||
n.Ra=function(){for(var a=[],b,d=0;d<X(this.a).length;d++)b=X(this.a)[d],b.w()===this.r&&a.push(new Z(this.a,{track:b}));return a};n.v=function(){return this.className+" vjs-menu-button "+$.h.v.call(this)};n.ma=function(){this.V.$a();u.z(this.V.b.childNodes[this.V.b.childNodes.length-1],"blur",u.bind(this,function(){ga(this.V)}))};n.la=function(){};n.k=function(){this.z("mouseout",u.bind(this,function(){ga(this.V);this.b.blur()}))};function Za(a,b){$.call(this,a,b)}t(Za,$);Za.prototype.r="captions";
|
||||
Za.prototype.L="Captions";Za.prototype.className="vjs-captions-button";function $a(a,b){$.call(this,a,b)}t($a,$);$a.prototype.r="subtitles";$a.prototype.L="Subtitles";$a.prototype.className="vjs-subtitles-button";function ab(a,b){$.call(this,a,b)}t(ab,$);n=ab.prototype;n.r="chapters";n.L="Chapters";n.className="vjs-chapters-button";n.Ra=function(){for(var a=[],b,d=0;d<X(this.a).length;d++)b=X(this.a)[d],b.w()===this.r&&a.push(new Z(this.a,{track:b}));return a};
|
||||
n.xa=function(){for(var a=X(this.a),b=0,d=a.length,e,g,q=this.aa=[];b<d;b++)if(e=a[b],e.w()==this.r&&e.za()){if(2>e.readyState()){this.gc=e;e.e("loaded",u.bind(this,this.xa));return}g=e;break}a=this.V=new S(this.a);a.b.appendChild(u.d("li",{className:"vjs-menu-title",innerHTML:u.I(this.r)}));if(g){e=g.S;for(var m,b=0,d=e.length;b<d;b++)m=e[b],m=new bb(this.a,{track:g,cue:m}),q.push(m),a.C(m)}this.C(a);0<this.aa.length&&this.show();return a};
|
||||
function bb(a,b){var d=this.R=b.track,e=this.cue=b.cue,g=a.currentTime();b.label=e.text;b.selected=e.startTime<=g&&g<e.Z;T.call(this,a,b);d.e("cuechange",u.bind(this,this.update))}t(bb,T);bb.prototype.k=function(){bb.h.k.call(this);this.a.currentTime(this.cue.startTime);this.update(this.cue.startTime)};bb.prototype.update=function(){var a=this.cue,b=this.a.currentTime();a.startTime<=b&&b<a.Z?this.selected(f):this.selected(j)};
|
||||
u.s(E.prototype.options.children,{subtitlesButton:{},captionsButton:{},chaptersButton:{}});if(JSON&&"function"===JSON.parse)u.JSON=JSON;else{u.JSON={};var cb=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;u.JSON.parse=function(a,b){function d(a,e){var m,r,p=a[e];if(p&&"object"===typeof p)for(m in p)Object.prototype.hasOwnProperty.call(p,m)&&(r=d(p,m),r!==c?p[m]=r:delete p[m]);return b.call(a,e,p)}var e;a=String(a);cb.lastIndex=0;cb.test(a)&&(a=a.replace(cb,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)}));
|
||||
if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return e=eval("("+a+")"),"function"===typeof b?d({"":e},""):e;throw new SyntaxError("JSON.parse");}};u.va=function(){var a,b,d=document.getElementsByTagName("video");if(d&&0<d.length)for(var e=0,g=d.length;e<g;e++)if((b=d[e])&&b.getAttribute)b.a===c&&(a=b.getAttribute("data-setup"),a!==h&&(a=u.JSON.parse(a||"{}"),x(b,a)));else{u.Pa();break}else u.Zb||u.Pa()};u.Pa=function(){setTimeout(u.va,1)};u.z(window,"load",function(){u.Zb=f});u.va();s("videojs",u);s("_V_",u);s("videojs.options",u.options);s("videojs.cache",u.M);s("videojs.Component",y);y.prototype.dispose=y.prototype.l;y.prototype.createEl=y.prototype.d;y.prototype.getEl=y.prototype.mc;y.prototype.addChild=y.prototype.C;y.prototype.getChildren=y.prototype.lc;y.prototype.on=y.prototype.e;y.prototype.off=y.prototype.j;y.prototype.one=y.prototype.z;y.prototype.trigger=y.prototype.g;y.prototype.show=y.prototype.show;y.prototype.hide=y.prototype.t;y.prototype.width=y.prototype.width;
|
||||
y.prototype.height=y.prototype.height;y.prototype.dimensions=y.prototype.xb;s("videojs.Player",v);s("videojs.MediaLoader",va);s("videojs.PosterImage",Ga);s("videojs.LoadingSpinner",K);s("videojs.BigPlayButton",J);s("videojs.ControlBar",E);s("videojs.TextTrackDisplay",Xa);s("videojs.Control",D);s("videojs.ControlBar",E);s("videojs.Button",F);s("videojs.PlayButton",G);s("videojs.PauseButton",H);s("videojs.PlayToggle",wa);s("videojs.FullscreenToggle",I);s("videojs.BigPlayButton",J);
|
||||
s("videojs.LoadingSpinner",K);s("videojs.CurrentTimeDisplay",L);s("videojs.DurationDisplay",M);s("videojs.TimeDivider",xa);s("videojs.RemainingTimeDisplay",N);s("videojs.Slider",O);s("videojs.ProgressControl",P);s("videojs.SeekBar",Q);s("videojs.LoadProgressBar",za);s("videojs.PlayProgressBar",Aa);s("videojs.SeekHandle",Ba);s("videojs.VolumeControl",Ca);s("videojs.VolumeBar",Da);s("videojs.VolumeLevel",Ea);s("videojs.VolumeHandle",Fa);s("videojs.MuteToggle",R);s("videojs.PosterImage",Ga);
|
||||
s("videojs.Menu",S);s("videojs.MenuItem",T);s("videojs.SubtitlesButton",$a);s("videojs.CaptionsButton",Za);s("videojs.ChaptersButton",ab);s("videojs.MediaTechController",U);s("videojs.Html5",V);V.Events=Ja;V.isSupported=function(){return!!document.createElement("video").canPlayType};V.canPlaySource=function(a){return!!document.createElement("video").canPlayType(a.type)};V.prototype.setCurrentTime=V.prototype.Qb;V.prototype.setVolume=V.prototype.Vb;V.prototype.setMuted=V.prototype.Tb;
|
||||
V.prototype.setPreload=V.prototype.Ub;V.prototype.setAutoplay=V.prototype.Pb;V.prototype.setLoop=V.prototype.Sb;s("videojs.Flash",W);W.Events=W.ac;
|
||||
W.isSupported=function(){var a="0,0,0";try{a=(new window.ActiveXObject("ShockwaveFlash.ShockwaveFlash")).GetVariable("$version").replace(/\D+/g,",").match(/^,?(.+),?$/)[1]}catch(b){try{navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin&&(a=(navigator.plugins["Shockwave Flash 2.0"]||navigator.plugins["Shockwave Flash"]).description.replace(/\D+/g,",").match(/^,?(.+),?$/)[1])}catch(d){}}return 10<=a.split(",")[0]};W.canPlaySource=function(a){if(a.type in W.prototype.F.Bb)return"maybe"};
|
||||
W.onReady=W.onReady;s("videojs.TextTrack",Y);Y.prototype.label=Y.prototype.label;s("videojs.CaptionsTrack",Ua);s("videojs.SubtitlesTrack",Va);s("videojs.ChaptersTrack",Wa);s("videojs.autoSetup",u.va);module("Component");test("should create an element",function(){var a=new y({},{});ok(a.f().nodeName)});test("should add a child component",function(){var a=new y({}),b=a.C("component");ok(1===a.children().length);ok(a.children()[0]===b);ok(a.f().childNodes[0]===b.f());ok(a.D.component===b);var d=ok,e=b.id();d(a.ga[e]===b)});test("should init child coponents from options",function(){var a=new y({},{children:{component:f}});ok(1===a.children().length);ok(1===a.f().childNodes.length)});
|
||||
test("should dispose of component and children",function(){var a=new y({}),b=a.C("Component");ok(1===a.children().length);a.e("click",l(f));var d=u.getData(a.f()),e=a.f()[u.expando];a.l();ok(!a.children(),"component children were deleted");ok(!a.f(),"component element was deleted");ok(!b.children(),"child children were deleted");ok(!b.f(),"child element was deleted");ok(!u.M[e],"listener cache nulled");ok(u.ja(d),"original listener cache object was emptied")});
|
||||
test("should add and remove event listeners to element",function(){function a(){ok(f,"fired event once");ok(this===b,"listener has the component as context")}var b=new y({},{});expect(2);b.e("test-event",a);b.g("test-event");b.j("test-event",a);b.g("test-event")});test("should trigger a listener once using one()",function(){var a=new y({},{});expect(1);a.z("test-event",function(){ok(f,"fired event once")});a.g("test-event");a.g("test-event")});
|
||||
test("should trigger a listener when ready",function(){expect(2);var a=new y({},{},function(){ok(f,"options listener fired")});z(a);a.G(function(){ok(f,"ready method listener fired")});z(a)});test("should add and remove a CSS class",function(){var a=new y({},{});a.m("test-class");ok(-1!==a.f().className.indexOf("test-class"));a.u("test-class");ok(-1===a.f().className.indexOf("test-class"))});
|
||||
test("should show and hide an element",function(){var a=new y({},{});a.t();ok("none"===a.f().style.display);a.show();ok("block"===a.f().style.display)});
|
||||
test("should change the width and height of a component",function(){var a=document.createElement("div"),b=new y({},{}),d=b.f();document.getElementById("qunit-fixture").appendChild(a);a.appendChild(d);a.style.width="1000px";a.style.height="1000px";b.width("50%");b.height("123px");ok(500===b.width(),"percent values working");ok(u.Ca(d,"width")===b.width()+"px","matches computed style");ok(123===b.height(),"px values working");b.width(321);ok(321===b.width(),"integer values working")});module("Core");test("should create a video tag and have access children in old IE",function(){document.getElementById("qunit-fixture").innerHTML+="<video id='test_vid_id'><source type='video/mp4'></video>";vid=document.getElementById("test_vid_id");ok(1===vid.childNodes.length);ok("video/mp4"===vid.childNodes[0].getAttribute("type"))});
|
||||
test("should return a video player instance",function(){document.getElementById("qunit-fixture").innerHTML+="<video id='test_vid_id'></video><video id='test_vid_id2'></video>";var a=x("test_vid_id");ok(a,"created player from tag");ok("test_vid_id"===a.id());ok(x.P.test_vid_id===a,"added player to global reference");var b=x("test_vid_id");ok(a===b,"did not create a second player from same tag");a=x(document.getElementById("test_vid_id2"));ok("test_vid_id2"===a.id(),"created player from element")});module("Events");test("should add and remove an event listener to an element",function(){function a(){ok(f,"Click Triggered")}expect(1);var b=document.createElement("div");u.e(b,"click",a);u.g(b,"click");u.j(b,"click",a);u.g(b,"click")});test("should remove all listeners of a type",function(){var a=document.createElement("div"),b=0;u.e(a,"click",function(){b++});u.e(a,"click",function(){b++});u.g(a,"click");ok(2===b,"both click listeners fired");u.j(a,"click");u.g(a,"click");ok(2===b,"no click listeners fired")});
|
||||
test("should remove all listeners from an element",function(){expect(2);var a=document.createElement("div");u.e(a,"fake1",function(){ok(f,"Fake1 Triggered")});u.e(a,"fake2",function(){ok(f,"Fake2 Triggered")});u.g(a,"fake1");u.g(a,"fake2");u.j(a);u.g(a,"fake1");u.g(a,"fake2")});test("should listen only once",function(){expect(1);var a=document.createElement("div");u.z(a,"click",function(){ok(f,"Click Triggered")});u.g(a,"click");u.g(a,"click")});module("Lib");test("should create an element",function(){var a=u.d(),b=u.d("span",{"data-test":"asdf",innerHTML:"fdsa"});ok("DIV"===a.nodeName);ok("SPAN"===b.nodeName);ok("asdf"===b["data-test"]);ok("fdsa"===b.innerHTML)});test("should make a string start with an uppercase letter",function(){var a=u.I("bar");ok("Bar"===a)});test("should loop through each property on an object",function(){var a={rb:1,sb:2,c:3};u.Y(a,function(b,d){a[b]=d+3});deepEqual(a,{rb:4,sb:5,c:6})});
|
||||
test("should add context to a function",function(){var a={test:"obj"};u.bind(a,function(){ok(this===a)})()});test("should add and remove a class name on an element",function(){var a=document.createElement("div");u.m(a,"test-class");ok("test-class"===a.className,"class added");u.m(a,"test-class");ok("test-class"===a.className,"same class not duplicated");u.m(a,"test-class2");ok("test-class test-class2"===a.className,"added second class");u.u(a,"test-class");ok("test-class2"===a.className,"removed first class")});
|
||||
test("should get and remove data from an element",function(){var a=document.createElement("div"),b=u.getData(a),d=a[u.expando];ok("object"===typeof b,"data object created");var e={dc:"fdsa"};b.test=e;ok(u.getData(a).test===e,"data added");u.Ma(a);ok(!u.M[d],"cached item nulled");ok(a[u.expando]===h||a[u.expando]===c,"element data id removed")});
|
||||
test("should read tag attributes from elements, including HTML5 in all browsers",function(){var a=document.createElement("div"),b;b='<video id="vid1" controls autoplay loop muted preload="none" src="http://google.com" poster="http://www2.videojs.com/img/video-js-html5-video-player.png" data-test="asdf" data-empty-string=""></video><video id="vid2"><source id="source" src="http://google.com" type="video/mp4" media="fdsa" title="test" >';b+='<track id="track" default src="http://google.com" kind="captions" srclang="en" label="testlabel" title="test" >';
|
||||
a.innerHTML+=b;document.getElementById("qunit-fixture").appendChild(a);a=u.N(document.getElementById("vid2"));b=u.N(document.getElementById("source"));var d=u.N(document.getElementById("track"));deepEqual(u.N(document.getElementById("vid1")),{autoplay:f,controls:f,"data-test":"asdf","data-empty-string":"",id:"vid1",loop:f,muted:f,poster:"http://www2.videojs.com/img/video-js-html5-video-player.png",preload:"none",src:"http://google.com"});deepEqual(a,{id:"vid2"});deepEqual(b,{title:"test",media:"fdsa",
|
||||
type:"video/mp4",src:"http://google.com",id:"source"});deepEqual(d,{"default":f,id:"track",kind:"captions",label:"testlabel",src:"http://google.com",srclang:"en",title:"test"})});
|
||||
test("should get the right style values for an element",function(){var a=document.createElement("div"),b=document.createElement("div"),d=document.getElementById("qunit-fixture");b.appendChild(a);d.appendChild(b);b.style.width="1000px";b.style.height="1000px";a.style.height="100%";a.style.width="123px";ok("1000px"===u.Ca(a,"height"));ok("123px"===u.Ca(a,"width"))});
|
||||
test("should insert an element first in another",function(){var a=document.createElement("div"),b=document.createElement("div"),d=document.createElement("div");u.$(a,d);ok(d.firstChild===a,"inserts first into empty parent");u.$(b,d);ok(d.firstChild===b,"inserts first into parent with child")});
|
||||
test("should return the element with the ID",function(){var a=document.createElement("div"),b=document.createElement("div"),d=document.getElementById("qunit-fixture");d.appendChild(a);d.appendChild(b);a.id="test_id1";b.id="test_id2";ok(u.f("test_id1")===a,"found element for ID");ok(u.f("#test_id2")===b,"found element for CSS ID")});test("should trim whitespace from a string",function(){ok("asdf asdf asdf"===u.trim(" asdf asdf asdf \t\n\r"))});
|
||||
test("should round a number",function(){ok(1===u.round(1.01));ok(2===u.round(1.5));ok(1.55===u.round(1.55,2));ok(10.55===u.round(10.551,2))});
|
||||
test("should format time as a string",function(){ok("0:01"===u.o(1));ok("0:10"===u.o(10));ok("1:00"===u.o(60));ok("10:00"===u.o(600));ok("1:00:00"===u.o(3600));ok("10:00:00"===u.o(36E3));ok("100:00:00"===u.o(36E4));ok("0:01"===u.o(1,1));ok("0:01"===u.o(1,10));ok("0:01"===u.o(1,60));ok("00:01"===u.o(1,600));ok("0:00:01"===u.o(1,3600));ok("0:00:01"===u.o(1,36E3));ok("0:00:01"===u.o(1,36E4))});test("should create a fake timerange",function(){var a=u.ya(10);ok(0===a.start());ok(10===a.end())});
|
||||
test("should get an absolute URL",function(){ok("http://asdf.com"===u.ia("http://asdf.com"));ok("https://asdf.com/index.html"===u.ia("https://asdf.com/index.html"))});module("HTML5");module("Player");function db(){var a=document.createElement("video");a.id="example_1";a.className="video-js vjs-default-skin";return a}function fb(a){var b=db();document.getElementById("qunit-fixture").appendChild(b);return player=new v(b,a)}test("should create player instance that inherits from component and dispose it",function(){var a=fb();ok("DIV"===a.f().nodeName);ok(a.e,"component function exists");a.l();ok(a.f()===h,"element disposed")});
|
||||
test("should accept options from multiple sources and override in correct order",function(){u.options.attr=1;var a=db(),a=new v(a);ok(1===a.options.attr,"global option was set");a.l();a=db();a.setAttribute("attr","asdf");a=new v(a);ok("asdf"===a.options.attr,"Tag options overrode global options");a.l();a=db();a.setAttribute("attr","asdf");a=new v(a,{attr:"fdsa"});ok("fdsa"===a.options.attr,"Init options overrode tag and global options");a.l()});
|
||||
test("should get tag, source, and track settings",function(){var a=document.getElementById("qunit-fixture"),b;b='<video id="example_1" class="video-js" autoplay preload="metadata"><source src="http://google.com" type="video/mp4"><source src="http://google.com" type="video/webm">';b+='<track src="http://google.com" kind="captions" default>';b+="</video>";a.innerHTML+=b;a=document.getElementById("example_1");b=new v(a);ok(b.options.autoplay===f);ok("metadata"===b.options.preload);ok("example_1"===b.options.id);
|
||||
ok(2===b.options.sources.length);ok("http://google.com"===b.options.sources[0].src);ok("video/mp4"===b.options.sources[0].type);ok("video/webm"===b.options.sources[1].type);ok(1===b.options.tracks.length);ok("captions"===b.options.tracks[0].kind);ok(b.options.tracks[0]["default"]===f);ok(-1!==b.f().className.indexOf("video-js"),"transferred class from tag to player div");ok("example_1"===b.f().id,"transferred id from tag to player div");ok(a.a===b,"player referenceable on original tag");ok(u.P[b.id()]===
|
||||
b,"player referenceable from global list");ok(a.id!==b.id,"tag ID no longer is the same as player ID");ok(a.className!==b.f().className,"tag classname updated");b.l();ok(a.a===h,"tag player ref killed");ok(!u.P.example_1,"global player ref killed");ok(b.f()===h,"player el killed")});
|
||||
test("should set the width and height of the player",function(){var a=fb({width:123,height:"100%"});ok(123===a.width());ok("123px"===a.f().style.width);var b=document.getElementById("qunit-fixture"),d=document.createElement("div");b.appendChild(d);d.appendChild(a.f());d.style.height="1000px";ok(1E3===a.height());a.l()});
|
||||
test("should accept options from multiple sources and override in correct order",function(){var a=db(),b=document.createElement("div"),d=document.getElementById("qunit-fixture");b.appendChild(a);d.appendChild(b);var d=new v(a),e=d.f();ok(e.parentNode===b,"player placed at same level as tag");ok(a.parentNode!==b,"tag removed from original place");d.l()});
|
||||
test("should load a media controller",function(){var a=fb({ca:"none",rc:[{src:"http://google.com",type:"video/mp4"},{src:"http://google.com",type:"video/webm"}]});ok(-1!==a.f().children[0].className.indexOf("vjs-tech"),"media controller loaded");a.l()});module("Setup");})();//@ sourceMappingURL=video.js.map
|
Loading…
x
Reference in New Issue
Block a user