mirror of
https://github.com/videojs/video.js.git
synced 2025-01-21 11:02:08 +02:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
016e94f889
@ -102,6 +102,12 @@ body.vjs-full-window {
|
||||
/* Hide disabled or unsupported controls */
|
||||
.vjs-default-skin .vjs-hidden { display: none; }
|
||||
|
||||
.vjs-lock-showing {
|
||||
display: block !important;
|
||||
opacity: 1;
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
/* DEFAULT SKIN (override in another file to create new skins)
|
||||
================================================================================
|
||||
Instead of editing this file, I recommend creating your own skin CSS file to be included after this file,
|
||||
|
@ -545,10 +545,7 @@ vjs.Component.prototype.fadeOut = function(){
|
||||
* @return {vjs.Component}
|
||||
*/
|
||||
vjs.Component.prototype.lockShowing = function(){
|
||||
var style = this.el_.style;
|
||||
style.display = 'block';
|
||||
style.opacity = 1;
|
||||
style.visibility = 'visible';
|
||||
this.addClass('vjs-lock-showing');
|
||||
return this;
|
||||
};
|
||||
|
||||
@ -557,10 +554,7 @@ vjs.Component.prototype.lockShowing = function(){
|
||||
* @return {vjs.Component}
|
||||
*/
|
||||
vjs.Component.prototype.unlockShowing = function(){
|
||||
var style = this.el_.style;
|
||||
style.display = '';
|
||||
style.opacity = '';
|
||||
style.visibility = '';
|
||||
this.removeClass('vjs-lock-showing');
|
||||
return this;
|
||||
};
|
||||
|
||||
|
@ -22,7 +22,8 @@ vjs.CoreObject.extend = function(props){
|
||||
props = props || {};
|
||||
// Set up the constructor using the supplied init method
|
||||
// or using the init of the parent object
|
||||
init = props.init || this.prototype.init || function(){};
|
||||
// Make sure to check the unobfuscated version for external libs
|
||||
init = props['init'] || props.init || this.prototype['init'] || this.prototype.init || function(){};
|
||||
// In Resig's simple class inheritance (previously used) the constructor
|
||||
// is a function that calls `this.init.apply(arguments)`
|
||||
// However that would prevent us from using `ParentObject.call(this);`
|
||||
|
@ -52,6 +52,7 @@ var vjs = function(id, options, ready){
|
||||
|
||||
// Extended name, also available externally, window.videojs
|
||||
var videojs = vjs;
|
||||
window.videojs = window.vjs = vjs;
|
||||
|
||||
// CDN Version. Used to target right flash swf.
|
||||
vjs.CDN_VERSION = 'GENERATED_CDN_VSN';
|
||||
|
@ -189,6 +189,9 @@ vjs.fixEvent = function(event) {
|
||||
|
||||
// Stop the default browser action
|
||||
event.preventDefault = function () {
|
||||
if (old.preventDefault) {
|
||||
old.preventDefault();
|
||||
}
|
||||
event.returnValue = false;
|
||||
event.isDefaultPrevented = returnTrue;
|
||||
};
|
||||
@ -197,6 +200,9 @@ vjs.fixEvent = function(event) {
|
||||
|
||||
// Stop the event from bubbling
|
||||
event.stopPropagation = function () {
|
||||
if (old.stopPropagation) {
|
||||
old.stopPropagation();
|
||||
}
|
||||
event.cancelBubble = true;
|
||||
event.isPropagationStopped = returnTrue;
|
||||
};
|
||||
@ -205,6 +211,9 @@ vjs.fixEvent = function(event) {
|
||||
|
||||
// Stop the event from bubbling and executing other handlers
|
||||
event.stopImmediatePropagation = function () {
|
||||
if (old.stopImmediatePropagation) {
|
||||
old.stopImmediatePropagation();
|
||||
}
|
||||
event.isImmediatePropagationStopped = returnTrue;
|
||||
event.stopPropagation();
|
||||
};
|
||||
|
@ -12,15 +12,15 @@
|
||||
vjs.Html5 = vjs.MediaTechController.extend({
|
||||
/** @constructor */
|
||||
init: function(player, options, ready){
|
||||
// volume cannot be changed from 1 on iOS
|
||||
this.features.volumeControl = vjs.Html5.canControlVolume();
|
||||
|
||||
// In iOS, if you move a video element in the DOM, it breaks video playback.
|
||||
this.features.movingMediaElementInDOM = !vjs.IS_IOS;
|
||||
|
||||
vjs.MediaTechController.call(this, player, options, ready);
|
||||
|
||||
// volume cannot be changed from 1 on iOS
|
||||
this.features.volumeControl = vjs.Html5.canControlVolume();
|
||||
|
||||
// In iOS, if you move a video element in the DOM, it breaks video playback.
|
||||
this.features.movingMediaElementInDOM = !vjs.IS_IOS;
|
||||
|
||||
var source = options['source'];
|
||||
var source = options['source'];
|
||||
|
||||
// If the element source is already set, we may have missed the loadstart event, and want to trigger it.
|
||||
// We don't want to set the source again and interrupt playback.
|
||||
|
@ -58,4 +58,5 @@ vjs.one(window, 'load', function(){
|
||||
});
|
||||
|
||||
// Run Auto-load players
|
||||
vjs.autoSetup();
|
||||
// You have to wait at least once in case this script is loaded after your video in the DOM (weird behavior only with minified version)
|
||||
vjs.autoSetupTimeout(1);
|
||||
|
@ -135,9 +135,7 @@ vjs.Slider.prototype.calculateDistance = function(event){
|
||||
boxW = boxW - handleW;
|
||||
}
|
||||
|
||||
// This is done because on Android, event.pageX is always 0 and the actual
|
||||
// values live under the changedTouches array.
|
||||
if (pageX === 0 && event.changedTouches) {
|
||||
if (event.changedTouches) {
|
||||
pageX = event.changedTouches[0].pageX;
|
||||
}
|
||||
|
||||
@ -161,4 +159,4 @@ vjs.Slider.prototype.onKeyPress = function(event){
|
||||
|
||||
vjs.Slider.prototype.onBlur = function(){
|
||||
vjs.off(document, 'keyup', vjs.bind(this, this.onKeyPress));
|
||||
};
|
||||
};
|
||||
|
24
test/unit/controls.js
vendored
24
test/unit/controls.js
vendored
@ -75,3 +75,27 @@ test('should test and toggle volume control on `loadstart`', function(){
|
||||
ok(muteToggle.el().className.indexOf('vjs-hidden') < 0,
|
||||
'muteToggle does not show itself');
|
||||
});
|
||||
|
||||
test('calculateDistance should use changedTouches, if available', function() {
|
||||
var noop, player, slider, event;
|
||||
noop = function(){};
|
||||
player = {
|
||||
id: noop,
|
||||
on: noop,
|
||||
ready: noop
|
||||
};
|
||||
slider = new vjs.Slider(player);
|
||||
document.body.appendChild(slider.el_);
|
||||
slider.el_.style.position = 'absolute';
|
||||
slider.el_.style.width = '200px';
|
||||
slider.el_.style.left = '0px';
|
||||
|
||||
event = {
|
||||
pageX: 10,
|
||||
changedTouches: [{
|
||||
pageX: 100
|
||||
}]
|
||||
};
|
||||
|
||||
equal(slider.calculateDistance(event), 0.5, 'we should have touched exactly in the center, so, the ratio should be half');
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user