Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Update grunt build script.

  • Loading branch information...
commit 0f0fccc3128d4d9747f8040f968c8f61e8945334 1 parent e7c146b
@heff heff authored
Showing with 337 additions and 1,495 deletions.
  1. +81 −91 Gruntfile.js
  2. +0 −10 Makefile
  3. +0 −20 build/release-files/youtube.html
  4. +4 −4 package.json
  5. +5 −0 src/js/component.js
  6. +6 −0 src/js/controls.js
  7. +4 −1 src/js/core.js
  8. +10 −5 src/js/events.js
  9. +11 −0 src/js/exports.js
  10. +2 −0  src/js/json.js
  11. +11 −7 src/js/lib.js
  12. +4 −0 src/js/media.flash.js
  13. +4 −0 src/js/media.html5.js
  14. +4 −0 src/js/media.js
  15. +4 −0 src/js/player.js
  16. +5 −0 src/js/setup.js
  17. +6 −0 src/js/tracks.js
  18. +0 −90 test/dev-compiled.html
  19. +59 −0 test/index.html
  20. +0 −42 test/integration.html
  21. +0 −304 test/integration/test.js
  22. +0 −22 test/phantom-logging.js
  23. +0 −63 test/phantom.js
  24. 0  test/{vendor → }/qunit/.gitignore
  25. 0  test/{vendor → }/qunit/README.md
  26. 0  test/{vendor → }/qunit/addons/canvas/README.md
  27. 0  test/{vendor → }/qunit/addons/canvas/canvas-test.js
  28. 0  test/{vendor → }/qunit/addons/canvas/canvas.html
  29. 0  test/{vendor → }/qunit/addons/canvas/qunit-canvas.js
  30. 0  test/{vendor → }/qunit/addons/close-enough/README.md
  31. 0  test/{vendor → }/qunit/addons/close-enough/close-enough-test.js
  32. 0  test/{vendor → }/qunit/addons/close-enough/close-enough.html
  33. 0  test/{vendor → }/qunit/addons/close-enough/qunit-close-enough.js
  34. 0  test/{vendor → }/qunit/addons/composite/README.md
  35. 0  test/{vendor → }/qunit/addons/composite/composite-demo-test.html
  36. 0  test/{vendor → }/qunit/addons/composite/composite-test.html
  37. 0  test/{vendor → }/qunit/addons/composite/composite-test.js
  38. 0  test/{vendor → }/qunit/addons/composite/dummy-qunit-test.html
  39. 0  test/{vendor → }/qunit/addons/composite/dummy-same-test.html
  40. 0  test/{vendor → }/qunit/addons/composite/index.html
  41. 0  test/{vendor → }/qunit/addons/composite/qunit-composite.css
  42. 0  test/{vendor → }/qunit/addons/composite/qunit-composite.js
  43. 0  test/{vendor → }/qunit/addons/step/README.md
  44. 0  test/{vendor → }/qunit/addons/step/qunit-step.js
  45. 0  test/{vendor → }/qunit/addons/step/step-test.js
  46. 0  test/{vendor → }/qunit/addons/step/step.html
  47. 0  test/{vendor → }/qunit/package.json
  48. 0  test/{ → qunit}/qunit-externs.js
  49. 0  test/{vendor → }/qunit/qunit/qunit.css
  50. 0  test/{vendor → }/qunit/qunit/qunit.js
  51. 0  test/{vendor → }/qunit/test/headless.html
  52. 0  test/{vendor → }/qunit/test/index.html
  53. 0  test/{vendor → }/qunit/test/logs.html
  54. 0  test/{vendor → }/qunit/test/logs.js
  55. 0  test/{vendor → }/qunit/test/same.js
  56. 0  test/{vendor → }/qunit/test/test.js
  57. +0 −14 test/server.js
  58. +0 −1  test/src
  59. +0 −29 test/unit-compiled.html
  60. +0 −49 test/unit.html
  61. +0 −646 test/unit.js
  62. +0 −97 test/video.compiled.js
  63. +117 −0 test/video.test.js
View
172 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']);
+
+ grunt.registerTask('test', ['build', 'jshint', 'qunit']);
- var exec = require('child_process').exec,
- fs = require('fs'),
+ 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');
- }
+ var calcdeps = require('calcdeps').calcdeps;
+ // caclcdeps is async
+ var done = this.async();
+ // 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);
+ }
+
+ if (results) {
+ grunt.file.write('dist/sourcelist.txt', results.join(','));
+ grunt.file.write('dist/sourcelist.js', 'var sourcelist = ["' + results.join('","') + '"]');
+ }
+
+ done();
+ });
});
- grunt.registerTask('compile', 'Minify JS files using Closure Compiler.', function() {
+ grunt.registerMultiTask('compile', 'Minify JS files using Closure Compiler.', function() {
var done = this.async();
+ var exec = require('child_process').exec;
- var command = 'java -jar build/compiler/compiler.jar';
- command += ' --compilation_level ADVANCED_OPTIMIZATIONS';
-
- 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'
- ];
+ 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(){
+
+ });
};
View
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
View
20 build/release-files/youtube.html
@@ -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>
View
8 package.json
@@ -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"
}
}
View
5 src/js/component.js
@@ -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
View
6 src/js/controls.js
@@ -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
View
5 src/js/core.js
@@ -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');
View
15 src/js/events.js
@@ -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
View
11 src/js/exports.js
@@ -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);
View
2  src/js/json.js
@@ -1,3 +1,5 @@
+goog.provide('vjs.JSON');
+
/**
* Javascript JSON implementation
* (Parse Method Only)
View
18 src/js/lib.js
@@ -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];
}
View
4 src/js/media.flash.js
@@ -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
View
4 src/js/media.html5.js
@@ -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
View
4 src/js/media.js
@@ -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
View
4 src/js/player.js
@@ -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
View
5 src/js/setup.js
@@ -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,
View
6 src/js/tracks.js
@@ -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
View
90 test/dev-compiled.html
@@ -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>
View
59 test/index.html
@@ -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>
View
42 test/integration.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>
View
304 test/integration/test.js
@@ -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();
-});
View
22 test/phantom-logging.js
@@ -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;
-});
View
63 test/phantom.js
@@ -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)
- })
- }
-})
View
0  test/vendor/qunit/.gitignore → test/qunit/.gitignore
File renamed without changes
View
0  test/vendor/qunit/README.md → test/qunit/README.md
File renamed without changes
View
0  test/vendor/qunit/addons/canvas/README.md → test/qunit/addons/canvas/README.md
File renamed without changes
View
0  test/vendor/qunit/addons/canvas/canvas-test.js → test/qunit/addons/canvas/canvas-test.js
File renamed without changes
View
0  test/vendor/qunit/addons/canvas/canvas.html → test/qunit/addons/canvas/canvas.html
File renamed without changes
View
0  test/vendor/qunit/addons/canvas/qunit-canvas.js → test/qunit/addons/canvas/qunit-canvas.js
File renamed without changes
View
0  test/vendor/qunit/addons/close-enough/README.md → test/qunit/addons/close-enough/README.md
File renamed without changes
View
0  ...or/qunit/addons/close-enough/close-enough-test.js → test/qunit/addons/close-enough/close-enough-test.js
File renamed without changes
View
0  ...endor/qunit/addons/close-enough/close-enough.html → test/qunit/addons/close-enough/close-enough.html
File renamed without changes
View
0  ...r/qunit/addons/close-enough/qunit-close-enough.js → test/qunit/addons/close-enough/qunit-close-enough.js
File renamed without changes
View
0  test/vendor/qunit/addons/composite/README.md → test/qunit/addons/composite/README.md
File renamed without changes
View
0  ...r/qunit/addons/composite/composite-demo-test.html → test/qunit/addons/composite/composite-demo-test.html
File renamed without changes
View
0  ...vendor/qunit/addons/composite/composite-test.html → test/qunit/addons/composite/composite-test.html
File renamed without changes
View
0  test/vendor/qunit/addons/composite/composite-test.js → test/qunit/addons/composite/composite-test.js
File renamed without changes
View
0  ...ndor/qunit/addons/composite/dummy-qunit-test.html → test/qunit/addons/composite/dummy-qunit-test.html
File renamed without changes
View
0  ...endor/qunit/addons/composite/dummy-same-test.html → test/qunit/addons/composite/dummy-same-test.html
File renamed without changes
View
0  test/vendor/qunit/addons/composite/index.html → test/qunit/addons/composite/index.html
File renamed without changes
View
0  ...vendor/qunit/addons/composite/qunit-composite.css → test/qunit/addons/composite/qunit-composite.css
File renamed without changes
View
0  .../vendor/qunit/addons/composite/qunit-composite.js → test/qunit/addons/composite/qunit-composite.js
File renamed without changes
View
0  test/vendor/qunit/addons/step/README.md → test/qunit/addons/step/README.md
File renamed without changes
View
0  test/vendor/qunit/addons/step/qunit-step.js → test/qunit/addons/step/qunit-step.js
File renamed without changes
View
0  test/vendor/qunit/addons/step/step-test.js → test/qunit/addons/step/step-test.js
File renamed without changes
View
0  test/vendor/qunit/addons/step/step.html → test/qunit/addons/step/step.html
File renamed without changes
View
0  test/vendor/qunit/package.json → test/qunit/package.json
File renamed without changes
View
0  test/qunit-externs.js → test/qunit/qunit-externs.js
File renamed without changes
View
0  test/vendor/qunit/qunit/qunit.css → test/qunit/qunit/qunit.css
File renamed without changes
View
0  test/vendor/qunit/qunit/qunit.js → test/qunit/qunit/qunit.js
File renamed without changes
View
0  test/vendor/qunit/test/headless.html → test/qunit/test/headless.html
File renamed without changes
View
0  test/vendor/qunit/test/index.html → test/qunit/test/index.html
File renamed without changes
View
0  test/vendor/qunit/test/logs.html → test/qunit/test/logs.html
File renamed without changes
View
0  test/vendor/qunit/test/logs.js → test/qunit/test/logs.js
File renamed without changes
View
0  test/vendor/qunit/test/same.js → test/qunit/test/same.js
File renamed without changes
View
0  test/vendor/qunit/test/test.js → test/qunit/test/test.js
File renamed without changes
View
14 test/server.js
@@ -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')
View
1  test/src
View
29 test/unit-compiled.html
@@ -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>
View
49 test/unit.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>
View
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.")
-}
View
97 test/video.compiled.js
@@ -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=<