1
0
mirror of https://github.com/videojs/video.js.git synced 2025-06-17 00:17:49 +02:00

More build and testing cleanup. Also some reorganization.

This commit is contained in:
heff
2015-03-27 22:59:21 -07:00
committed by Matthew McClure
parent 0c9d53321f
commit 6e5fc8d687
33 changed files with 217 additions and 931 deletions

1
.gitignore vendored
View File

@ -1,6 +1,7 @@
.DS_Store .DS_Store
dist/* dist/*
build/files/* build/files/*
build/temp/*
docs/api/* docs/api/*
dev.html dev.html
projects projects

View File

@ -1,53 +1,22 @@
module.exports = function(grunt) { module.exports = function(grunt) {
var pkg, version, verParts, license, licenseNoVtt; var pkg = grunt.file.readJSON('package.json');
var license = grunt.file.read('build/license-header.txt');
pkg = grunt.file.readJSON('package.json'); var verParts = pkg.version.split('.');
var version = {
verParts = pkg.version.split('.');
version = {
full: pkg.version, full: pkg.version,
major: verParts[0], major: verParts[0],
minor: verParts[1], minor: verParts[1],
patch: verParts[2] patch: verParts[2]
}; };
version.majorMinor = version.major + '.' + version.minor; version.majorMinor = version.major + '.' + version.minor;
grunt.vjsVersion = version; grunt.vjsVersion = version;
licenseNoVtt = '/**\n'+
' * @license\n'+
' * Video.js '+version.full+' <http://videojs.com/>\n'+
' * <%= pkg.copyright %>\n'+
' * Available under Apache License Version 2.0\n'+
' * <https://github.com/videojs/video.js/blob/master/LICENSE>\n'+
' */\n';
license = licenseNoVtt.slice(0, -4) +
' * \n'+
' * Includes vtt.js <https://github.com/mozilla/vtt.js>\n'+
' * Available under Apache License Version 2.0\n'+
' * <https://github.com/mozilla/vtt.js/blob/master/LICENSE>\n'+
' */\n';
// loading predefined source order from source-loader.js
// trust me, this is the easist way to do it so far
/*jshint undef:false, evil:true */
var blockSourceLoading = true;
var sourceFiles; // Needed to satisfy jshint
eval(grunt.file.read('./build/source-loader.js'));
grunt.sourceFiles = sourceFiles;
// Project configuration. // Project configuration.
grunt.initConfig({ grunt.initConfig({
pkg: pkg, pkg: pkg,
build: {
src: 'src/js/dependencies.js',
options: {
baseDir: 'src/js/'
}
},
clean: { clean: {
build: ['build/files/*'], build: ['build/temp/*'],
dist: ['dist/*'] dist: ['dist/*']
}, },
jshint: { jshint: {
@ -61,6 +30,8 @@ module.exports = function(grunt) {
uglify: { uglify: {
options: { options: {
sourceMap: true, sourceMap: true,
sourceMapIn: 'build/temp/video.js.map',
sourceMapRoot: '../../src/js',
preserveComments: 'some', preserveComments: 'some',
mangle: true, mangle: true,
compress: { compress: {
@ -74,25 +45,13 @@ module.exports = function(grunt) {
drop_console: true drop_console: true
} }
}, },
source: { build: {
files: { files: {
'build/files/minified.video.js': 'build/files/combined.video.js', 'build/temp/video.min.js': 'build/temp/video.js'
'build/files/minified.video.novtt.js': 'build/files/combined.video.novtt.js'
}
},
tests: {
files: {
'build/files/test.minified.video.js': ['build/files/combined.video.js', 'test/unit/*.js']
} }
} }
}, },
dist: {}, dist: {},
qunit: {
source: ['test/index.html'],
minified: ['test/minified.html'],
minified_api: ['test/minified-api.html'],
es6: ['test/es6.html']
},
watch: { watch: {
files: [ 'src/**/*', 'test/unit/**/*.js', 'Gruntfile.js' ], files: [ 'src/**/*', 'test/unit/**/*.js', 'Gruntfile.js' ],
tasks: 'dev' tasks: 'dev'
@ -108,14 +67,20 @@ module.exports = function(grunt) {
copy: { copy: {
minor: { minor: {
files: [ files: [
{expand: true, cwd: 'build/files/', src: ['*'], dest: 'dist/'+version.majorMinor+'/', filter: 'isFile'} // includes files in path {expand: true, cwd: 'build/temp/', src: ['*'], dest: 'dist/'+version.majorMinor+'/', filter: 'isFile'} // includes files in path
] ]
}, },
patch: { patch: {
files: [ files: [
{expand: true, cwd: 'build/files/', src: ['*'], dest: 'dist/'+version.full+'/', filter: 'isFile'} // includes files in path {expand: true, cwd: 'build/temp/', src: ['*'], dest: 'dist/'+version.full+'/', filter: 'isFile'} // includes files in path
] ]
} },
fonts: { expand: true, cwd: 'src/css/font/', src: ['*'], dest: 'build/temp/font/', filter: 'isFile' },
swf: { src: './node_modules/videojs-swf/dist/video-js.swf', dest: './build/temp/video-js.swf' },
novtt: { src: './build/temp/video.js', dest: './build/temp/alt/video.novtt.js' },
dist: { expand: true, cwd: 'build/temp/', src: ['**/**'], dest: 'dist/', filter: 'isFile' },
examples: { expand: true, cwd: 'build/examples/', src: ['**/**'], dest: 'dist/examples/', filter: 'isFile' },
cdn: { expand: true, cwd: 'dist/', src: ['**/**'], dest: 'dist/cdn/', filter: 'isFile' },
}, },
aws_s3: { aws_s3: {
options: { options: {
@ -172,16 +137,16 @@ module.exports = function(grunt) {
cssmin: { cssmin: {
minify: { minify: {
expand: true, expand: true,
cwd: 'build/files/', cwd: 'build/temp/',
src: ['video-js.css'], src: ['video-js.css'],
dest: 'build/files/', dest: 'build/temp/',
ext: '.min.css' ext: '.min.css'
} }
}, },
less: { less: {
dev: { dev: {
files: { files: {
'build/files/video-js.css': 'src/css/video-js.less' 'build/temp/video-js.css': 'src/css/video-js.less'
} }
} }
}, },
@ -191,115 +156,30 @@ module.exports = function(grunt) {
configFile: 'test/karma.conf.js' configFile: 'test/karma.conf.js'
}, },
// this only runs on PRs from the mainrepo on saucelabs
saucelabs: {
browsers: ['chrome_sl']
},
chrome_sl: {
browsers: ['chrome_sl']
},
firefox_sl: {
browsers: ['firefox_sl']
},
safari_sl: {
browsers: ['safari_sl']
},
ipad_sl: {
browsers: ['ipad_sl']
},
android_sl: {
browsers: ['android_sl']
},
ie_sl: {
browsers: ['ie_sl']
},
// these are run locally on local browsers // these are run locally on local browsers
dev: { dev: {
browsers: ['Chrome', 'Firefox', 'Safari'] browsers: ['Chrome', 'Firefox', 'Safari']
}, },
chromecanary: { chromecanary: { browsers: ['ChromeCanary'] },
browsers: ['ChromeCanary'] chrome: { browsers: ['Chrome'] },
}, firefox: { browsers: ['Firefox'] },
chrome: { safari: { browsers: ['Safari'] },
browsers: ['Chrome'] ie: { browsers: ['IE'] },
}, phantomjs: { browsers: ['PhantomJS'] },
firefox: {
browsers: ['Firefox']
},
safari: {
browsers: ['Safari']
},
ie: {
browsers: ['IE']
},
phantomjs: {
browsers: ['PhantomJS']
},
// This is all the minified tests run locally on local browsers // this only runs on PRs from the mainrepo on saucelabs
minified_dev: { saucelabs: { browsers: ['chrome_sl'] },
browsers: ['Chrome', 'Firefox', 'Safari'], chrome_sl: { browsers: ['chrome_sl'] },
configFile: 'test/karma.minified.conf.js' firefox_sl: { browsers: ['firefox_sl'] },
}, safari_sl: { browsers: ['safari_sl'] },
minified_chromecanary: { ipad_sl: { browsers: ['ipad_sl'] },
browsers: ['ChromeCanary'], android_sl: { browsers: ['android_sl'] },
configFile: 'test/karma.minified.conf.js' ie_sl: { browsers: ['ie_sl'] }
},
minified_chrome: {
browsers: ['Chrome'],
configFile: 'test/karma.minified.conf.js'
},
minified_firefox: {
browsers: ['Firefox'],
configFile: 'test/karma.minified.conf.js'
},
minified_safari: {
browsers: ['Safari'],
configFile: 'test/karma.minified.conf.js'
},
minified_ie: {
browsers: ['IE'],
configFile: 'test/karma.minified.conf.js'
},
minified_phantomjs: {
browsers: ['PhantomJS'],
configFile: 'test/karma.minified.conf.js'
},
// This is all the minified api tests run locally on local browsers
minified_api_dev: {
browsers: ['Chrome', 'Firefox', 'Safari'],
configFile: 'test/karma.minified.api.conf.js'
},
minified_api_chromecanary: {
browsers: ['ChromeCanary'],
configFile: 'test/karma.minified.api.conf.js'
},
minified_api_chrome: {
browsers: ['Chrome'],
configFile: 'test/karma.minified.api.conf.js'
},
minified_api_firefox: {
browsers: ['Firefox'],
configFile: 'test/karma.minified.api.conf.js'
},
minified_api_safari: {
browsers: ['Safari'],
configFile: 'test/karma.minified.api.conf.js'
},
minified_api_ie: {
browsers: ['IE'],
configFile: 'test/karma.minified.api.conf.js'
},
minified_api_phantomjs: {
browsers: ['PhantomJS'],
configFile: 'test/karma.minified.api.conf.js'
}
}, },
vjsdocs: { vjsdocs: {
all: { all: {
src: sourceFiles, // TODO: Update vjsdocs to support new build, or switch to jsdoc
src: '',
dest: 'docs/api', dest: 'docs/api',
options: { options: {
baseURL: 'https://github.com/videojs/video.js/blob/master/' baseURL: 'https://github.com/videojs/video.js/blob/master/'
@ -309,7 +189,7 @@ module.exports = function(grunt) {
vjslanguages: { vjslanguages: {
defaults: { defaults: {
files: { files: {
'build/files/lang': ['lang/*.json'] 'build/temp/lang': ['lang/*.json']
} }
} }
}, },
@ -320,33 +200,10 @@ module.exports = function(grunt) {
return path.relative('dist', filepath); return path.relative('dist', filepath);
}, },
// compression: 'DEFLATE', // compression: 'DEFLATE',
src: ['dist/video-js/**/*'], src: ['dist/**/*'],
dest: 'dist/video-js-' + version.full + '.zip' dest: 'dist/video-js-' + version.full + '.zip'
} }
}, },
usebanner: {
options: {
position: 'top',
banner: license,
linebreak: true
},
dist: {
options: {
banner: license
},
files: {
src: [ 'build/files/combined.video.js']
}
},
novtt: {
options: {
banner: licenseNoVtt
},
files: {
src: [ 'build/files/combined.video.novtt.js']
}
}
},
version: { version: {
options: { options: {
pkg: 'package.json' pkg: 'package.json'
@ -368,6 +225,12 @@ module.exports = function(grunt) {
release: 'patch' release: 'patch'
}, },
src: ['package.json', 'bower.json', 'component.json'] src: ['package.json', 'bower.json', 'component.json']
},
css: {
options: {
prefix: '@version\\s*'
},
src: 'build/temp/video-js.css'
} }
}, },
'github-release': { 'github-release': {
@ -388,40 +251,64 @@ module.exports = function(grunt) {
} }
}, },
browserify: { browserify: {
dist: { build: {
files: { files: {
'build/files/video-es6.js': ['src/js/video.js'] 'build/temp/video.js': ['src/js/video.js']
}, },
options: { options: {
browserifyOptions: { browserifyOptions: {
debug: true, debug: true,
standalone: 'videojs' standalone: 'videojs'
}, },
banner: license,
transform: [ transform: [
require('babelify').configure({ require('babelify').configure({
sourceMapRelative: './src/js' sourceMapRelative: './src/js'
}) }),
['browserify-versionify', {
placeholder: '__VERSION__',
version: pkg.version
}],
['browserify-versionify', {
placeholder: '__VERSION_NO_PATCH__',
version: version.majorMinor
}]
] ]
} }
} }
}, },
exorcise: {
build: {
options: {},
files: {
'build/temp/video.js.map': ['build/temp/video.js'],
}
}
},
coveralls: { coveralls: {
all: { all: {
src: 'test/coverage/lcov.info' src: 'test/coverage/lcov.info'
} }
},
concat: {
vtt: {
options: {
separator: '\n',
},
src: ['build/temp/video.js', 'node_modules/vtt.js/dist/vtt.js'],
dest: 'build/temp/video.js',
},
} }
}); });
grunt.loadNpmTasks('grunt-videojs-languages'); grunt.loadNpmTasks('grunt-videojs-languages');
grunt.loadNpmTasks('grunt-contrib-connect'); grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-qunit');
grunt.loadNpmTasks('grunt-contrib-watch'); grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-clean'); grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-copy'); grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-cssmin'); grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-less'); grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('contribflow');
grunt.loadNpmTasks('grunt-karma'); grunt.loadNpmTasks('grunt-karma');
grunt.loadNpmTasks('videojs-doc-generator'); grunt.loadNpmTasks('videojs-doc-generator');
grunt.loadNpmTasks('grunt-zip'); grunt.loadNpmTasks('grunt-zip');
@ -434,15 +321,49 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-browserify'); grunt.loadNpmTasks('grunt-browserify');
grunt.loadNpmTasks('grunt-coveralls'); grunt.loadNpmTasks('grunt-coveralls');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-exorcise');
grunt.registerTask('build', [
'clean:build',
'jshint',
'browserify',
'copy:novtt',
'concat:vtt',
'exorcise',
'uglify',
'less',
'version:css',
'cssmin',
'copy:fonts',
'copy:swf',
'vjslanguages'
]);
grunt.registerTask('dist', [
'clean:dist',
'build',
'copy:dist',
'copy:examples',
'zip:dist'
]);
grunt.registerTask('cdn', [
'dist',
'copy:cdn',
'dist-cdn'
]);
// Remove this and add to the test task once mmcc's coverall changes are merged
grunt.registerTask('newtest', ['build', 'karma:chrome']);
grunt.registerTask('pretask', ['jshint', 'less', 'vjslanguages', 'browserify', 'usebanner']);
// Default task. // Default task.
grunt.registerTask('default', ['pretask', 'dist']); grunt.registerTask('default', ['build', 'test']);
// Development watch task
grunt.registerTask('dev', ['jshint', 'less', 'vjslanguages', 'browserify:dist', 'usebanner', 'karma:chrome']);
grunt.registerTask('dist', 'Creating distribution', ['dist-copy', 'zip:dist']); // Development watch task. Doing the minimum required.
grunt.registerTask('dev', ['jshint', 'less', 'browserify', 'karma:chrome']);
// Load all the tasks in the tasks directory // Load all the tasks in the tasks directory
grunt.loadTasks('tasks'); grunt.loadTasks('build/tasks');
}; };

View File

@ -1,4 +1,4 @@
Copyright 2013 Brightcove, Inc. Copyright Brightcove, Inc.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,6 +1,3 @@
import pkg from '../../package.json';
import window from 'global/window';
/** /**
* Google Analytics tracking pixel for the freely hosted version of Video.js * Google Analytics tracking pixel for the freely hosted version of Video.js
* at vjs.zencdn.net. We'll use this data to develop a support matrix of * at vjs.zencdn.net. We'll use this data to develop a support matrix of
@ -11,12 +8,8 @@ import window from 'global/window';
* *
* @type {Image} * @type {Image}
*/ */
var sendGaEvent = function(image) { ;(function(i,w,n,e,l){
const i = new window.Image(); l=w.location;
const w = window;
const n = window.navigator;
const l = window.location;
const e = window.encodeURIComponent;
// Google Analytics has a limit of 10 million hits per month for free accounts. // Google Analytics has a limit of 10 million hits per month for free accounts.
// The Video.js CDN goes over this (by a lot) and they've asked us to stop. // The Video.js CDN goes over this (by a lot) and they've asked us to stop.
@ -64,8 +57,6 @@ var sendGaEvent = function(image) {
// Random number used as cache buster instead of utmn // Random number used as cache buster instead of utmn
+'&utmcc=__utma%3D1.'+Math.floor(Math.random()*1e10)+'.1.1.1.1%3B' +'&utmcc=__utma%3D1.'+Math.floor(Math.random()*1e10)+'.1.1.1.1%3B'
// Custom Var: vjsv is the variable name and 1.0.0 is the VJS version // Custom Var: vjsv is the variable name and 1.0.0 is the VJS version
+'&utme=8(vjsv)9('+ pkg.version +')' +'&utme=8(vjsv)9(v0.0.0)'
; ;
}; })(new Image(),window,navigator,encodeURIComponent);
export default sendGaEvent;

11
build/license-header.txt Normal file
View File

@ -0,0 +1,11 @@
/**
* @license
* Video.js <%= pkg.version %> <http://videojs.com/>
* <%= pkg.copyright %>
* Available under Apache License Version 2.0
* <https://github.com/videojs/video.js/blob/master/LICENSE>
*
* Includes vtt.js <https://github.com/mozilla/vtt.js>
* Available under Apache License Version 2.0
* <https://github.com/mozilla/vtt.js/blob/master/LICENSE>
*/

View File

@ -1,84 +0,0 @@
// This file is used to load the video.js source files into a page
// in the correct order based on dependencies.
// When you create a new source file you will need to add
// it to the list below to use it in sandbox/index.html and
// test/index.html
// You can use the projectRoot variable to adjust relative urls
// that this script loads. By default it's "../", which is what /sandbox
// and /test need. If you had sandbox/newDir/index.html, in index.html you
// would set projectRoot = "../../"
// We could use somehting like requireJS to load files, and at one point
// we used goog.require/provide to load dependencies, but that seems like
// overkill with the small number of files we actually have.
// ADD NEW SOURCE FILES HERE
var sourceFiles = [
"src/js/core.js",
"src/js/core-object.js",
"src/js/events.js",
"src/js/lib.js",
"src/js/xhr.js",
"src/js/util.js",
"src/js/event-emitter.js",
"src/js/component.js",
"src/js/button.js",
"src/js/slider.js",
"src/js/menu.js",
"src/js/media-error.js",
"src/js/fullscreen-api.js",
"src/js/player.js",
"src/js/control-bar/control-bar.js",
"src/js/control-bar/live-display.js",
"src/js/control-bar/play-toggle.js",
"src/js/control-bar/time-display.js",
"src/js/control-bar/fullscreen-toggle.js",
"src/js/control-bar/progress-control.js",
"src/js/control-bar/volume-control.js",
"src/js/control-bar/mute-toggle.js",
"src/js/control-bar/volume-menu-button.js",
"src/js/control-bar/playback-rate-menu-button.js",
"src/js/poster.js",
"src/js/loading-spinner.js",
"src/js/big-play-button.js",
"src/js/error-display.js",
"src/js/media/media.js",
"src/js/media/html5.js",
"src/js/media/flash.js",
"src/js/media/flash-rtmp.js",
"src/js/media/loader.js",
"src/js/tracks/text-track-enums.js",
"src/js/tracks/text-track.js",
"src/js/tracks/text-track-list.js",
"src/js/tracks/text-track-cue-list.js",
"src/js/tracks/text-track-controls.js",
"src/js/tracks/text-track-settings.js",
"src/js/json.js",
"src/js/setup.js",
"src/js/plugins.js"
];
// Allow overriding the default project root
var projectRoot = projectRoot || '../';
function loadScripts(scriptsArr){
for (var i = 0; i < scriptsArr.length; i++) {
// Using document.write because that's the easiest way to avoid triggering
// asynchrnous script loading
document.write( "<script src='" + projectRoot + scriptsArr[i] + "'><\/script>" );
}
}
// We use this file in the grunt build script to load the same source file list
// and don't want to load the scripts there.
if (typeof blockSourceLoading === 'undefined') {
loadScripts(sourceFiles);
// Allow for making Flash first
if (window.location.href.indexOf("?flash") !== -1) {
// Using doc.write to load this script to, otherwise when it runs videojs
// is undefined
document.write('<script>videojs.options.techOrder = ["flash"];videojs.options.flash.swf = "../src/swf/video-js.swf";</script>')
}
}

22
build/tasks/dist-cdn.js Normal file
View File

@ -0,0 +1,22 @@
var uglify = require('uglify-js');
module.exports = function(grunt) {
grunt.registerTask('dist-cdn', 'Assembling distribution', function(){
var css, jsmin, jsdev, cdnjs;
// Replace font urls with CDN versions
css = grunt.file.read('dist/cdn/video-js.css');
css = css.replace(/font\//g, '../f/3/');
grunt.file.write('dist/cdn/video-js.css', css);
// GA Tracking Pixel (manually building the pixel URL)
cdnjs = '\n' + uglify.minify('build/cdn.js').code.replace('v0.0.0', 'v'+ grunt.vjsVersion.full);
// Add CDN-specfic JS
js = grunt.file.read('dist/cdn/video.js');
grunt.file.write('dist/cdn/video.js', js + cdnjs);
jsmin = grunt.file.read('dist/cdn/video.min.js');
grunt.file.write('dist/cdn/video.min.js', jsmin + cdnjs);
});
}

View File

@ -4,16 +4,15 @@
<title>Video.js | HTML5 Video Player</title> <title>Video.js | HTML5 Video Player</title>
<!-- Chang URLs to wherever Video.js files will be hosted --> <!-- Chang URLs to wherever Video.js files will be hosted -->
<link href="video-js.css" rel="stylesheet" type="text/css"> <link href="../../video-js.css" rel="stylesheet" type="text/css">
<!-- video.js must be in the <head> for older IEs to work. --> <!-- video.js must be in the <head> for older IEs to work. -->
<script src="video.js"></script> <script src="../../video.js"></script>
<!-- Unless using the CDN hosted version, update the URL to the Flash SWF --> <!-- Unless using the CDN hosted version, update the URL to the Flash SWF -->
<script> <script>
videojs.options.flash.swf = "video-js.swf"; videojs.options.flash.swf = "../../video-js.swf";
</script> </script>
</head> </head>
<body> <body>
@ -23,8 +22,8 @@
<source src="http://video-js.zencoder.com/oceans-clip.mp4" type='video/mp4' /> <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.webm" type='video/webm' />
<source src="http://video-js.zencoder.com/oceans-clip.ogv" type='video/ogg' /> <source src="http://video-js.zencoder.com/oceans-clip.ogv" type='video/ogg' />
<track kind="captions" src="demo.captions.vtt" srclang="en" label="English"></track><!-- Tracks need an ending tag thanks to IE9 --> <track kind="captions" src="../shared/example-captions.vtt" srclang="en" label="English"></track><!-- Tracks need an ending tag thanks to IE9 -->
<track kind="subtitles" src="demo.captions.vtt" srclang="en" label="English"></track><!-- Tracks need an ending tag thanks to IE9 --> <track kind="subtitles" src="../shared/example-captions.vtt" srclang="en" label="English"></track><!-- Tracks need an ending tag thanks to IE9 -->
<p class="vjs-no-js">To view this video please enable JavaScript, and consider upgrading to a web browser that <a href="http://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a></p> <p class="vjs-no-js">To view this video please enable JavaScript, and consider upgrading to a web browser that <a href="http://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a></p>
</video> </video>

View File

@ -20,39 +20,36 @@
"type": "git", "type": "git",
"url": "https://github.com/videojs/video.js.git" "url": "https://github.com/videojs/video.js.git"
}, },
"main": "./dist/video-js/video.js", "main": "src/js/video.js",
"dependencies": { "dependencies": {
"videojs-swf": "4.5.4", "videojs-swf": "4.5.4",
"vtt.js": "git+https://github.com/gkatsev/vtt.js.git#shim-build" "vtt.js": "git+https://github.com/gkatsev/vtt.js.git#shim-build",
"global": "^4.3.0"
}, },
"devDependencies": { "devDependencies": {
"babelify": "^5.0.4", "babelify": "^5.0.4",
"blanket": "^1.1.6", "blanket": "^1.1.6",
"browserify-istanbul": "^0.2.1", "browserify-istanbul": "^0.2.1",
"calcdeps": "~0.1.7", "browserify-versionify": "^1.0.4",
"chg": "~0.2.0", "chg": "~0.2.0",
"contribflow": "~0.2.0",
"github": "~0.1.14",
"global": "^4.3.0",
"grunt": "^0.4.4", "grunt": "^0.4.4",
"grunt-aws-s3": "^0.12.1", "grunt-aws-s3": "^0.12.1",
"grunt-banner": "~0.2.0",
"grunt-browserify": "^3.5.0", "grunt-browserify": "^3.5.0",
"grunt-cli": "~0.1.0", "grunt-cli": "~0.1.0",
"grunt-contrib-clean": "~0.4.0a", "grunt-contrib-clean": "~0.4.0a",
"grunt-contrib-concat": "^0.5.1",
"grunt-contrib-connect": "~0.7.1", "grunt-contrib-connect": "~0.7.1",
"grunt-contrib-copy": "~0.3.2", "grunt-contrib-copy": "^0.8.0",
"grunt-contrib-cssmin": "~0.6.0", "grunt-contrib-cssmin": "~0.6.0",
"grunt-contrib-jshint": "^0.11.0", "grunt-contrib-jshint": "^0.11.0",
"grunt-contrib-less": "~0.6.4", "grunt-contrib-less": "~0.6.4",
"grunt-contrib-qunit": "~0.2.1",
"grunt-contrib-uglify": "^0.8.0", "grunt-contrib-uglify": "^0.8.0",
"grunt-contrib-watch": "~0.1.4", "grunt-contrib-watch": "~0.1.4",
"grunt-coveralls": "^1.0.0", "grunt-coveralls": "^1.0.0",
"grunt-exorcise": "^1.0.1",
"grunt-fastly": "^0.1.3", "grunt-fastly": "^0.1.3",
"grunt-github-releaser": "^0.1.17", "grunt-github-releaser": "^0.1.17",
"grunt-karma": "^0.8.3", "grunt-karma": "^0.8.3",
"grunt-s3": "~0.2.0-alpha",
"grunt-version": "~0.3.0", "grunt-version": "~0.3.0",
"grunt-videojs-languages": "0.0.4", "grunt-videojs-languages": "0.0.4",
"grunt-zip": "0.10.2", "grunt-zip": "0.10.2",
@ -68,8 +65,6 @@
"karma-safari-launcher": "^0.1.1", "karma-safari-launcher": "^0.1.1",
"karma-sauce-launcher": "^0.2.8", "karma-sauce-launcher": "^0.2.8",
"karma-sinon": "^1.0.3", "karma-sinon": "^1.0.3",
"mocha": "~1.8.1",
"open": "0.0.4",
"qunitjs": "~1.14.0", "qunitjs": "~1.14.0",
"sinon": "~1.9.1", "sinon": "~1.9.1",
"uglify-js": "~2.3.6", "uglify-js": "~2.3.6",

View File

@ -4,19 +4,25 @@
<meta charset="utf-8" /> <meta charset="utf-8" />
<title>Video.js Sandbox</title> <title>Video.js Sandbox</title>
<link href="../build/files/video-js.css" rel="stylesheet" type="text/css"> <link href="../build/temp/video-js.css" rel="stylesheet" type="text/css">
<!-- LOAD VIDEO.JS SOURCE FILES IN ORDER --> <!-- LOAD VIDEO.JS SOURCE FILES IN ORDER -->
<script src="../build/source-loader.js"></script> <script src="../build/temp/video.js"></script>
<!-- Set the location of the flash SWF --> <!-- Set the location of the flash SWF -->
<script> <script>
vjs.options.flash.swf = '../node_modules/videojs-swf/dist/video-js.swf' vjs.options.flash.swf = '../build/temp/video-js.swf'
</script> </script>
</head> </head>
<body> <body>
<p style="background-color:#eee; border: 1px solid #777; padding: 10px; font-size: .8em; line-height: 1.5em; font-family: Verdana, sans-serif;">You can use /sandbox/ for writing and testing your own code. Nothing in /sandbox/ will get checked into the repo, except files that end in .example, so please don't edit or add those files. To get started make a copy of index.html.example and rename it to index.html.</p> <div style="background-color:#eee; border: 1px solid #777; padding: 10px; margin-bottom: 20px; font-size: .8em; line-height: 1.5em; font-family: Verdana, sans-serif;">
<p>You can use /sandbox/ for writing and testing your own code. Nothing in /sandbox/ will get checked into the repo, except files that end in .example (so don't edit or add those files). To get started make a copy of index.html.example and rename it to index.html.</p>
<pre>cp sandbox/index.html.example index.html</pre>
<pre>grunt watch</pre>
<pre>grunt connect</pre>
<pre>open http://localhost:9999/sandbox/index.html</pre>
</div>
<video id="vid1" class="video-js vjs-default-skin" controls preload="auto" width="640" height="264" <video id="vid1" class="video-js vjs-default-skin" controls preload="auto" width="640" height="264"
poster="http://video-js.zencoder.com/oceans-clip.png" poster="http://video-js.zencoder.com/oceans-clip.png"
@ -24,7 +30,7 @@
<source src="http://video-js.zencoder.com/oceans-clip.mp4" type='video/mp4'> <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.webm" type='video/webm'>
<source src="http://video-js.zencoder.com/oceans-clip.ogv" type='video/ogg'> <source src="http://video-js.zencoder.com/oceans-clip.ogv" type='video/ogg'>
<track kind="captions" src="../build/demo-files/demo.captions.vtt" srclang="en" label="English"></track><!-- Tracks need an ending tag thanks to IE9 --> <track kind="captions" src="../docs/examples/shared/example-captions.vtt" srclang="en" label="English"></track><!-- Tracks need an ending tag thanks to IE9 -->
<p class="vjs-no-js">To view this video please enable JavaScript, and consider upgrading to a web browser that <a href="http://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a></p> <p class="vjs-no-js">To view this video please enable JavaScript, and consider upgrading to a web browser that <a href="http://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a></p>
</video> </video>

View File

@ -5,10 +5,10 @@
<meta charset="utf-8" /> <meta charset="utf-8" />
<title>VideoJS Languages Demo</title> <title>VideoJS Languages Demo</title>
<link href="../build/files/video-js.css" rel="stylesheet" type="text/css"> <link href="../build/temp/video-js.css" rel="stylesheet" type="text/css">
<!-- LOAD VIDEO.JS SOURCE FILES IN ORDER --> <!-- LOAD VIDEO.JS SOURCE FILES IN ORDER -->
<script src="../build/source-loader.js"></script> <script src="../build/temp/video.js"></script>
<!-- Set the location of the flash SWF --> <!-- Set the location of the flash SWF -->
<!-- Add support for Spanish 'es' --> <!-- Add support for Spanish 'es' -->

View File

@ -4,10 +4,10 @@
<meta charset="utf-8" /> <meta charset="utf-8" />
<title>Video.js Plugin Example</title> <title>Video.js Plugin Example</title>
<link href="../build/files/video-js.css" rel="stylesheet" type="text/css"> <link href="../build/temp/video-js.css" rel="stylesheet" type="text/css">
<!-- LOAD VIDEO.JS SOURCE FILES IN ORDER --> <!-- LOAD VIDEO.JS SOURCE FILES IN ORDER -->
<script src="../build/source-loader.js"></script> <script src="../build/temp/video.js"></script>
</head> </head>
<body> <body>

View File

@ -1,6 +1,6 @@
/*! /*!
Video.js Default Styles (http://videojs.com) Video.js Default Styles (http://videojs.com)
Version GENERATED_AT_BUILD @version GENERATED_AT_BUILD
Create your own skin at http://designer.videojs.com Create your own skin at http://designer.videojs.com
*/ */

View File

@ -76,18 +76,18 @@ var videojs = function(id, options, ready){
// var videojs = window['videojs'] = vjs; // var videojs = window['videojs'] = vjs;
// CDN Version. Used to target right flash swf. // CDN Version. Used to target right flash swf.
videojs.CDN_VERSION = 'GENERATED_CDN_VSN'; videojs.CDN_VERSION = '__VERSION_NO_PATCH__';
videojs.ACCESS_PROTOCOL = ('https:' == document.location.protocol ? 'https://' : 'http://'); videojs.ACCESS_PROTOCOL = ('https:' == document.location.protocol ? 'https://' : 'http://');
/** /**
* Full player version * Full player version
* @type {string} * @type {string}
*/ */
videojs['VERSION'] = 'GENERATED_FULL_VSN'; videojs['VERSION'] = '__VERSION__';
// Set CDN Version of swf // Set CDN Version of swf
// The added (+) blocks the replace from changing this GENERATED_CDN_VSN string // The added (+) blocks the replace from changing this _VERSION_NO_PATCH_ string
if (videojs.CDN_VERSION !== 'GENERATED'+'_CDN_VSN') { if (videojs.CDN_VERSION !== '__VERSION_'+'NO_PATCH__') {
Options['flash']['swf'] = videojs.ACCESS_PROTOCOL + 'vjs.zencdn.net/'+videojs.CDN_VERSION+'/video-js.swf'; Options['flash']['swf'] = videojs.ACCESS_PROTOCOL + 'vjs.zencdn.net/'+videojs.CDN_VERSION+'/video-js.swf';
} }

View File

@ -1,47 +0,0 @@
module.exports = function(grunt) {
grunt.registerMultiTask('build', 'Building Source', function(){
var vtt, novtt;
// Fix windows file path delimiter issue
var i = grunt.sourceFiles.length;
while (i--) {
grunt.sourceFiles[i] = grunt.sourceFiles[i].replace(/\\/g, '/');
}
// Create a combined sources file. https://github.com/zencoder/video-js/issues/287
var combined = '';
grunt.sourceFiles.forEach(function(result){
combined += grunt.file.read(result);
});
// Replace CDN version ref in js. Use major/minor version.
combined = combined.replace(/GENERATED_CDN_VSN/g, grunt.vjsVersion.majorMinor);
combined = combined.replace(/GENERATED_FULL_VSN/g, grunt.vjsVersion.full);
vtt = grunt.file.read('node_modules/vtt.js/dist/vtt.js');
novtt = combined;
combined += '\n'+vtt;
grunt.file.write('build/files/combined.video.js', combined);
grunt.file.write('build/files/combined.video.novtt.js', novtt);
// Copy over other files
// grunt.file.copy('src/css/video-js.png', 'build/files/video-js.png');
grunt.file.copy('node_modules/videojs-swf/dist/video-js.swf', 'build/files/video-js.swf');
// Inject version number into css file
var css = grunt.file.read('build/files/video-js.css');
css = css.replace(/GENERATED_AT_BUILD/g, grunt.vjsVersion.full);
grunt.file.write('build/files/video-js.css', css);
// Copy over font files
grunt.file.recurse('src/css/font', function(absdir, rootdir, subdir, filename) {
// Block .DS_Store files
if ('filename'.substring(0,1) !== '.') {
grunt.file.copy(absdir, 'build/files/font/' + filename);
}
});
// Minify CSS
grunt.task.run(['cssmin']);
});
}

View File

@ -1,61 +0,0 @@
module.exports = function(grunt) {
grunt.registerTask('dist-copy', 'Assembling distribution', function(){
var css, jsmin, jsdev, cdnjs, uglify;
uglify = require('uglify-js');
// Manually copy each source file
grunt.file.copy('build/files/minified.video.js', 'dist/video-js/video.js');
grunt.file.copy('build/files/combined.video.js', 'dist/video-js/video.dev.js');
grunt.file.copy('build/files/minified.video.novtt.js', 'dist/video-js/video.novtt.js');
grunt.file.copy('build/files/combined.video.novtt.js', 'dist/video-js/video.novtt.dev.js');
grunt.file.copy('build/files/video-js.css', 'dist/video-js/video-js.css');
grunt.file.copy('build/files/video-js.min.css', 'dist/video-js/video-js.min.css');
grunt.file.copy('node_modules/videojs-swf/dist/video-js.swf', 'dist/video-js/video-js.swf');
grunt.file.copy('build/demo-files/demo.html', 'dist/video-js/demo.html');
grunt.file.copy('build/demo-files/demo.captions.vtt', 'dist/video-js/demo.captions.vtt');
grunt.file.copy('src/css/video-js.less', 'dist/video-js/video-js.less');
// Copy over font files
grunt.file.recurse('build/files/font', function(absdir, rootdir, subdir, filename) {
// Block .DS_Store files
if ('filename'.substring(0,1) !== '.') {
grunt.file.copy(absdir, 'dist/video-js/font/' + filename);
}
});
// Copy over language files
grunt.file.recurse('build/files/lang', function(absdir, rootdir, subdir, filename) {
// Block .DS_Store files
if ('filename'.substring(0,1) !== '.') {
grunt.file.copy(absdir, 'dist/cdn/lang/' + filename);
grunt.file.copy(absdir, 'dist/video-js/lang/' + filename);
}
});
// ds_store files sometime find their way in
if (grunt.file.exists('dist/video-js/.DS_Store')) {
grunt.file['delete']('dist/video-js/.DS_Store');
}
// CDN version uses already hosted font files
// Minified version only, doesn't need demo files
grunt.file.copy('build/files/minified.video.js', 'dist/cdn/video.js');
grunt.file.copy('build/files/video-js.min.css', 'dist/cdn/video-js.css');
grunt.file.copy('node_modules/videojs-swf/dist/video-js.swf', 'dist/cdn/video-js.swf');
grunt.file.copy('build/demo-files/demo.captions.vtt', 'dist/cdn/demo.captions.vtt');
grunt.file.copy('build/demo-files/demo.html', 'dist/cdn/demo.html');
// Replace font urls with CDN versions
css = grunt.file.read('dist/cdn/video-js.css');
css = css.replace(/font\//g, '../f/3/');
grunt.file.write('dist/cdn/video-js.css', css);
// Add CDN-specfic JS
jsmin = grunt.file.read('dist/cdn/video.js');
// GA Tracking Pixel (manually building the pixel URL)
cdnjs = uglify.minify('src/js/cdn.js').code.replace('v0.0.0', 'v'+ grunt.vjsVersion.full);
grunt.file.write('dist/cdn/video.js', jsmin + cdnjs);
});
}

View File

@ -1,82 +0,0 @@
module.exports = function(grunt) {
grunt.registerTask('next-issue', 'Get the next issue that needs a response', function(){
var done = this.async();
var GitHubApi = require('github');
var open = require('open');
var github = new GitHubApi({
// required
version: '3.0.0',
// optional
debug: true,
protocol: 'https',
// host: 'github.my-GHE-enabled-company.com',
// pathPrefix: '/api/v3', // for some GHEs
timeout: 5000
});
github.issues.repoIssues({
// optional:
// headers: {
// 'cookie': 'blahblah'
// },
user: 'videojs',
repo: 'video.js',
sort: 'updated',
direction: 'asc',
state: 'open',
per_page: 100
}, function(err, res) {
var issueToOpen;
var usersWithWrite = ['heff', 'mmcc'];
var categoryLabels = ['enhancement', 'bug', 'question', 'feature'];
console.log('Number of issues: '+res.length);
// TODO: Find the best way to exclude an issue where a question has been asked of the
// issue owner/submitter that hasn't been answerd yet.
// A stupid simple first step would be to check for the needs: more info label
// and exactly one comment (the question)
// find issues that need categorizing, no category labels
res.some(function(issue){
if (issue.labels.length === 0) {
return issueToOpen = issue; // break
}
// look for category labels
var categorized = issue.labels.some(function(label){
return categoryLabels.indexOf(label.name) >= 0;
});
if (!categorized) {
return issueToOpen = issue; // break
}
});
if (issueToOpen) {
open(issueToOpen.html_url);
return done();
}
// find issues that need confirming or answering
res.some(function(issue){
// look for confirmed label
var confirmed = issue.labels.some(function(label){
return label.name === 'confirmed';
});
// Was exluding questions, but that might leave a lot of people hanging
// var question = issue.labels.some(function(label){
// return label.name === 'question';
// });
if (!confirmed) { // && !question
return issueToOpen = issue; // break
}
});
if (issueToOpen) {
open(issueToOpen.html_url);
return done();
}
grunt.log.writeln('No next issue found');
done();
});
});
}

View File

@ -1,11 +1,18 @@
import videojs from '../../src/js/video.js'; /**
import TestHelpers from './test-helpers.js'; * These tests run on the minified, window.videojs and ensure the needed
import document from 'global/document'; * APIs still exist
*/
(function(){
q.module('Player Minified'); q.module('Player Minified');
test('videojs should exist on the window', function() {
ok(window.videojs, 'videojs exists on the window');
});
test('should be able to access expected player API methods', function() { test('should be able to access expected player API methods', function() {
var player = TestHelpers.makePlayer(); var player = videojs.getComponent('Player').prototype;
// Native HTML5 Methods // Native HTML5 Methods
ok(player.error, 'error exists'); ok(player.error, 'error exists');
@ -63,8 +70,6 @@ test('should be able to access expected player API methods', function() {
ok(player.requestFullScreen, 'requestFullScreen exists'); ok(player.requestFullScreen, 'requestFullScreen exists');
ok(player.isFullScreen, 'isFullScreen exists'); ok(player.isFullScreen, 'isFullScreen exists');
ok(player.cancelFullScreen, 'cancelFullScreen exists'); ok(player.cancelFullScreen, 'cancelFullScreen exists');
player.dispose();
}); });
test('should be able to access expected component API methods', function() { test('should be able to access expected component API methods', function() {
@ -136,7 +141,7 @@ test('should be able to access expected MediaTech API methods', function() {
}); });
test('should export ready api call to public', function() { test('should export ready api call to public', function() {
var videoTag = TestHelpers.makeTag(); var videoTag = testHelperMakeTag();
var fixture = document.getElementById('qunit-fixture'); var fixture = document.getElementById('qunit-fixture');
fixture.appendChild(videoTag); fixture.appendChild(videoTag);
@ -191,7 +196,7 @@ test('should export useful components to the public', function () {
}); });
test('should be able to initialize player twice on the same tag using string reference', function() { test('should be able to initialize player twice on the same tag using string reference', function() {
var videoTag = TestHelpers.makeTag(); var videoTag = testHelperMakeTag();
var id = videoTag.id; var id = videoTag.id;
var fixture = document.getElementById('qunit-fixture'); var fixture = document.getElementById('qunit-fixture');
@ -201,7 +206,7 @@ test('should be able to initialize player twice on the same tag using string ref
player.dispose(); player.dispose();
ok(!document.getElementById(id), 'element is removed'); ok(!document.getElementById(id), 'element is removed');
videoTag = TestHelpers.makeTag(); videoTag = testHelperMakeTag();
fixture.appendChild(videoTag); fixture.appendChild(videoTag);
player = videojs('example_1'); player = videojs('example_1');
@ -209,7 +214,7 @@ test('should be able to initialize player twice on the same tag using string ref
}); });
test('videojs.players should be available after minification', function() { test('videojs.players should be available after minification', function() {
var videoTag = TestHelpers.makeTag(); var videoTag = testHelperMakeTag();
var id = videoTag.id; var id = videoTag.id;
var fixture = document.getElementById('qunit-fixture'); var fixture = document.getElementById('qunit-fixture');
@ -241,3 +246,12 @@ test('component can be subclassed externally', function(){
ok(new ControlBar(player), 'created a control bar without throwing'); ok(new ControlBar(player), 'created a control bar without throwing');
}); });
function testHelperMakeTag(){
var videoTag = document.createElement('video');
videoTag.id = 'example_1';
videoTag.className = 'video-js vjs-default-skin';
return videoTag;
}
})();

View File

@ -1,97 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Video.js Test Suite</title>
<!-- Video.js CSS -->
<link rel="stylesheet" href="../build/files/video-js.css" type="text/css">
<!-- Sinon -->
<script src="../node_modules/sinon/pkg/sinon.js"></script>
<script src="../node_modules/sinon/pkg/sinon-ie.js"></script>
<!-- QUnit -->
<link rel="stylesheet" href="../node_modules/qunitjs/qunit/qunit.css" />
<script src="../node_modules/qunitjs/qunit/qunit.js"></script>
<script src="../build/files/video-es6.test.js"></script>
<script type="text/javascript">
(function(){
// ADD NEW TEST FILES HERE
window.tests = [
'test/unit/test-helpers.js',
'test/unit/core-object.js',
'test/unit/lib.js',
'test/unit/util.js',
'test/unit/events.js',
'test/unit/component.js',
'test/unit/button.js',
'test/unit/mediafaker.js',
'test/unit/player.js',
'test/unit/core.js',
'test/unit/media.js',
'test/unit/media.html5.js',
'test/unit/controls.js',
'test/unit/poster.js',
'test/unit/plugins.js',
'test/unit/flash.js',
'test/unit/api.js',
'test/unit/menu.js',
'test/unit/tracks/tracks.js',
'test/unit/tracks/text-track.js',
'test/unit/tracks/text-track-list.js',
'test/unit/tracks/text-track-cue-list.js',
'test/unit/tracks/text-track-controls.js',
'test/unit/tracks/text-track-settings.js'
];
var projectRoot = '../';
var scripts = [];
window.loadScripts = function(scripts) {
for (var i = 0; i < scripts.length; i++) {
document.write("<script src='" + projectRoot + scripts[i] + "'><\/script>" );
}
}
// 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) {
window.compiled = true;
} else {
// Bunyip/Yeti starts tests after it's done loading which can
// lead to a double Qunit.start error which reads as
// "Uncaught Error: pushFailure() assertion outside test"
if (window.$yetify) {
QUnit.config.autostart = false;
}
}
})()
</script>
</head>
<body>
<div>
<h1 id="qunit-header">Video.js Test Suite</h1>
<h2 id="qunit-banner"></h2>
<div id="qunit-testrunner-toolbar"></div>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests"></ol>
<div id="qunit-fixture"></div>
</div>
<script>
// Loading tests before the end to give IE time to load vjs before tests
if (!window.compiled) {
loadScripts(window.tests);
} else {
var compiledTests = "build/files/test.minified.video.js";
loadScripts([compiledTests]);
}
</script>
</body>
</html>

View File

@ -1,97 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Video.js Test Suite</title>
<!-- Video.js CSS -->
<link rel="stylesheet" href="../build/files/video-js.css" type="text/css">
<!-- Sinon -->
<script src="../node_modules/sinon/pkg/sinon.js"></script>
<script src="../node_modules/sinon/pkg/sinon-ie.js"></script>
<!-- QUnit -->
<link rel="stylesheet" href="../node_modules/qunitjs/qunit/qunit.css" />
<script src="../node_modules/qunitjs/qunit/qunit.js"></script>
<script type="text/javascript">
(function(){
// ADD NEW TEST FILES HERE
window.tests = [
'test/unit/test-helpers.js',
'test/unit/core-object.js',
'test/unit/lib.js',
'test/unit/util.js',
'test/unit/events.js',
'test/unit/component.js',
'test/unit/button.js',
'test/unit/mediafaker.js',
'test/unit/player.js',
'test/unit/core.js',
'test/unit/media.js',
'test/unit/media.html5.js',
'test/unit/controls.js',
'test/unit/poster.js',
'test/unit/plugins.js',
'test/unit/flash.js',
'test/unit/api.js',
'test/unit/menu.js',
'test/unit/tracks/tracks.js',
'test/unit/tracks/text-track.js',
'test/unit/tracks/text-track-list.js',
'test/unit/tracks/text-track-cue-list.js',
'test/unit/tracks/text-track-controls.js',
'test/unit/tracks/text-track-settings.js'
];
var projectRoot = '../';
var scripts = [];
window.loadScripts = function(scripts) {
for (var i = 0; i < scripts.length; i++) {
document.write("<script src='" + projectRoot + scripts[i] + "'><\/script>" );
}
}
// 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) {
window.compiled = true;
} else {
// Bunyip/Yeti starts tests after it's done loading which can
// lead to a double Qunit.start error which reads as
// "Uncaught Error: pushFailure() assertion outside test"
if (window.$yetify) {
QUnit.config.autostart = false;
}
loadScripts(['build/source-loader.js']);
}
})()
</script>
</head>
<body>
<div>
<h1 id="qunit-header">Video.js Test Suite</h1>
<h2 id="qunit-banner"></h2>
<div id="qunit-testrunner-toolbar"></div>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests"></ol>
<div id="qunit-fixture"></div>
</div>
<script>
// Loading tests before the end to give IE time to load vjs before tests
if (!window.compiled) {
loadScripts(window.tests);
} else {
var compiledTests = "build/files/test.minified.video.js";
loadScripts([compiledTests]);
}
</script>
</body>
</html>

View File

@ -1,19 +1,3 @@
var fs = require('fs');
var vm = require('vm');
// var sourceLoader = fs.readFileSync('./build/source-loader.js', 'utf8');
// var sandbox = {
// blockSourceLoading: true,
// document: {},
// window: {}
// };
// var sourceFiles = [];
//
//
// vm.runInNewContext(sourceLoader, sandbox, 'build/source-loader.js');
// sourceFiles = sandbox.sourceFiles.map(function(src) {
// return '../' + src;
// });
module.exports = function(config) { module.exports = function(config) {
var customLaunchers = { var customLaunchers = {
chrome_sl: { chrome_sl: {
@ -75,9 +59,11 @@ module.exports = function(config) {
// customLaunchers: customLaunchers, // customLaunchers: customLaunchers,
files: [ files: [
'../build/files/video-js.css', '../build/temp/video-js.min.css',
'../test/karma-qunit-shim.js', '../test/karma-qunit-shim.js',
'../test/unit/**/*.js' '../test/unit/**/*.js',
'../build/temp/video.min.js',
'../test/api/**/*.js',
], ],
preprocessors: { preprocessors: {

View File

@ -1,48 +0,0 @@
module.exports = function(config) {
config.set({
frameworks: ['qunit'],
autoWatch: false,
singleRun: true,
files: [
'../build/files/video-js.min.css',
'../test/karma-qunit-shim.js',
'../node_modules/sinon/pkg/sinon.js',
'../build/files/minified.video.js',
'../test/unit/test-helpers.js',
'../test/unit/api.js'
],
plugins: [
'karma-qunit',
'karma-chrome-launcher',
'karma-firefox-launcher',
'karma-ie-launcher',
'karma-opera-launcher',
'karma-phantomjs-launcher',
'karma-safari-launcher'
],
// test results reporter to use
// possible values: 'dots', 'progress', 'junit'
reporters: ['dots'],
// web server port
port: 9876,
// cli runner port
runnerPort: 9100,
// enable / disable colors in the output (reporters and logs)
colors: true,
// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,
// If browser does not capture in given timeout [ms], kill it
captureTimeout: 60000
});
};

View File

@ -1,46 +0,0 @@
module.exports = function(config) {
config.set({
frameworks: ['qunit'],
autoWatch: false,
singleRun: true,
files: [
'../build/files/video-js.min.css',
'../test/karma-qunit-shim.js',
'../node_modules/sinon/pkg/sinon.js',
'../build/files/test.minified.video.js'
],
plugins: [
'karma-qunit',
'karma-chrome-launcher',
'karma-firefox-launcher',
'karma-ie-launcher',
'karma-opera-launcher',
'karma-phantomjs-launcher',
'karma-safari-launcher'
],
// test results reporter to use
// possible values: 'dots', 'progress', 'junit'
reporters: ['dots'],
// web server port
port: 9876,
// cli runner port
runnerPort: 9100,
// enable / disable colors in the output (reporters and logs)
colors: true,
// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,
// If browser does not capture in given timeout [ms], kill it
captureTimeout: 60000
});
};

View File

@ -1,63 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Video.js Test Suite</title>
<!-- Sinon -->
<script src="../node_modules/sinon/pkg/sinon.js"></script>
<script src="../node_modules/sinon/pkg/sinon-ie.js"></script>
<!-- QUnit -->
<link rel="stylesheet" href="../node_modules/qunitjs/qunit/qunit.css" />
<script src="../node_modules/qunitjs/qunit/qunit.js"></script>
<!-- Video.js CSS -->
<link rel="stylesheet" href="../build/files/video-js.css" type="text/css">
<!-- LIB COMPILED WITH NOT COMPILED TESTS
Check publicly available APIs against compiled lib
-->
<script type="text/javascript">
// Test AMD Support
// window.define = function(a, b){
// console.log(a, b);
// };
// define.amd = true;
// Test CJS Support
// Have to remove qunit and tests to because module becomes a function
// window.module = window.exports = {};
// window.module.exports = {};
(function(){
// ADD NEW TEST FILES HERE
var tests = [
'test/unit/test-helpers.js',
'test/unit/api.js'
];
var projectRoot = '../';
var scripts = [];
scripts = scripts.concat(['build/files/minified.video.js'], tests);
for (var i = 0; i < scripts.length; i++) {
document.write( "<script src='" + projectRoot + scripts[i] + "'><\/script>" );
}
})()
</script>
</head>
<body>
<div>
<h1 id="qunit-header">Video.js Test Suite</h1>
<h2 id="qunit-banner"></h2>
<div id="qunit-testrunner-toolbar"></div>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests"></ol>
<div id="qunit-fixture"></div>
</div>
</body>
</html>

View File

@ -1,35 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Video.js Test Suite</title>
<!-- Video.js CSS -->
<link rel="stylesheet" href="../build/files/video-js.css" type="text/css">
<!-- Sinon -->
<script src="../node_modules/sinon/pkg/sinon.js"></script>
<script src="../node_modules/sinon/pkg/sinon-ie.js"></script>
<!-- QUnit -->
<link rel="stylesheet" href="../node_modules/qunitjs/qunit/qunit.css" />
<script src="../node_modules/qunitjs/qunit/qunit.js"></script>
<!-- SOURCE COMPILED WITH TESTS
grunt-contrib-qunit doesn't support query vars, so making this script
so we can automatically run compiled tests too.
(in test/index.html you can add ?compiled to also run compiled tests)
-->
<script src="../build/files/test.minified.video.js"></script>
</head>
<body>
<div>
<h1 id="qunit-header">Video.js Test Suite</h1>
<h2 id="qunit-banner"></h2>
<div id="qunit-testrunner-toolbar"></div>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests"></ol>
<div id="qunit-fixture"></div>
</div>
</body>
</html>

View File

@ -93,7 +93,7 @@ test('should hide the poster in the appropriate player states', function(){
fixture.appendChild(playerDiv); fixture.appendChild(playerDiv);
playerDiv.className = 'video-js vjs-has-started'; playerDiv.className = 'video-js vjs-has-started';
equal(TestHelpers.getComputedStyle(el, 'display'), 'none', 'The poster hides when the video has started'); equal(TestHelpers.getComputedStyle(el, 'display'), 'none', 'The poster hides when the video has started (CSS may not be loaded)');
playerDiv.className = 'video-js vjs-has-started vjs-audio'; playerDiv.className = 'video-js vjs-has-started vjs-audio';
equal(TestHelpers.getComputedStyle(el, 'display'), 'block', 'The poster continues to show when playing audio'); equal(TestHelpers.getComputedStyle(el, 'display'), 'block', 'The poster continues to show when playing audio');

View File

@ -39,4 +39,4 @@ var TestHelpers = {
} }
}; };
module.exports = TestHelpers; export default TestHelpers;