new-style find-as-you-type for video editor
This commit is contained in:
parent
d326adf2e9
commit
9f4f9dfa39
135 changed files with 9182 additions and 44 deletions
|
|
@ -999,9 +999,8 @@ Ox.VideoPlayer = function(options, self) {
|
|||
}
|
||||
}
|
||||
|
||||
function find(query, hasPressedEnter) {
|
||||
function find(query) {
|
||||
var results = [];
|
||||
Ox.print(query)
|
||||
if (query.length) {
|
||||
query = query.toLowerCase();
|
||||
results = Ox.map(self.options.subtitles, function(subtitle) {
|
||||
|
|
@ -1010,9 +1009,6 @@ Ox.VideoPlayer = function(options, self) {
|
|||
out: subtitle.out
|
||||
} : null;
|
||||
});
|
||||
if (results.length == 0 && hasPressedEnter) {
|
||||
self.$findInput.focusInput();
|
||||
}
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
|
@ -1198,7 +1194,7 @@ Ox.VideoPlayer = function(options, self) {
|
|||
Ox.forEach(self.options.subtitles, function(v) {
|
||||
if (
|
||||
v['in'] <= self.options.position &&
|
||||
v.out > self.options.position
|
||||
v.out >= self.options.position
|
||||
) {
|
||||
subtitle = v.text;
|
||||
return false;
|
||||
|
|
@ -1478,21 +1474,23 @@ Ox.VideoPlayer = function(options, self) {
|
|||
self.options.position >= self.options.out
|
||||
) {
|
||||
togglePaused();
|
||||
setPosition(self.options.out, 'video');
|
||||
setPosition(self.options.out/*, 'video'*/);
|
||||
//ended();
|
||||
self.playInToOut = false;
|
||||
} else {
|
||||
setPosition(self.options.position, 'video');
|
||||
}
|
||||
that.triggerEvent('position', {
|
||||
position: self.options.position
|
||||
});
|
||||
}
|
||||
|
||||
function playInToOut() {
|
||||
if (self.options.out > self.options['in']) {
|
||||
Ox.print('inToOut', self.options['in'])
|
||||
self.playInToOut = true;
|
||||
setPosition(self.options['in']);
|
||||
if (self.options.paused) {
|
||||
togglePaused();
|
||||
}
|
||||
self.options.paused && togglePaused();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1552,10 +1550,12 @@ Ox.VideoPlayer = function(options, self) {
|
|||
}
|
||||
|
||||
function setPosition(position, from) {
|
||||
position = Ox.limit(position, self['in'], self['out']);
|
||||
self.options.position = Ox.limit(position, self['in'], self['out']);
|
||||
/*
|
||||
self.options.position = Math.round(
|
||||
position * self.options.fps
|
||||
) / self.options.fps;
|
||||
*/
|
||||
self.options.paused && self.options.showMarkers && setMarkers();
|
||||
self.$subtitle && setSubtitle();
|
||||
self.$position && self.$position.html(formatPosition());
|
||||
|
|
@ -1582,9 +1582,6 @@ Ox.VideoPlayer = function(options, self) {
|
|||
//showLoadingIcon();
|
||||
loadImage();
|
||||
}
|
||||
that.triggerEvent('position', {
|
||||
position: self.options.position
|
||||
});
|
||||
}
|
||||
|
||||
function setResolution() {
|
||||
|
|
@ -1768,7 +1765,7 @@ Ox.VideoPlayer = function(options, self) {
|
|||
function submitFindInput(value, hasPressedEnter) {
|
||||
Ox.print('submitFindInput', value, hasPressedEnter)
|
||||
self.options.find = value;
|
||||
self.results = find(self.options.find, hasPressedEnter);
|
||||
self.results = find(self.options.find);
|
||||
Ox.print('results', self.results.length);
|
||||
if (self.$find) {
|
||||
self.$results.html(self.results.length);
|
||||
|
|
@ -1787,8 +1784,8 @@ Ox.VideoPlayer = function(options, self) {
|
|||
find: self.options.find,
|
||||
results: self.results
|
||||
});
|
||||
if (hasPressedEnter && self.results.length) {
|
||||
goToNextResult(1);
|
||||
if (hasPressedEnter) {
|
||||
self.results.length ? goToNextResult(1) : self.$findInput.focusInput();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1813,6 +1810,7 @@ Ox.VideoPlayer = function(options, self) {
|
|||
function submitPositionInput() {
|
||||
self.$positionInput.hide();
|
||||
self.$position.html('').show();
|
||||
Ox.print('###', parsePositionInput(self.$positionInput.options('value')))
|
||||
setPosition(parsePositionInput(self.$positionInput.options('value')));
|
||||
if (self.playOnSubmit) {
|
||||
togglePaused();
|
||||
|
|
@ -1823,6 +1821,9 @@ Ox.VideoPlayer = function(options, self) {
|
|||
that.gainFocus();
|
||||
}
|
||||
self.mouseHasLeft && hideControls();
|
||||
that.triggerEvent('position', {
|
||||
position: self.options.position
|
||||
});
|
||||
}
|
||||
|
||||
function toggleFind() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue