1
0
Fork 0
forked from 0x2620/oxjs

fix a resizing bug in the video editor demo

This commit is contained in:
rolux 2011-05-19 09:06:42 +02:00
commit 67c154547c
4 changed files with 36 additions and 16 deletions

View file

@ -3951,7 +3951,7 @@ Ox.parseSRT <f> Parses an srt subtitle file
> Ox.parseSRT('1\n01:02:00,000 --> 01:02:03,400\nHello World')
[{'in': 3720, out: 3723.4, text: 'Hello World'}]
@*/
Ox.parseSRT = function(str) {
Ox.parseSRT = function(str, fps) {
return str.replace(/\r\n/g, '\n').replace(/\n+$/, '').split('\n\n')
.map(function(block) {
var lines = block.split('\n'), points;
@ -3963,6 +3963,11 @@ Ox.parseSRT = function(str) {
[3600, 60, 1, 0.001][i];
}, 0);
});
if (fps) {
points = points.map(function(point) {
return Math.round(point * fps) / fps;
});
}
return {
'in': points[0],
out: points[1],