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

View file

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

View file

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

View file

@ -87,6 +87,9 @@ Ox.VideoPlayer = function(options, self) {
enableFind: false, enableFind: false,
enableFullscreen: false, enableFullscreen: false,
enableKeyboard: false, enableKeyboard: false,
enableMouse: false,
enablePosition: false,
enableTimeline: false,
externalControls: false, externalControls: false,
find: '', find: '',
focus: 'click', focus: 'click',
@ -297,7 +300,7 @@ Ox.VideoPlayer = function(options, self) {
preload: self.options.preload, preload: self.options.preload,
src: self.video, src: self.video,
}, !self.options.paused && !self.options.playInToOut ? { }, !self.options.paused && !self.options.playInToOut ? {
autoplay: 'autoplay' /*autoplay: 'autoplay'*/
} : {}/*, self.options.poster ? { } : {}/*, self.options.poster ? {
poster: self.options.poster poster: self.options.poster
} : {}*/) } : {}*/)
@ -501,7 +504,22 @@ Ox.VideoPlayer = function(options, self) {
self.options['controls' + titleCase].forEach(function(control) { 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({ self.$findButton = Ox.Button({
style: 'symbol', style: 'symbol',
@ -626,6 +644,7 @@ Ox.VideoPlayer = function(options, self) {
.html(formatPosition()) .html(formatPosition())
.bind({ .bind({
click: function() { click: function() {
if (self.options.enablePosition) {
if (self.options.type == 'play') { if (self.options.type == 'play') {
if (!self.options.paused) { if (!self.options.paused) {
self.playOnSubmit = true; self.playOnSubmit = true;
@ -645,6 +664,7 @@ Ox.VideoPlayer = function(options, self) {
.show() .show()
.focusInput(false); .focusInput(false);
} }
}
}) })
.appendTo(self['$controls' + titleCase]); .appendTo(self['$controls' + titleCase]);
@ -1320,6 +1340,7 @@ Ox.VideoPlayer = function(options, self) {
function getTimeline() { function getTimeline() {
var $timeline = Ox.SmallVideoTimeline({ var $timeline = Ox.SmallVideoTimeline({
_offset: getTimelineLeft(), _offset: getTimelineLeft(),
disabled: !self.options.enableTimeline,
duration: self.options.duration, duration: self.options.duration,
find: self.options.find, find: self.options.find,
'in': self.options['in'], 'in': self.options['in'],
@ -1574,14 +1595,12 @@ Ox.VideoPlayer = function(options, self) {
setPosition(self.options.position); setPosition(self.options.position);
self.$video.muted(self.options.muted).volume(self.options.volume); self.$video.muted(self.options.muted).volume(self.options.volume);
// if not paused, but playInToOut, we haven't set autoplay before, if (!self.options.paused) {
// since autoplay seems to always play from the beginning
if (!self.options.paused && self.options.playInToOut) {
self.options.paused = true; self.options.paused = true;
togglePaused('button'); togglePaused('button');
} else if (self.options.paused && self.playOnLoad) {
togglePaused('button');
} }
self.options.paused && self.playOnLoad && togglePaused('button');
self.$playButton && self.$playButton.options({ self.$playButton && self.$playButton.options({
disabled: false disabled: false
}); });