forked from BYU-ARCLITE/subtitle-timeline-editor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.html
76 lines (67 loc) · 2.36 KB
/
README.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<html>
<body>
<h1>Setup</h1>
<ol>
<li><p>Create a target element on the page</p>
<pre>
<div id="timeline"></div>
...
var target = document.getElementById("timeline");</pre>
</li>
<li><p>Create a timeline</p>
<pre>
var timeline = new Timeline(target, {});
</pre>
<p>The arguments are
<ul>
<li>A DOM node into which to insert the timeline.</li>
<li>A map of optional parameters, including:
<ul>
<li>width: the width of the timeline display in pixels (defaults to the offsetWidth of the target).</li>
<li>length: the length of the timeline in seconds.</li>
<li>start: the initial starting time of the viewing window.</li>
<li>end: the initial ending time of the viewing window.</li>
</ul>
</li>
</ul></p>
</li>
<li><p>Create the cues and add them to the timeline</p>
<pre>
var cues = TimedText.WebVTT.parse(vttdata);
timeline.addTextTrack(cues, "track-id", "en");
</pre>
<p>The arguments are
<ul>
<li>An array of Cue objects or a TextTrack object</li>
<li>A track name</li>
<li>Language</li>
</ul></p>
</li>
<li><p>Add event handlers</p>
<pre>
// addtrack is fired whenever a text track is added to the timeline and passes the added track object to the listener
timeline.on('addtrack',function(track) {});
// removetrack is fired whenever a text track is removed from the timeline and passes the removed track object to the listener
timeline.on('removetrack',function(track) {});
// select is fired whenever a segment is selected and passes the segment object (which includes the backing cue object) to the listener
timeline.on('select',function(seg) {
var cue = seg.cue;
....
});
// unselect is fired when the selection is terminated
timeline.on('unselect',function(seg) {});
// jump is fired whenever the timeline alters its current time internally; e.g., when a repeat point is hit or when the time marker is moved manually.
timeline.on('jump', function(time) {
controls.currentTime = time/1000;
});
// timeupdate is fired whenever the timeline's time marker is moved; e.g., when timeline.currentTime is set by external code
timeline.on('timeupdate', function(time) {});
// abRepeatEnabled is fired whenever the AB repeat functionality is turned on
timeline.on('abRepeatEnabled',function() {});
// update is fired whenever the contents of a segment change
timeline.on('update', function(seg) {});
</pre>
</li>
</ol>
</body>
</html>