Comparar commits
6 Commits
| Autor | SHA1 | Data | |
|---|---|---|---|
| 880be64f48 | |||
| 753ce48e21 | |||
| 8dd88d1626 | |||
| 0fe7348456 | |||
| 36c92404c3 | |||
| 68d5cb996a |
+49
-24
@@ -77,17 +77,8 @@ module.exports = function(grunt) {
|
||||
},
|
||||
s3: {
|
||||
options: s3,
|
||||
prod: {
|
||||
// Files to be uploaded.
|
||||
minor: {
|
||||
upload: [
|
||||
{
|
||||
src: 'dist/cdn/*',
|
||||
dest: 'vjs/'+version.full+'/',
|
||||
rel: 'dist/cdn/',
|
||||
headers: {
|
||||
'Cache-Control': 'public, max-age=31536000'
|
||||
}
|
||||
},
|
||||
{
|
||||
src: 'dist/cdn/*',
|
||||
dest: 'vjs/'+version.majorMinor+'/',
|
||||
@@ -97,6 +88,27 @@ module.exports = function(grunt) {
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
patch: {
|
||||
upload: [
|
||||
{
|
||||
src: 'dist/cdn/*',
|
||||
dest: 'vjs/'+version.full+'/',
|
||||
rel: 'dist/cdn/',
|
||||
headers: {
|
||||
'Cache-Control': 'public, max-age=31536000'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
cssmin: {
|
||||
minify: {
|
||||
expand: true,
|
||||
cwd: 'build/files/',
|
||||
src: ['video-js.css'],
|
||||
dest: 'build/files/',
|
||||
ext: '.min.css'
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -106,6 +118,7 @@ module.exports = function(grunt) {
|
||||
grunt.loadNpmTasks('grunt-contrib-watch');
|
||||
grunt.loadNpmTasks('grunt-contrib-clean');
|
||||
grunt.loadNpmTasks('grunt-contrib-copy');
|
||||
grunt.loadNpmTasks('grunt-contrib-cssmin');
|
||||
grunt.loadNpmTasks('grunt-s3');
|
||||
grunt.loadNpmTasks('contribflow');
|
||||
|
||||
@@ -133,28 +146,35 @@ module.exports = function(grunt) {
|
||||
sourceFiles[i] = sourceFiles[i].replace(/\\/g, '/');
|
||||
}
|
||||
|
||||
// grunt.file.write('build/files/sourcelist.txt', sourceList.join(','));
|
||||
// Allow time for people to update their index.html before they remove these
|
||||
// grunt.file.write('build/files/sourcelist.js', 'var sourcelist = ["' + sourceFiles.join('","') + '"]');
|
||||
|
||||
// Create a combined sources file. https://github.com/zencoder/video-js/issues/287
|
||||
var combined = '';
|
||||
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, version.majorMinor);
|
||||
grunt.file.write('build/files/combined.video.js', combined);
|
||||
|
||||
// Copy over other files
|
||||
grunt.file.copy('src/css/video-js.css', 'build/files/video-js.css');
|
||||
grunt.file.copy('src/css/video-js.png', 'build/files/video-js.png');
|
||||
grunt.file.copy('src/swf/video-js.swf', 'build/files/video-js.swf');
|
||||
// grunt.file.copy('src/css/font/', 'build/files/font/');
|
||||
|
||||
// Inject version number into css file
|
||||
var css = grunt.file.read('build/files/video-js.css');
|
||||
css = css.replace(/GENERATED_AT_BUILD/g, version.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']);
|
||||
});
|
||||
|
||||
grunt.registerMultiTask('minify', 'Minify JS files using Closure Compiler.', function() {
|
||||
@@ -175,24 +195,26 @@ module.exports = function(grunt) {
|
||||
filePatterns = filePatterns.concat(this.data.src);
|
||||
}
|
||||
|
||||
// Build closure compiler shell command
|
||||
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'
|
||||
+ ' --jscomp_warning=checkTypes --warning_level=VERBOSE'
|
||||
+ ' --output_wrapper "/*! ' + pkg.copyright + ' */\n (function() {%output%})();//@ sourceMappingURL=video.js.map"';
|
||||
+ ' --output_wrapper "/*! Video.js v' + version.full + ' ' + pkg.copyright + ' */\n (function() {%output%})();//@ sourceMappingURL=video.js.map"';
|
||||
|
||||
// Add each js file
|
||||
grunt.file.expand(filePatterns).forEach(function(file){
|
||||
command += ' --js='+file;
|
||||
});
|
||||
|
||||
// Add externs
|
||||
externs.forEach(function(extern){
|
||||
command += ' --externs='+extern;
|
||||
});
|
||||
|
||||
// grunt.log.writeln(command)
|
||||
|
||||
// Run command
|
||||
exec(command, { maxBuffer: 500*1024 }, function(err, stdout, stderr){
|
||||
|
||||
if (err) {
|
||||
@@ -211,14 +233,18 @@ module.exports = function(grunt) {
|
||||
grunt.registerTask('dist', 'Creating distribution', function(){
|
||||
var exec = require('child_process').exec;
|
||||
var done = this.async();
|
||||
var css, jsmin, jsdev;
|
||||
|
||||
// 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/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('build/files/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');
|
||||
|
||||
// Copy over font files
|
||||
grunt.file.recurse('build/files/font', function(absdir, rootdir, subdir, filename) {
|
||||
// Block .DS_Store files
|
||||
if ('filename'.substring(0,1) !== '.') {
|
||||
@@ -227,18 +253,17 @@ module.exports = function(grunt) {
|
||||
});
|
||||
|
||||
// CDN version uses already hosted font files
|
||||
// Minified version only
|
||||
// doesn't need demo 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.css', 'dist/cdn/video-js.css');
|
||||
grunt.file.copy('build/files/video-js.min.css', 'dist/cdn/video-js.css');
|
||||
grunt.file.copy('build/files/video-js.swf', 'dist/cdn/video-js.swf');
|
||||
|
||||
|
||||
|
||||
var css = grunt.file.read('dist/cdn/video-js.css');
|
||||
// Replace font urls with CDN versions
|
||||
css = grunt.file.read('dist/cdn/video-js.css');
|
||||
css = css.replace(/font\//g, '../f/1/');
|
||||
grunt.file.write('dist/cdn/video-js.css', css);
|
||||
|
||||
// Zip up into video-js-VERSION.zip
|
||||
exec('cd dist && zip -r video-js-'+version.full+'.zip video-js && cd ..', { maxBuffer: 500*1024 }, function(err, stdout, stderr){
|
||||
|
||||
if (err) {
|
||||
|
||||
+3
-2
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "video.js",
|
||||
"description": "An HTML5 and Flash video player with a common API and skin for both.",
|
||||
"version": "4.0.0",
|
||||
"version": "4.0.3",
|
||||
"copyright": "Copyright 2013 Brightcove, Inc. https://github.com/videojs/video.js/blob/master/LICENSE",
|
||||
"keywords": [
|
||||
"html5",
|
||||
@@ -30,7 +30,8 @@
|
||||
"mocha": "~1.8.1",
|
||||
"contribflow": "~0.2.0",
|
||||
"grunt-s3": "~0.2.0-alpha",
|
||||
"semver": "~1.1.4"
|
||||
"semver": "~1.1.4",
|
||||
"grunt-contrib-cssmin": "~0.6.0"
|
||||
},
|
||||
"testling": {
|
||||
"browsers": [
|
||||
|
||||
@@ -9,6 +9,11 @@
|
||||
<!-- LOAD VIDEO.JS SOURCE FILES IN ORDER -->
|
||||
<script src="../build/source-loader.js"></script>
|
||||
|
||||
<!-- Set the location of the flash SWF -->
|
||||
<script>
|
||||
vjs.options.flash.swf = '../src/swf/video-js.swf'
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<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>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
VideoJS Default Styles (http://videojs.com)
|
||||
/*!
|
||||
Video.js Default Styles (http://videojs.com)
|
||||
Version GENERATED_AT_BUILD
|
||||
*/
|
||||
|
||||
@@ -152,7 +152,7 @@ so you can upgrade to newer versions easier. You can remove all these styles by
|
||||
@font-face{
|
||||
font-family: 'VideoJS';
|
||||
src: url('font/vjs.eot');
|
||||
src: url('font/vjs.eot') format('embedded-opentype'),
|
||||
src: url('font/vjs.eot?#iefix') format('embedded-opentype'),
|
||||
url('font/vjs.woff') format('woff'),
|
||||
url('font/vjs.ttf') format('truetype');
|
||||
font-weight: normal;
|
||||
|
||||
+7
-7
@@ -71,7 +71,7 @@ vjs.options = {
|
||||
// techOrder: ['flash','html5'],
|
||||
|
||||
'html5': {},
|
||||
'flash': { 'swf': vjs.ACCESS_PROTOCOL + 'vjs.zencdn.net/4.0/video-js.swf' },
|
||||
'flash': {},
|
||||
|
||||
// Default of web browser is 300x150. Should rely on source width/height.
|
||||
'width': 300,
|
||||
@@ -90,14 +90,14 @@ vjs.options = {
|
||||
}
|
||||
};
|
||||
|
||||
// Set CDN Version of swf
|
||||
// The added (+) blocks the replace from changing this GENERATED_CDN_VSN string
|
||||
if (vjs.CDN_VERSION !== 'GENERATED'+'_CDN_VSN') {
|
||||
videojs.options['flash']['swf'] = vjs.ACCESS_PROTOCOL + 'vjs.zencdn.net/'+vjs.CDN_VERSION+'/video-js.swf';
|
||||
}
|
||||
|
||||
/**
|
||||
* Global player list
|
||||
* @type {Object}
|
||||
*/
|
||||
vjs.players = {};
|
||||
|
||||
|
||||
// Set CDN Version of swf
|
||||
if (vjs.CDN_VERSION != 'GENERATED_CDN_VSN') {
|
||||
videojs.options['flash']['swf'] = vjs.ACCESS_PROTOCOL + 'vjs.zencdn.net/'+vjs.CDN_VERSION+'/video-js.swf';
|
||||
}
|
||||
|
||||
+4
-1
@@ -174,7 +174,10 @@ vjs.fixEvent = function(event) {
|
||||
// which makes copying more difficult.
|
||||
// TODO: Probably best to create a whitelist of event props
|
||||
for (var key in old) {
|
||||
event[key] = old[key];
|
||||
// Safari 6.0.3 warns you if you try to copy deprecated layerX/Y
|
||||
if (key !== 'layerX' && key !== 'layerY') {
|
||||
event[key] = old[key];
|
||||
}
|
||||
}
|
||||
|
||||
// The event occurred on this element
|
||||
|
||||
+10
-44
@@ -392,7 +392,7 @@ vjs.Player.prototype.onError = function(e) {
|
||||
vjs.log('Video Error', e);
|
||||
};
|
||||
|
||||
vjs.Player.prototype.onFullscreenChange = function(e) {
|
||||
vjs.Player.prototype.onFullscreenChange = function() {
|
||||
if (this.isFullScreen) {
|
||||
this.addClass('vjs-fullscreen');
|
||||
} else {
|
||||
@@ -593,7 +593,11 @@ vjs.Player.prototype.requestFullScreen = function(){
|
||||
// take the controls fullscreen as well as the video
|
||||
|
||||
// Trigger fullscreenchange event after change
|
||||
vjs.on(document, requestFullScreen.eventName, vjs.bind(this, function(){
|
||||
// We have to specifically add this each time, and remove
|
||||
// when cancelling fullscreen. Otherwise if there's multiple
|
||||
// players on a page, they would all be reacting to the same fullscreen
|
||||
// events
|
||||
vjs.on(document, requestFullScreen.eventName, vjs.bind(this, function(e){
|
||||
this.isFullScreen = document[requestFullScreen.isFullScreen];
|
||||
|
||||
// If cancelling fullscreen, remove event listener.
|
||||
@@ -601,37 +605,18 @@ vjs.Player.prototype.requestFullScreen = function(){
|
||||
vjs.off(document, requestFullScreen.eventName, arguments.callee);
|
||||
}
|
||||
|
||||
this.trigger('fullscreenchange');
|
||||
}));
|
||||
|
||||
// Flash and other plugins get reloaded when you take their parent to fullscreen.
|
||||
// To fix that we'll remove the tech, and reload it after the resize has finished.
|
||||
if (this.tech.features.fullscreenResize === false && this.options_['flash']['iFrameMode'] !== true) {
|
||||
|
||||
this.pause();
|
||||
this.unloadTech();
|
||||
|
||||
vjs.on(document, requestFullScreen.eventName, vjs.bind(this, function(){
|
||||
vjs.off(document, requestFullScreen.eventName, arguments.callee);
|
||||
this.loadTech(this.techName, { src: this.cache_.src });
|
||||
}));
|
||||
|
||||
this.el_[requestFullScreen.requestFn]();
|
||||
|
||||
} else {
|
||||
this.el_[requestFullScreen.requestFn]();
|
||||
}
|
||||
|
||||
this.trigger('fullscreenchange');
|
||||
this.el_[requestFullScreen.requestFn]();
|
||||
|
||||
} else if (this.tech.supportsFullScreen()) {
|
||||
// we can't take the video.js controls fullscreen but we can go fullscreen
|
||||
// with native controls
|
||||
|
||||
this.techCall('enterFullScreen');
|
||||
} else {
|
||||
// fullscreen isn't supported so we'll just stretch the video element to
|
||||
// fill the viewport
|
||||
|
||||
this.enterFullWindow();
|
||||
this.trigger('fullscreenchange');
|
||||
}
|
||||
@@ -641,31 +626,11 @@ vjs.Player.prototype.requestFullScreen = function(){
|
||||
|
||||
vjs.Player.prototype.cancelFullScreen = function(){
|
||||
var requestFullScreen = vjs.support.requestFullScreen;
|
||||
|
||||
this.isFullScreen = false;
|
||||
|
||||
// Check for browser element fullscreen support
|
||||
if (requestFullScreen) {
|
||||
|
||||
// Flash and other plugins get reloaded when you take their parent to fullscreen.
|
||||
// To fix that we'll remove the tech, and reload it after the resize has finished.
|
||||
if (this.tech.features.fullscreenResize === false && this.options_['flash']['iFrameMode'] !== true) {
|
||||
|
||||
this.pause();
|
||||
this.unloadTech();
|
||||
|
||||
vjs.on(document, requestFullScreen.eventName, vjs.bind(this, function(){
|
||||
vjs.off(document, requestFullScreen.eventName, arguments.callee);
|
||||
this.loadTech(this.techName, { src: this.cache_.src });
|
||||
}));
|
||||
|
||||
document[requestFullScreen.cancelFn]();
|
||||
} else {
|
||||
document[requestFullScreen.cancelFn]();
|
||||
}
|
||||
|
||||
this.trigger('fullscreenchange');
|
||||
|
||||
document[requestFullScreen.cancelFn]();
|
||||
} else if (this.tech.supportsFullScreen()) {
|
||||
this.techCall('exitFullScreen');
|
||||
} else {
|
||||
@@ -920,6 +885,7 @@ vjs.Player.prototype.ended = function(){ return this.techGet('ended'); };
|
||||
// Current W3C Spec
|
||||
// http://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html#api
|
||||
// Mozilla Draft: https://wiki.mozilla.org/Gecko:FullScreenAPI#fullscreenchange_event
|
||||
// New: https://dvcs.w3.org/hg/fullscreen/raw-file/529a67b8d9f3/Overview.html
|
||||
if (div.cancelFullscreen !== undefined) {
|
||||
requestFS.requestFn = 'requestFullscreen';
|
||||
requestFS.cancelFn = 'exitFullscreen';
|
||||
|
||||
@@ -33,6 +33,10 @@ vjs.MediaFaker.prototype.createEl = function(){
|
||||
vjs.MediaFaker.prototype.currentTime = function(){ return 0; };
|
||||
vjs.MediaFaker.prototype.volume = function(){ return 0; };
|
||||
vjs.MediaFaker.prototype.muted = function(){ return false; };
|
||||
vjs.MediaFaker.prototype.pause = function(){ return false; };
|
||||
vjs.MediaFaker.prototype.supportsFullScreen = function(){ return false; };
|
||||
vjs.MediaFaker.prototype.features = {};
|
||||
vjs.MediaFaker.prototype.buffered = function(){ return {}; };
|
||||
|
||||
// Export vars for Closure Compiler
|
||||
vjs['MediaFaker'] = vjs.MediaFaker;
|
||||
|
||||
@@ -250,3 +250,21 @@ test('should set controls and trigger event', function() {
|
||||
player.dispose();
|
||||
});
|
||||
|
||||
// Can't figure out how to test fullscreen events with tests
|
||||
// Browsers aren't triggering the events at least
|
||||
// asyncTest('should trigger the fullscreenchange event', function() {
|
||||
// expect(3);
|
||||
|
||||
// var player = PlayerTest.makePlayer();
|
||||
// player.on('fullscreenchange', function(){
|
||||
// ok(true, 'fullscreenchange event fired');
|
||||
// ok(this.isFullScreen === true, 'isFullScreen is true');
|
||||
// ok(this.el().className.indexOf('vjs-fullscreen') !== -1, 'vjs-fullscreen class added');
|
||||
|
||||
// player.dispose();
|
||||
// start();
|
||||
// });
|
||||
|
||||
// player.requestFullScreen();
|
||||
// });
|
||||
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário