')
+ .addClass('positionmarker')
.css({
float: 'left',
width: '14px',
height: '14px',
- marginLeft: self.markerOffset + 'px',
border: '1px solid rgba(0, 0, 0, 0.5)',
borderRadius: '8px'
})
@@ -445,14 +475,12 @@ Ox.VideoPlayer = function(options, self) {
})
)
)
- .appendTo(self.$outerTrack.$element);
+ .appendTo(self.$timeline.$element);
- self.$trackInterface = Ox.Element()
+ self.$timelineInterface = Ox.Element()
.css({
float: 'left',
- width: self.outerTrackWidth + 'px',
height: self.barHeight + 'px',
- marginLeft: - self.outerTrackWidth + 'px'
})
.appendTo(self.$controls);
@@ -461,42 +489,51 @@ Ox.VideoPlayer = function(options, self) {
});
} else if (control == 'space') {
-
+
+ self.$space = $('
')
+ .css({float: 'left'})
+ .html(' ') // fixme: ??
+ .appendTo(self.$controls.$element);
+
} else if (control == 'position') {
+ self.positionWidth = 48 +
+ !!self.options.showMilliseconds * 2
+ + self.options.showMilliseconds * 6;
+
self.$position = $('
')
.addClass('foo')
.css({
float: 'left',
- width: '44px',
+ width: (self.positionWidth - 4) + 'px',
height: '12px',
padding: '2px',
fontSize: '9px',
- textAlign: 'center'
+ textAlign: 'center',
+ color: 'rgb(255, 255, 255)'
})
- .html(Ox.formatDuration(self.options.position))
+ .html(formatPosition)
.bind({
click: function() {
if (!self.options.paused) {
self.wasPlaying = true;
togglePaused();
- //togglePlayIcon();
- self.$playButton.toggleTitle();
+ self.$playButton && self.$playButton.toggleTitle();
}
self.$position.hide();
self.$positionInput
.options({
- value: Ox.formatDuration(self.options.position)
+ value: formatPosition()
})
.show()
.focusInput(false);
}
})
- .appendTo(self.$controls);
+ .appendTo(self.$controls.$element);
self.$positionInput = Ox.Input({
- value: Ox.formatDuration(self.options.position),
- width: 48
+ value: formatPosition(),
+ width: self.positionWidth
})
.css({
float: 'left',
@@ -504,16 +541,22 @@ Ox.VideoPlayer = function(options, self) {
MozBoxShadow: '0 0 0',
WebkitBoxShadow: '0 0 0'
})
+ .bind({
+ blur: function() {
+ self.inputHasFocus = false;
+ },
+ focus: function() {
+ self.inputHasFocus = true;
+ }
+ })
.bindEvent({
- blur: submitPositionInput,
- change: submitPositionInput,
- //submit: submitPositionInput
+ blur: submitPositionInput
})
.hide()
- .appendTo(self.$controls);
+ .appendTo(self.$controls.$element);
self.$positionInput.children('input').css({
- width: '42px',
+ width: (self.positionWidth - 6) + 'px',
height: '16px',
padding: '0 3px 0 3px',
border: '0px',
@@ -534,8 +577,103 @@ Ox.VideoPlayer = function(options, self) {
}
+ setSizes();
+
function ended() {
-
+ if (!self.options.paused) {
+ togglePaused();
+ self.$playButton && self.$playButton.toggleTitle();
+ }
+ if (self.options.poster) {
+ self.$poster.animate({
+ opacity: 1
+ }, 250);
+ self.posterIsVisible = true;
+ }
+ if (self.options.showIconOnLoad) {
+ self.$playIcon.animate({
+ opacity: 1
+ }, 250);
+ self.iconIsVisible = true;
+ }
+ }
+
+ function formatPosition(position) {
+ position = Ox.isUndefined(position) ? self.options.position : position;
+ return Ox.formatDuration(position, self.options.showMilliseconds);
+ }
+
+ function getPosition(e) {
+ // fixme: no offsetX in firefox???
+ if ($.browser.mozilla) {
+ //Ox.print(e, e.layerX - 56)
+ return Ox.limit(
+ (e.layerX - 48 - self.barHeight / 2) / self.timelineImageWidth * self.video.duration,
+ 0, self.video.duration
+ );
+ } else {
+ /*Ox.print(e.offsetX, Ox.limit(
+ (e.offsetX - self.barHeight / 2) / self.timelineImageWidth * self.video.duration,
+ 0, self.video.duration
+ ))*/
+ return Ox.limit(
+ (e.offsetX - self.barHeight / 2) / self.timelineImageWidth * self.video.duration,
+ 0, self.video.duration
+ );
+ }
+ }
+
+ function getPositionMarkerCSS() {
+ var position = self.options.duration ?
+ (self.options.position - self['in']) / self.options.duration : 0;
+ return {
+ marginLeft: position * self.timelineImageWidth -
+ self.timelineImageWidth - 8 + 'px',
+ };
+ }
+
+ function getProgressImageURL() {
+ Ox.print('---', self.timelineImageWidth)
+ if (!self.timelineImageWidth) return;
+ var width = self.timelineImageWidth,
+ height = self.barHeight,
+ canvas = $('