Hls.js: Issue with VOD m3u8 build on the fly

Created on 6 Sep 2016  路  12Comments  路  Source: video-dev/hls.js

Hi, when a VOD (#EXT-X-PLAYLIST-TYPE:VOD) m3u8 is build on the fly the tag #EXT-X-ENDLIST appear only in the last playlist, because of this in the file src/loader/playlist-loader.js line:235 the level.live is not marked as false as can be seen below

 202  level = {type: null, version: null, url: baseurl, fragments: [], live: true, startSN: 0},

234    case 'ENDLIST':
235           level.live = false;
236   break;

The problem occur when in the file src/controller/stream-controller.js line:848 the stream-controller use the variable level.live for calculate the startPosition, assuming that this stream is a live and the video start playing at the end of the initial playlist.

848 if (newDetails.live) {
849             this.startPosition = this.computeLivePosition(sliding, newDetails);
850             logger.log(`configure startPosition to ${this.startPosition}`);
851           } else {
852             this.startPosition = 0;
853 }

For correct this i suggest change the line 848 for the code bellow:

848 if (newDetails.type === 'LIVE') {

Bug Help wanted

Most helpful comment

The correct syntax is #EXT-X-START:TIME-OFFSET=0.

All 12 comments

if there is no ENDLIST attribute, hls.js will indeed mark the playlist as being 'live', meaning that this playlist will be refreshed. it also has some consequence on the start position, but this could be tweaked using EXT-X-START attribute. in your case you might want to set
#EXT-X-START:0
please beware that EXT-X-PLAYLIST-TYPE is an optional attribute so we can't rely on it.

Guys do you know how I can get out of this distribution list ?

[email protected]:[email protected]
+1 (650) 346-9525

Le 7 sept. 2016 脿 05:29, Guillaume du Pontavice <[email protected]notifications@github.com> a 茅crit :

if there is no ENDLIST attribute, hls.js will indeed mark the playlist as being 'live', meaning that this playlist will be refreshed. it also has some consequence on the start position, but this could be tweaked using EXT-X-START attributehttps://tools.ietf.org/html/draft-pantos-http-live-streaming-19#section-4.3.5.2. in your case you might want to set

EXT-X-START:0

please beware that EXT-X-PLAYLIST-TYPE is an optional attributehttps://tools.ietf.org/html/draft-pantos-http-live-streaming-19#section-4.3.3.5 so we can't rely on it.

You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHubhttps://github.com/dailymotion/hls.js/issues/668#issuecomment-245225944, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AK-kbqdFuPhh8S2HOfHtv4nKdL761sFzks5qnoPMgaJpZM4J1s4m.

@reallyangrydude
image

In actuality, if the #EXT-X-PLAYLIST-TYPE attribute _does_ exist, but there is no #EXT-X-ENDLIST, shouldn't hls.js read this as an invalid manifest since it violates the specification (which states that if the type is VOD, it _must_ include the ENDLIST)?

unless it's value is "EVENT" because the stream might still be live.

Using #EXT-X-START:0 dont change the player behavior for me.

Anyway even with EXT-X-PLAYLIST-TYPE as a optional attribute the code would change the start position only when:

  1. Have no ENDLIST and the PLAYLIST-TYPE is ommited
  2. The PLAYLIST-TYPE is EVENT

But when the playlist explicity the PLAYLIST-TYPE as a VOD the hls.js should send the first segment.

So, i think the code should be changed to something like this:

848 if (newDetails.type !== 'VOD' && newDetails.live) {
849       this.startPosition = this.computeLivePosition(sliding, newDetails);
850       logger.log(`configure startPosition to ${this.startPosition}`);
851 } else {
852       this.startPosition = 0;
853 }

The correct syntax is #EXT-X-START:TIME-OFFSET=0.

Thanks kanongil here work in this way: #EXT-X-START:TIME-OFFSET=0.1 this occurs beacuse the hls.js code down't allow TIME-OFFSET=0 as you can see in the snip bellow.

########### (/src/loader/playlist-loader.js line:311)
case 'START':
   var startParams = result[1];
   var startAttrs = new _attrList2.default(startParams);
   var startTimeOffset = startAttrs.decimalFloatingPoint('TIME-OFFSET');
   if (startTimeOffset) {
       level.startTimeOffset = startTimeOffset;
   }
   break;

You're right, that is a clear bug. It should probably just always assign the value.

It should check if value is !== undefined

A unit test is missing as well

Was this page helpful?
0 / 5 - 0 ratings

Related issues

phillydogg28 picture phillydogg28  路  4Comments

GeorgySerga picture GeorgySerga  路  3Comments

fredvb picture fredvb  路  3Comments

harbinha picture harbinha  路  3Comments

krsvital picture krsvital  路  3Comments