Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EXT-X-DISCONTINUITY-SEQUENCE and EXT-X-PROGRAM-DATE-TIME properties #32

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 20 additions & 13 deletions m3u.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ M3U.prototype.toString = function toString() {
var tagKey = propertyMap.findByKey(key);
var tag = tagKey ? tagKey.tag : key;

if (dataTypes[key] == 'boolean') {
if (dataTypes[key] === 'boolean') {
output.push('#' + tag);
} else {
output.push('#' + tag + ':' + self.get(key));
Expand Down Expand Up @@ -161,25 +161,32 @@ var coerce = {
},
unknown: function coerceUnknown(value) {
return value;
},
datetime: function coerceDatetime(value) {
return new Date(value);
}
};

var dataTypes = {
iframesOnly : 'boolean',
independentSegments : 'boolean',
targetDuration : 'integer',
mediaSequence : 'integer',
version : 'integer'
iframesOnly : 'boolean',
independentSegments : 'boolean',
targetDuration : 'integer',
mediaSequence : 'integer',
version : 'integer',
discontinuitySequence : 'integer',
programDateTime : 'datetime'
};

var propertyMap = [
{ tag: 'EXT-X-ALLOW-CACHE', key: 'allowCache' },
{ tag: 'EXT-X-I-FRAMES-ONLY', key: 'iframesOnly' },
{ tag: 'EXT-X-INDEPENDENT-SEGMENTS', key: 'independentSegments' },
{ tag: 'EXT-X-MEDIA-SEQUENCE', key: 'mediaSequence' },
{ tag: 'EXT-X-PLAYLIST-TYPE', key: 'playlistType' },
{ tag: 'EXT-X-TARGETDURATION', key: 'targetDuration' },
{ tag: 'EXT-X-VERSION', key: 'version' }
{ tag: 'EXT-X-ALLOW-CACHE', key: 'allowCache' },
{ tag: 'EXT-X-I-FRAMES-ONLY', key: 'iframesOnly' },
{ tag: 'EXT-X-INDEPENDENT-SEGMENTS', key: 'independentSegments' },
{ tag: 'EXT-X-MEDIA-SEQUENCE', key: 'mediaSequence' },
{ tag: 'EXT-X-PLAYLIST-TYPE', key: 'playlistType' },
{ tag: 'EXT-X-TARGETDURATION', key: 'targetDuration' },
{ tag: 'EXT-X-VERSION', key: 'version' },
{ tag: 'EXT-X-DISCONTINUITY-SEQUENCE', key: 'discontinuitySequence' },
{ tag: 'EXT-X-PROGRAM-DATE-TIME', key: 'programDateTime' }
];

propertyMap.findByTag = function findByTag(tag) {
Expand Down