Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Base Theme #1999

Closed
wants to merge 26 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
6df2c7f
broke apart 4.0 default theme into components
mmcc Jan 6, 2015
74ddc57
removed old less style. no going back now.
mmcc Jan 6, 2015
0fb8ee6
switched back to video-js.scss naming and added a base-style injectio…
mmcc Jan 6, 2015
27bff92
cleaned up and simplified big play btn
mmcc Jan 6, 2015
a2f2080
Flexbox straight flexin.
mmcc Jan 7, 2015
b6a3442
move to using variables for text and icon font families
mmcc Jan 7, 2015
2092c48
use table layout for IE 8 and 9
mmcc Jan 8, 2015
1229a14
moved volume to be vertical by default
mmcc Jan 8, 2015
fa545f0
moved to using extend for icons
mmcc Jan 10, 2015
6617c42
added horizontal classes
mmcc Jan 14, 2015
a8003a1
added connect-watch grunt task
mmcc Jan 16, 2015
b19ce61
show all the things in the control bar so everything is available by …
mmcc Jan 22, 2015
1017e5a
reignore dist for now
mmcc Apr 2, 2015
9db5a21
removing trailing comma to get the tests passing
mmcc Apr 2, 2015
13398cd
Switched to using libsass and removed incompatible "black magic"
mmcc Apr 11, 2015
f7503ff
updating to es6 syntax
mmcc Apr 23, 2015
a518a01
removed old separator, added grunt task for dev, and updated example
mmcc Apr 24, 2015
964526e
singular time-control and live-control. remove playing class on pause
mmcc Apr 24, 2015
d341ef2
updated separator control styles
mmcc Apr 24, 2015
697325e
Show full control bar when a player goes to fullscreen.
mmcc Apr 24, 2015
adc5415
allow poster image to toggle playback
mmcc Apr 24, 2015
1c31605
fixed issue with scrollbars in Chrome on Linux
mmcc Apr 24, 2015
010893c
adding back things @heff found missing
mmcc Apr 25, 2015
0a50351
make the control bar not-quite-black
mmcc Apr 25, 2015
28bcb7d
added back some focus highlights until we decide on another path
mmcc Apr 28, 2015
854f35a
re-removing unused grunt things
mmcc Apr 28, 2015
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
.DS_Store
dist/*
build/files/*
build/temp/*
docs/api/*
Expand All @@ -26,3 +25,6 @@ sandbox/*

test/coverage/*
.coveralls.yml
.sass-cache

dist/*
33 changes: 24 additions & 9 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,27 @@ module.exports = function(grunt) {
},
dist: {},
watch: {
files: [ 'src/**/*', 'test/unit/**/*.js', 'Gruntfile.js' ],
tasks: 'dev'
default: {
files: [ 'src/**/*', 'test/unit/**/*.js', 'Gruntfile.js' ],
tasks: 'dev'
},
skin: {
files: ['src/css/**/*'],
tasks: 'sass'
}
},
connect: {
dev: {
preview: {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

connect:preview doesn't look like it's used anywhere else. What's it for?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

grunt connect:preview is the old way of doing things. grunt connect:dev is used in conjunction with watch so you can have a server and still get new sass hotness on saves.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way we can get all the watch tasks and the server into one
command?

Sent from mobile

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I just did it this way to preserve the old way so I wouldn't surprise people. We can definitely just combine everything.

options: {
port: 9999,
keepalive: true
}
},
dev: {
options: {
port: 9999,
livereload: true
}
}
},
copy: {
Expand Down Expand Up @@ -143,10 +155,10 @@ module.exports = function(grunt) {
ext: '.min.css'
}
},
less: {
dev: {
sass: {
dist: {
files: {
'build/temp/video-js.css': 'src/css/video-js.less'
'build/temp/video-js.css': 'src/css/video-js.scss'
}
}
},
Expand Down Expand Up @@ -308,7 +320,7 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-sass');
grunt.loadNpmTasks('grunt-karma');
grunt.loadNpmTasks('videojs-doc-generator');
grunt.loadNpmTasks('grunt-zip');
Expand All @@ -333,7 +345,7 @@ module.exports = function(grunt) {
'concat:vtt',
'exorcise',
'uglify',
'less',
'sass',
'version:css',
'cssmin',
'copy:fonts',
Expand Down Expand Up @@ -362,7 +374,10 @@ module.exports = function(grunt) {
grunt.registerTask('default', ['build', 'test']);

// Development watch task. Doing the minimum required.
grunt.registerTask('dev', ['jshint', 'less', 'browserify', 'karma:chrome']);
grunt.registerTask('dev', ['connect:dev', 'jshint', 'sass', 'browserify', 'karma:chrome']);

// Skin development watch task.
grunt.registerTask('skin-dev', ['connect:dev', 'watch:skin']);

// Tests.
// We want to run things a little differently if it's coming from Travis vs local
Expand Down
27 changes: 14 additions & 13 deletions docs/guides/skins.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
Skins
=====

The default Video.js skin is made using HTML and CSS, so there's no need to learn a complicated skinning language to update colors or even create an entirely new skin.
The base Video.js skin is made using HTML and CSS (although we use the [Sass preprocessor](http://sass-lang.com)), and by default these styles are added to the dom for you! That means you can build a custom skin by simply taking advantage of the cascading aspect of CSS and overriding
the styles you'd like to change.

## Icons

New in version 4.0 is the use of font icons. All of the icons (play, pause, etc.) use the new custom font, which allows the icons to be scaled and colored just like any other text font.
If you don't want Video.js to inject the base styles for you, you can disable it by setting `window.VIDEOJS_NO_BASE_THEME = false` before Video.js is loaded. Keep in mind that without these base styles
enabled, you'll need to manually include them.

All of the icons are available as variables in the [LESS](https://github.com/videojs/video.js/blob/master/src/css/video-js.less#L87-L99) source, making it easy to replace icons (such as the loading spinner). The easiest way to try this out is by using the [player skin designer](http://designer.videojs.com/).
## Icons

![available icons](https://i.cloudup.com/wb51GGDDnJ.png)
You can view all of the icons available in the base theme by renaming and viewing [`icons.html.example`](../../sandbox/icons.html.example) in the sandbox directory.

## Customization

When you create a new skin, you can either override styles in the default skin:
When you create a new skin, the easiest way to get started is to simply override the base Video.js theme. You should include a new class matching the
name of your theme, then just start overriding!

```css
.vjs-default-skin .vjs-play-progress { background: #900; }
.vjs-skin-hotdog-stand { color: #FF0000; }
.vjs-skin-hotdog-stand .vjs-control-bar { background: #FFFF00; }
.vjs-skin-hotdog-stand .vjs-play-progress { background: #FF0000; }
```

Or remove the 'vjs-default-skin' class from the video tag and create a new skin from scratch.

```html
<video class="video-js my-custom-skin" ...>
```
This would take care of the major areas of the skin (play progress, the control bar background, and icon colors), but you can skin any other aspect.
Our suggestion is to use a browser such as Firefox and Chrome, and use the developer tools to inspect the different elements and see what you'd like to change and what classes
to target when you do so.

More custom skins will be available for download soon. If you have one you like you can share it by forking [this example on CodePen.io](http://codepen.io/heff/pen/EarCt), and adding a link on the [Skins wiki page](https://github.com/videojs/video.js/wiki/Skins).
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"grunt-fastly": "^0.1.3",
"grunt-github-releaser": "^0.1.17",
"grunt-karma": "^0.8.3",
"grunt-sass": "^0.18.1",
"grunt-version": "~0.3.0",
"grunt-videojs-languages": "0.0.4",
"grunt-zip": "0.10.2",
Expand Down
38 changes: 38 additions & 0 deletions sandbox/icons.html.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Video.js Icons Sandbox</title>

<link href="../build/temp/video-js.css" rel="stylesheet" type="text/css">

<style>
.icon-list li span { font-size: 150% }
</style>
</head>
<body>
<h1>Video.js Icons</h1>
<p>This is a list of all of the icons available in the Video.js base stylesheet. The appropriate class is to the right of each icon.</p>

<ul class="icon-list">
<li><span class="vjs-icon-play"></span> <code>.vjs-icon-play</code></li>
<li><span class="vjs-icon-pause"></span> <code>.vjs-icon-pause</code></li>
<li><span class="vjs-icon-volume-mute"></span> <code>.vjs-icon-volume-mute</code></li>
<li><span class="vjs-icon-volume-low"></span> <code>.vjs-icon-volume-low</code></li>
<li><span class="vjs-icon-volume-mid"></span> <code>.vjs-icon-volume-mid</code></li>
<li><span class="vjs-icon-volume-high"></span> <code>.vjs-icon-volume-high</code></li>
<li><span class="vjs-icon-fullscreen-enter"></span> <code>.vjs-icon-fullscreen-enter</code></li>
<li><span class="vjs-icon-fullscreen-exit"></span> <code>.vjs-icon-fullscreen-exit</code></li>
<li><span class="vjs-icon-square"></span> <code>.vjs-icon-square</code></li>
<li><span class="vjs-icon-spinner"></span> <code>.vjs-icon-spinner</code></li>
<li><span class="vjs-icon-subtitles"></span> <code>.vjs-icon-subtitles</code></li>
<li><span class="vjs-icon-captions"></span> <code>.vjs-icon-captions</code></li>
<li><span class="vjs-icon-chapters"></span> <code>.vjs-icon-chapters</code></li>
<li><span class="vjs-icon-share"></span> <code>.vjs-icon-share</code></li>
<li><span class="vjs-icon-cog"></span> <code>.vjs-icon-cog</code></li>
<li><span class="vjs-icon-circle"></span> <code>.vjs-icon-circle</code></li>
<li><span class="vjs-icon-circle-outline"></span> <code>.vjs-icon-circle-outline</code></li>
<li><span class="vjs-icon-circle-inner-circle"></span> <code>.vjs-icon-circle-inner-circle</code></li>
</ul>
</body>
</html>
3 changes: 1 addition & 2 deletions sandbox/index.html.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@

<link href="../build/temp/video-js.css" rel="stylesheet" type="text/css">

<!-- LOAD VIDEO.JS SOURCE FILES IN ORDER -->
<script src="../build/temp/video.js"></script>

<!-- Set the location of the flash SWF -->
<script>
vjs.options.flash.swf = '../build/temp/video-js.swf'
videojs.options.flash.swf = '../build/temp/video-js.swf';
</script>

</head>
Expand Down
95 changes: 95 additions & 0 deletions src/css/_utilities.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
@mixin background-color-with-alpha($color, $alpha) {
background-color: $color;
background-color: rgba($color, $alpha);
}

@mixin transition($string: $transition--default) {
-webkit-transition: $string;
-moz-transition: $string;
-o-transition: $string;
transition: $string;
}

@mixin hide-visually {
border: 0;
clip: rect(0 0 0 0);
height: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute;
width: 1px;
}

@mixin border-radius($radius) {
-webkit-border-radius: $radius;
-moz-border-radius: $radius;
border-radius: $radius;
}

@mixin animation($string: spin 1s infinite linear) {
-webkit-animation: $string;
-moz-animation: $string;
-o-animation: $string;
animation: $string;
}

@mixin display-flex($alignment: '', $justification: '') {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;

@if $alignment != '' {
-webkit-box-align: $alignment;
-webkit-align-items: $alignment;
-ms-flex-align: $alignment;
align-items: $alignment;
}

@if $justification != '' {
-webkit-box-pack: $justification;
-webkit-justify-content: $justification;
-ms-flex-pack: $justification;
justify-content: $justification;
}
}

@mixin flex($value) {
// @include context('.video-js', '.video-js.vjs-no-flex') {
// display: table-cell;
// vertical-align: middle;
// @if ($value == 'auto') {
// width: auto;
// }
// }

-webkit-box-flex: $value;
-moz-box-flex: $value;
-webkit-flex: $value;
-ms-flex: $value;
flex: $value;
}

// https://developer.mozilla.org/en-US/docs/Web/CSS/user-select
@mixin user-select($string: none) {
-webkit-user-select: $string;
-moz-user-select: $string;
-ms-user-select: $string;
user-select: $string
}

// https://developer.mozilla.org/en-US/docs/Web/CSS/box-shadow
@mixin box-shadow ($string: 0 0 1em rgba(0, 0, 0, 0.25)) {
-webkit-box-shadow: $string;
-moz-box-shadow: $string;
box-shadow: $string;
}

@mixin order($value) {
-webkit-box-ordinal-group: $value;
-moz-box-ordinal-group: $value;
-ms-flex-order: $value;
-webkit-order: $value;
order: $value;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is order red here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

¯_(ツ)_/¯

}
12 changes: 12 additions & 0 deletions src/css/_variables.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
$primary-text: #fff;
$secondary-text: #F4A460; // currently just used for visited links in errors and such.

$primary-bg: #000;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should do something like:

// colors.scss
$black: #000

//vars.scss
$primary-bg: $black

// other files
background-color: $primary-bg

that way, if we feel like changing our "black" to be #3c3c3c or something, we only change it in one place. The primary/stuff is already good the way it is :)

$secondary-bg: lighten($primary-bg, 35%);

$icon-font-family: 'VideoJS';
$text-font-family: Arial, sans-serif;
$base-font-size: 10px;

$control-bar-bg: #2B333F;
$control-bar-transparency: 0.5;
37 changes: 37 additions & 0 deletions src/css/components/_adaptive.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// When the player is absurdly tiny, display nothing but:
// - Play button
// - Fullscreen Button
.video-js.vjs-layout-tiny:not(.vjs-fullscreen) {
.vjs-custom-control-spacer { @include flex(auto); }
&.vjs-no-flex .vjs-custom-control-spacer { width: auto; }

.vjs-current-time, .vjs-captions-button, .vjs-time-divider,
.vjs-progress-control, .vjs-duration, .vjs-remaining-time, .vjs-playback-rate,
.vjs-mute-control, .vjs-volume-control, .vjs-chapters-button, .vjs-captions-button,
.vjs-subtitles-button, .vjs-volume-menu-button { display: none; }
}

// When the player is x-small, display nothing but:
// - Play button
// - Progress bar
// - Fullscreen Button
.video-js.vjs-layout-x-small:not(.vjs-fullscreen) {
.vjs-current-time, .vjs-captions-button, .vjs-time-divider,
.vjs-duration, .vjs-remaining-time, .vjs-playback-rate, .vjs-captions-button,
.vjs-mute-control, .vjs-volume-control, .vjs-chapters-button,
.vjs-subtitles-button, .vjs-volume-button, .vjs-fullscreen-control { display: none; }
}


// When the player is small, display nothing but:
// - Play button
// - Progress bar
// - Volume menu button
// - Captions Button
// - Fullscreen button
.video-js.vjs-layout-small:not(.vjs-fullscreen) {
.vjs-current-time, .vjs-captions-button, .vjs-time-divider,
.vjs-duration, .vjs-remaining-time, .vjs-playback-rate,
.vjs-mute-control, .vjs-volume-control, .vjs-chapters-button,
.vjs-subtitles-button { display: none; }
}
40 changes: 40 additions & 0 deletions src/css/components/_big-play.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
.video-js .vjs-big-play-button {
font-size: 3em;
line-height: 1em;
display: block;
z-index: 2;
position: absolute;
top: 10px;
left: 10px;
padding: 0.2em 1em;
cursor: pointer;
opacity: 1;
border: 2px solid $primary-text;

/* Need a slightly gray bg so it can be seen on black backgrounds *///
@include background-color-with-alpha($primary-bg, 0.8);
@include border-radius(0.3em);
@include transition(all 0.4s);

@extend .vjs-icon-play;
}

/* Hide if controls are disabled, the video is playing, or native controls are used. */
.video-js.vjs-controls-disabled .vjs-big-play-button,
.video-js.vjs-has-started .vjs-big-play-button,
.video-js.vjs-using-native-controls .vjs-big-play-button {
display: none;
}

.video-js:hover .vjs-big-play-button,
.video-js .vjs-big-play-button:focus {
outline: 0;
border-color: $primary-text;

@include background-color-with-alpha($secondary-bg, 0.75);
@include transition(all 0s);
}

.vjs-error .vjs-big-play-button {
display: none;
}
3 changes: 3 additions & 0 deletions src/css/components/_captions.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.video-js .vjs-captions-button {
@extend .vjs-icon-captions;
}
12 changes: 12 additions & 0 deletions src/css/components/_chapters.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.video-js .vjs-chapters-button {
@extend .vjs-icon-chapters;
}

.video-js .vjs-chapters-button.vjs-menu-button .vjs-menu {
left: 2em;
}

.video-js .vjs-chapters-button.vjs-menu-button .vjs-menu .vjs-menu-content {
width: 24em;
left: -12em;
}
Loading