diff --git a/m3u/PlaylistItem.js b/m3u/PlaylistItem.js index d58d8f8..4b7c3bf 100644 --- a/m3u/PlaylistItem.js +++ b/m3u/PlaylistItem.js @@ -14,7 +14,13 @@ PlaylistItem.create = function createPlaylistItem(data) { }; PlaylistItem.prototype.toString = function toString() { - var output = []; + var attributes = this.attributes; + var output = Object.keys(attributes.serialize()).map(function(key) { + var tag = key.toUpperCase(); + var value = attributes.getCoerced(key); + return value.length ? [tag, value].join(':') : tag; + }); + if (this.get('discontinuity')) { output.push('#EXT-X-DISCONTINUITY'); }