mirror of
https://github.com/videojs/video.js.git
synced 2024-12-25 02:42:10 +02:00
Removed the CDN publishing logic into it's own repo
See videojs/cdn#3 - Added a guide note about skipping analytics tracking on the CDN - Updated videojs-font - Added videojs-ie8 as a dependency - Updated the examples directory URLs and added to dist - Updated CSS to override font path
This commit is contained in:
parent
6410105190
commit
4803ac2674
@ -46,6 +46,7 @@ CHANGELOG
|
||||
* @carpasse enhanced events to allow passing a second data argument ([view](https://github.com/videojs/video.js/pull/2163))
|
||||
* @bc-bbay made the duration display update itself on loadedmetadata ([view](https://github.com/videojs/video.js/pull/2169))
|
||||
* @arwidt added Swedish and Finnish translations ([view](https://github.com/videojs/video.js/pull/2189))
|
||||
* @heff moved all the CDN logic into videojs/cdn ([view](https://github.com/videojs/video.js/pull/2230))
|
||||
|
||||
--------------------
|
||||
|
||||
|
62
build/cdn.js
62
build/cdn.js
@ -1,62 +0,0 @@
|
||||
/**
|
||||
* 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
|
||||
* browsers and devices, and possibly track errors.
|
||||
*
|
||||
* This code generates the GA tracking URL without requiring the GA javascript
|
||||
* library.
|
||||
*
|
||||
* @type {Image}
|
||||
*/
|
||||
;(function(i,w,n,e,l){
|
||||
l=w.location;
|
||||
|
||||
// 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.
|
||||
if (Math.random() > 0.01) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Setting the source of an image will load the URL even without adding to dom
|
||||
// Using //www, still seems to work for https even though ssl.google is used by google
|
||||
i.src='//www.google-analytics.com/__utm.gif'
|
||||
// Version
|
||||
+'?utmwv=5.4.2'
|
||||
// ID
|
||||
+'&utmac=UA-16505296-2'
|
||||
// Sessions
|
||||
// &utms=2
|
||||
// Cache breaker (using utmcc to do this)
|
||||
+'&utmn='+1
|
||||
+'&utmhn='+e(l.hostname)
|
||||
// Encoding
|
||||
// &utmcs=UTF-8
|
||||
+'&utmsr='+w.screen.availWidth+'x'+w.screen.availHeight
|
||||
// Browser window
|
||||
// &utmvp=1057x1105
|
||||
// Color depth
|
||||
// &utmsc=24-bit
|
||||
+'&utmul='+(n.language||n.userLanguage||'').toLowerCase()
|
||||
// Java
|
||||
// &utmje=1
|
||||
// Flash version
|
||||
// &utmfl=11.7%20r700
|
||||
// Page title
|
||||
// &utmdt=HTML5%20Video%20Player%20%7C%20Video.js
|
||||
// Adsense
|
||||
// &utmhid=1112291628
|
||||
// Referrer, '-' is none
|
||||
// Using current page as referrer so stats show up cleaner than "Direct"
|
||||
+'&utmr='+e(l.href)
|
||||
+'&utmp='+e(l.hostname+l.pathname)
|
||||
// Current time stamp
|
||||
// &utmht=1370890439353
|
||||
// ?
|
||||
// &utmu=q
|
||||
// Cookies! Manually setting visitor ID and setting everything else to 1
|
||||
// Random number used as cache buster instead of utmn
|
||||
+'&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
|
||||
+'&utme=8(vjsv)9(v0.0.0)'
|
||||
;
|
||||
})(new Image(),window,navigator,encodeURIComponent);
|
@ -1,25 +0,0 @@
|
||||
var uglify = require('uglify-js');
|
||||
|
||||
module.exports = function(grunt) {
|
||||
grunt.registerTask('dist-cdn', 'Assembling distribution', function(){
|
||||
let css;
|
||||
let jsmin;
|
||||
let jsdev;
|
||||
let 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);
|
||||
});
|
||||
}
|
@ -4,13 +4,14 @@
|
||||
<title>Video.js | HTML5 Video Player</title>
|
||||
|
||||
<!-- Chang URLs to wherever Video.js files will be hosted -->
|
||||
<link href="../../../build/temp/video-js.min.css" rel="stylesheet" type="text/css">
|
||||
<!-- Default URLs assume the examples folder is included alongside video.js -->
|
||||
<link href="../../video-js.min.css" rel="stylesheet" type="text/css">
|
||||
<!-- video.js must be in the <head> for older IEs to work. -->
|
||||
<script src="../../../build/temp/video.min.js"></script>
|
||||
<script src="../../video.min.js"></script>
|
||||
|
||||
<!-- Unless using the CDN hosted version, update the URL to the Flash SWF -->
|
||||
<script>
|
||||
videojs.options.flash.swf = "../../../build/temp/video-js.swf";
|
||||
videojs.options.flash.swf = "../../video-js.swf";
|
||||
</script>
|
||||
|
||||
</head>
|
||||
|
@ -24,6 +24,11 @@ You can download the Video.js source and host it on your own servers, or use the
|
||||
<script src="//vjs.zencdn.net/4.12/video.min.js"></script>
|
||||
```
|
||||
|
||||
We include a stripped down Google Analytics pixel that tracks a random percentage (currently 1%) of players loaded from the CDN. This allows us to see (roughly) what browsers are in use in the wild, along with other useful metrics such as OS and device. If you'd like to disable analytics, you can simply include the following global **before** including Video.js:
|
||||
|
||||
```js
|
||||
window.HELP_IMPROVE_VIDEOJS = false;
|
||||
```
|
||||
|
||||
## Install via package manager
|
||||
|
||||
|
71
grunt.js
71
grunt.js
@ -89,64 +89,12 @@ module.exports = function(grunt) {
|
||||
{expand: true, cwd: 'build/temp/', src: ['*'], dest: 'dist/'+version.full+'/', filter: 'isFile'} // includes files in path
|
||||
]
|
||||
},
|
||||
fonts: { expand: true, cwd: './node_modules/videojs-font/fonts/', 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: {
|
||||
options: {
|
||||
accessKeyId: process.env.VJS_S3_KEY,
|
||||
secretAccessKey: process.env.VJS_S3_SECRET,
|
||||
bucket: process.env.VJS_S3_BUCKET,
|
||||
access: 'public-read',
|
||||
uploadConcurrency: 5
|
||||
},
|
||||
patch: {
|
||||
files: [
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'dist/cdn/',
|
||||
src: ['**'],
|
||||
dest: 'vjs/'+version.full+'/',
|
||||
params: { CacheControl: 'public, max-age=31536000' }
|
||||
}
|
||||
]
|
||||
},
|
||||
minor: {
|
||||
files: [
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'dist/cdn/',
|
||||
src: ['**'],
|
||||
dest: 'vjs/'+version.majorMinor+'/',
|
||||
params: { CacheControl: 'public, max-age=2628000' }
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
fastly: {
|
||||
options: {
|
||||
key: process.env.VJS_FASTLY_API_KEY
|
||||
},
|
||||
minor: {
|
||||
options: {
|
||||
host: 'vjs.zencdn.net',
|
||||
urls: [
|
||||
version.majorMinor+'/*'
|
||||
]
|
||||
}
|
||||
},
|
||||
patch: {
|
||||
options: {
|
||||
host: 'vjs.zencdn.net',
|
||||
urls: [
|
||||
version.full+'/*'
|
||||
]
|
||||
}
|
||||
}
|
||||
fonts: { cwd: 'node_modules/videojs-font/fonts/', src: ['*'], dest: 'build/temp/font/', expand: true, filter: 'isFile' },
|
||||
swf: { cwd: 'node_modules/videojs-swf/dist/', src: 'video-js.swf', dest: 'build/temp/', expand: true, filter: 'isFile' },
|
||||
ie8: { cwd: 'node_modules/videojs-ie8/dist/', src: ['**/**'], dest: 'build/temp/ie8/', expand: true, filter: 'isFile' },
|
||||
novtt: { cwd: 'build/temp/', src: 'video.novtt.js', dest: 'build/temp/alt/', expand: true, filter: 'isFile' },
|
||||
dist: { cwd: 'build/temp/', src: ['**/**', '!test*'], dest: 'dist/', expand: true, filter: 'isFile' },
|
||||
examples: { cwd: 'docs/examples/', src: ['**/**'], dest: 'dist/examples/', expand: true, filter: 'isFile' }
|
||||
},
|
||||
cssmin: {
|
||||
minify: {
|
||||
@ -388,6 +336,7 @@ module.exports = function(grunt) {
|
||||
'cssmin',
|
||||
'copy:fonts',
|
||||
'copy:swf',
|
||||
'copy:ie8',
|
||||
'vjslanguages'
|
||||
]);
|
||||
|
||||
@ -399,12 +348,6 @@ module.exports = function(grunt) {
|
||||
'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']);
|
||||
|
||||
|
@ -27,6 +27,8 @@
|
||||
"lodash-compat": "^3.9.3",
|
||||
"object.assign": "^2.0.1",
|
||||
"safe-json-parse": "^4.0.0",
|
||||
"videojs-font": "1.2.0",
|
||||
"videojs-ie8": "1.1.0",
|
||||
"videojs-swf": "4.7.0",
|
||||
"vtt.js": "git+https://github.com/gkatsev/vtt.js.git#shim-build"
|
||||
},
|
||||
@ -80,8 +82,7 @@
|
||||
"sinon": "~1.9.1",
|
||||
"time-grunt": "^1.1.1",
|
||||
"uglify-js": "~2.3.6",
|
||||
"videojs-doc-generator": "0.0.1",
|
||||
"videojs-font": "^1.1.0"
|
||||
"videojs-doc-generator": "0.0.1"
|
||||
},
|
||||
"standard": {
|
||||
"ignore": [
|
||||
|
@ -1,6 +1,7 @@
|
||||
@import "variables";
|
||||
@import "utilities";
|
||||
|
||||
$icon-font-path: 'font';
|
||||
@import "../../node_modules/videojs-font/scss/icons";
|
||||
|
||||
@import "components/layout";
|
||||
|
@ -92,7 +92,7 @@ setup.autoSetupTimeout(1, videojs);
|
||||
* Current software version (semver)
|
||||
* @type {String}
|
||||
*/
|
||||
videojs['VERSION'] = '__VERSION__';
|
||||
videojs.VERSION = '__VERSION__';
|
||||
|
||||
/**
|
||||
* Get the global options object
|
||||
@ -118,15 +118,6 @@ videojs.setGlobalOptions = function(newOptions) {
|
||||
return mergeOptions(globalOptions, newOptions);
|
||||
};
|
||||
|
||||
// Set CDN Version of swf
|
||||
const MINOR_VERSION = '__VERSION_NO_PATCH__';
|
||||
const ACCESS_PROTOCOL = ('https:' === document.location.protocol ? 'https://' : 'http://');
|
||||
|
||||
// The added (+) blocks the replace from changing this _VERSION_NO_PATCH_ string
|
||||
if (MINOR_VERSION !== '__VERSION_'+'NO_PATCH__') {
|
||||
globalOptions['flash']['swf'] = `${ACCESS_PROTOCOL}vjs.zencdn.net/${MINOR_VERSION}/video-js.swf`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an object with the currently created players, keyed by player ID
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user