Skip to content

Commit

Permalink
parse x-timestamp-map
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Neil committed Feb 9, 2017
1 parent 364c6b9 commit b41a9a4
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 20 deletions.
53 changes: 44 additions & 9 deletions dist/vtt.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* vtt.js - v0.12.1 (https://github.com/mozilla/vtt.js) built on 21-03-2015 */
/* vtt.js - v0.12.1 (https://github.com/mozilla/vtt.js) built on 09-02-2017 */

/**
* Copyright 2013 vtt.js Contributors
Expand Down Expand Up @@ -1760,16 +1760,51 @@
}
}

// 3.2 WebVTT metadata header syntax
function parseHeader(input) {
parseOptions(input, function (k, v) {
switch (k) {
case "Region":
// 3.3 WebVTT region metadata header syntax
parseRegion(v);
// draft-pantos-http-live-streaming-20
// https://tools.ietf.org/html/draft-pantos-http-live-streaming-20#section-3.5
// 3.5 WebVTT
function parseTimestampMap(input) {
var settings = new Settings();

parseOptions(input, function(k, v) {
switch(k) {
case "MPEGT":
settings.integer(k + 'S', v);
break;
case "LOCA":
settings.set(k + 'L', parseTimeStamp(v));
break;
}
}, /:/);
}, /[^\d]:/, /,/);

self.ontimestampmap && self.ontimestampmap({
"MPEGTS": settings.get("MPEGTS"),
"LOCAL": settings.get("LOCAL")
});
}

// 3.2 WebVTT metadata header syntax
function parseHeader(input) {
if (input.match(/X-TIMESTAMP-MAP/)) {
// This line contains HLS X-TIMESTAMP-MAP metadata
parseOptions(input, function(k, v) {
switch(k) {
case "X-TIMESTAMP-MAP":
parseTimestampMap(v);
break;
}
}, /=/);
} else {
parseOptions(input, function (k, v) {
switch (k) {
case "Region":
// 3.3 WebVTT region metadata header syntax
parseRegion(v);
break;
}
}, /:/);
}

}

// 5.1 WebVTT file parsing.
Expand Down
Loading

0 comments on commit b41a9a4

Please sign in to comment.