Skip to content

[PATCH] Support for multilines subtitles #1

Open
@Schnouki

Description

@Schnouki

Hi,

First of all thank you very much for this, it's really nice to have something so easy to use and that works so well to integrate subtitles in HTML5 videos.

In .srt subtitles I'm working on, I often have subtitles that are split on several lines:

1
00:00:08,200 --> 00:00:11,200
First line
second line

When using your lib, only the first line of those is displayed.

Here is a quick and ugly patch to fix this:

@@ -72,6 +72,8 @@
               subtitle = '';
               if (el.currentTime.toFixed(1) > timecode_min(el.subtitles[el.subcount][1]) && el.currentTime.toFixed(1) < timecode_max(el.subtitles[el.subcount][1])) {
                 subtitle = el.subtitles[el.subcount][2];
+                for (i=3; i < el.subtitles[el.subcount].length; i++)
+                  subtitle += '<br/>' + el.subtitles[el.subcount][i];
               }
               if (el.currentTime.toFixed(1) > timecode_max(el.subtitles[el.subcount][1]) && el.subcount < (el.subtitles.length - 1)) {
                 el.subcount++;

I'm sure you can do something less hackish to fix it, but I just wanted to tell you about this (small) issue :)

Regards,
Thomas

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions