Videoplayer small improvements
* Disable volume change on scroll * Add L key shortcut to toggle loop * Minor style fixes (missing font family)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
$videoplayer-controls-color: white
|
||||
$videoplayer-background-color: $black
|
||||
$videoplayer-background-color: darken($primary, 10%)
|
||||
|
||||
.video-js
|
||||
.vjs-big-play-button:before, .vjs-control:before, .vjs-modal-dialog
|
||||
@@ -30,7 +30,6 @@ $videoplayer-background-color: $black
|
||||
font-weight: normal
|
||||
font-style: normal
|
||||
|
||||
|
||||
.vjs-icon-play
|
||||
font-family: VideoJS
|
||||
font-weight: normal
|
||||
@@ -285,7 +284,6 @@ $videoplayer-background-color: $black
|
||||
line-height: 1
|
||||
font-weight: normal
|
||||
font-style: normal
|
||||
font-family: Arial, Helvetica, sans-serif
|
||||
-webkit-user-select: none
|
||||
-moz-user-select: none
|
||||
-ms-user-select: none
|
||||
@@ -712,8 +710,8 @@ body.vjs-full-window
|
||||
z-index: 1
|
||||
|
||||
.vjs-time-tooltip
|
||||
background-color: $videoplayer-background-color
|
||||
color: $videoplayer-controls-color
|
||||
background-color: $videoplayer-background-color
|
||||
z-index: 1
|
||||
|
||||
&:after
|
||||
@@ -735,9 +733,9 @@ body.vjs-full-window
|
||||
|
||||
.vjs-time-tooltip
|
||||
background-color: $videoplayer-controls-color
|
||||
border-radius: 3px
|
||||
border-radius: $border-radius
|
||||
color: $videoplayer-background-color
|
||||
font-family: $font-body
|
||||
font-family: $font-family-base
|
||||
font-size: 1.2em
|
||||
font-weight: bold
|
||||
padding: 5px 8px
|
||||
@@ -1041,7 +1039,6 @@ video::-webkit-media-text-track-display
|
||||
&:before
|
||||
color: $videoplayer-controls-color
|
||||
content: 'X'
|
||||
font-family: Arial, Helvetica, sans-serif
|
||||
font-size: 4em
|
||||
left: 0
|
||||
line-height: 1
|
||||
|
@@ -52,7 +52,6 @@ script(type="text/javascript").
|
||||
{% if node.video_sources %}
|
||||
|
||||
var videoPlayer = document.getElementById('videoplayer');
|
||||
|
||||
var options = {
|
||||
controlBar: {
|
||||
volumePanel: { inline: false }
|
||||
@@ -65,7 +64,62 @@ script(type="text/javascript").
|
||||
'eventCategory' : '{{ node.project }}',
|
||||
'eventsToTrack' : ['start', 'error', 'percentsPlayed']
|
||||
});
|
||||
this.hotkeys();
|
||||
|
||||
this.hotkeys({
|
||||
enableVolumeScroll: false,
|
||||
customKeys: {
|
||||
KeyL: {
|
||||
key: function(event) {
|
||||
return (event.which === 76);
|
||||
},
|
||||
handler: function(player, options, event) {
|
||||
videoPlayerToggleLoop(videoPlayer, videoPlayerLoopButton);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Generic utility to add-buttons to the player.
|
||||
function addVideoPlayerButton(data) {
|
||||
|
||||
var controlBar,
|
||||
newButton = document.createElement('button'),
|
||||
buttonContent = document.createElement('span');
|
||||
|
||||
newButton.className = 'vjs-control vjs-button ' + data.class;
|
||||
buttonContent.className = 'vjs-icon-placeholder';
|
||||
newButton.setAttribute('title', data.title);
|
||||
|
||||
newButton.appendChild(buttonContent);
|
||||
controlBar = document.getElementsByClassName('vjs-control-bar')[0];
|
||||
insertBeforeButton = document.getElementsByClassName('vjs-fullscreen-control')[0];
|
||||
controlBar.insertBefore(newButton, insertBeforeButton);
|
||||
|
||||
return newButton;
|
||||
}
|
||||
|
||||
// Video loop stuff. TODO: Move it to video_plugins.js
|
||||
var videoPlayerLoopButton = addVideoPlayerButton({
|
||||
player: videoPlayer,
|
||||
class: 'vjs-loop-button',
|
||||
icon: 'pi-replay',
|
||||
title: 'Loop'
|
||||
});
|
||||
|
||||
function videoPlayerToggleLoop(videoPlayer, videoPlayerLoopButton) {
|
||||
if (videoPlayer.loop){
|
||||
videoPlayer.loop = false;
|
||||
$(videoPlayerLoopButton).removeClass('vjs-control-active');
|
||||
} else {
|
||||
videoPlayer.loop = true;
|
||||
$(videoPlayerLoopButton).addClass('vjs-control-active');
|
||||
}
|
||||
}
|
||||
|
||||
videoPlayerLoopButton.onclick = function() {
|
||||
videoPlayerToggleLoop(videoPlayer, videoPlayerLoopButton);
|
||||
};
|
||||
|
||||
this.rememberVolumePlugin();
|
||||
|
||||
{% if current_user.is_authenticated %}
|
||||
@@ -75,45 +129,10 @@ script(type="text/javascript").
|
||||
'report_url': report_url,
|
||||
'fetch_progress_url': fetch_progress_url,
|
||||
});
|
||||
|
||||
{% endif %}
|
||||
});
|
||||
|
||||
function addVideoPlayerButton(data) {
|
||||
|
||||
var controlBar,
|
||||
newButton = document.createElement('button'),
|
||||
buttonContent = document.createElement('span');
|
||||
|
||||
newButton.className = 'vjs-control vjs-button ' + data.class;
|
||||
buttonContent.className = 'vjs-icon-placeholder';
|
||||
newButton.setAttribute('title', data.title);
|
||||
|
||||
newButton.appendChild(buttonContent);
|
||||
controlBar = document.getElementsByClassName('vjs-control-bar')[0];
|
||||
insertBeforeButton = document.getElementsByClassName('vjs-fullscreen-control')[0];
|
||||
controlBar.insertBefore(newButton, insertBeforeButton);
|
||||
|
||||
return newButton;
|
||||
}
|
||||
|
||||
var videoPlayerLoopButton = addVideoPlayerButton({
|
||||
player: videoPlayer,
|
||||
class: 'vjs-loop-button',
|
||||
icon: 'pi-replay',
|
||||
title: 'Loop'
|
||||
});
|
||||
|
||||
videoPlayerLoopButton.onclick = function() {
|
||||
if (videoPlayer.loop){
|
||||
videoPlayer.loop = false;
|
||||
$(this).removeClass('vjs-control-active');
|
||||
|
||||
} else {
|
||||
videoPlayer.loop = true;
|
||||
$(this).addClass('vjs-control-active');
|
||||
}
|
||||
};
|
||||
|
||||
{% endif %} // if node.video_sources
|
||||
|
||||
| {% endblock node_scripts %}
|
||||
|
Reference in New Issue
Block a user