update video elements

This commit is contained in:
rlx 2011-12-19 21:13:11 +00:00
parent 609754fbad
commit 0a79291c58
4 changed files with 47 additions and 24 deletions

View file

@ -6,6 +6,7 @@ Ox.SmallVideoTimeline = function(options, self) {
var that = Ox.Element({}, self)
.defaults({
_offset: 0, // hack for cases where all these position: absolute elements have to go into a float: left
disabled: false,
duration: 0,
editing: false,
find: '',
@ -148,7 +149,7 @@ Ox.SmallVideoTimeline = function(options, self) {
}
function mousedown(e) {
if ($(e.target).is('.OxInterface')) {
if (!self.options.disabled && $(e.target).is('.OxInterface')) {
self.options.position = getPosition(e);
setPositionMarker();
if (!self.triggered) {

View file

@ -179,6 +179,7 @@ Ox.VideoEditor = function(options, self) {
['goto', 'set', 'space', 'position'],
duration: self.options.duration,
enableMouse: true,
enablePosition: true,
externalControls: true,
find: self.options.find,
height: self.sizes.player[i].height,

View file

@ -67,6 +67,8 @@ Ox.VideoPanelPlayer = function(options, self) {
enableFind: true,
enableKeyboard: true,
enableMouse: true,
enablePosition: true,
enableTimeline: true,
find: self.options.find,
fullscreen: self.options.fullscreen,
height: getPlayerHeight(),

View file

@ -87,6 +87,9 @@ Ox.VideoPlayer = function(options, self) {
enableFind: false,
enableFullscreen: false,
enableKeyboard: false,
enableMouse: false,
enablePosition: false,
enableTimeline: false,
externalControls: false,
find: '',
focus: 'click',
@ -297,7 +300,7 @@ Ox.VideoPlayer = function(options, self) {
preload: self.options.preload,
src: self.video,
}, !self.options.paused && !self.options.playInToOut ? {
autoplay: 'autoplay'
/*autoplay: 'autoplay'*/
} : {}/*, self.options.poster ? {
poster: self.options.poster
} : {}*/)
@ -501,7 +504,22 @@ Ox.VideoPlayer = function(options, self) {
self.options['controls' + titleCase].forEach(function(control) {
if (control == 'find') {
if (control == 'close') {
self.$closeButton = Ox.Button({
style: 'symbol',
title: 'close',
tooltip: 'Close',
type: 'image'
})
.bindEvent({
click: function() {
that.triggerEvent('close');
}
})
.appendTo(self['$controls' + titleCase]);
} else if (control == 'find') {
self.$findButton = Ox.Button({
style: 'symbol',
@ -626,24 +644,26 @@ Ox.VideoPlayer = function(options, self) {
.html(formatPosition())
.bind({
click: function() {
if (self.options.type == 'play') {
if (!self.options.paused) {
self.playOnSubmit = true;
togglePaused();
} else if (self.playOnLoad) {
// if clicked during resolution switch,
// don't play on load
self.playOnLoad = false;
self.playOnSubmit = true;
if (self.options.enablePosition) {
if (self.options.type == 'play') {
if (!self.options.paused) {
self.playOnSubmit = true;
togglePaused();
} else if (self.playOnLoad) {
// if clicked during resolution switch,
// don't play on load
self.playOnLoad = false;
self.playOnSubmit = true;
}
}
self.$position.hide();
self.$positionInput
.options({
value: formatPosition()
})
.show()
.focusInput(false);
}
self.$position.hide();
self.$positionInput
.options({
value: formatPosition()
})
.show()
.focusInput(false);
}
})
.appendTo(self['$controls' + titleCase]);
@ -1320,6 +1340,7 @@ Ox.VideoPlayer = function(options, self) {
function getTimeline() {
var $timeline = Ox.SmallVideoTimeline({
_offset: getTimelineLeft(),
disabled: !self.options.enableTimeline,
duration: self.options.duration,
find: self.options.find,
'in': self.options['in'],
@ -1574,14 +1595,12 @@ Ox.VideoPlayer = function(options, self) {
setPosition(self.options.position);
self.$video.muted(self.options.muted).volume(self.options.volume);
// if not paused, but playInToOut, we haven't set autoplay before,
// since autoplay seems to always play from the beginning
if (!self.options.paused && self.options.playInToOut) {
if (!self.options.paused) {
self.options.paused = true;
togglePaused('button');
} else if (self.options.paused && self.playOnLoad) {
togglePaused('button');
}
self.options.paused && self.playOnLoad && togglePaused('button');
self.$playButton && self.$playButton.options({
disabled: false
});