title: hls fails to play m3u8 playlist with videojs
body: <p>I created an hls stream from yuv frames with ffmpeg which appears to work just fine. It creates a playlist and updates that, and all .ts files as expected. However even videojs refuses to play it, and I really run out of ideas, probably missing the obvious?</p>
  <p>First, the m3u8 list which is continuously updated:</p>
  <pre><code>#EXTM3U
  #EXT-X-VERSION:3
  #EXT-X-TARGETDURATION:2
  #EXT-X-MEDIA-SEQUENCE:190
  #EXTINF:2.000000,
  test190.ts
  #EXTINF:2.000000,
  test191.ts
  #EXTINF:2.000000,
  test192.ts
  #EXTINF:2.000000,
  test193.ts
  #EXTINF:2.000000,
  test194.ts
  </code></pre>
  <p>Those .ts files exist and have sizes of approx 250 kBytes.
  Then, I open this standard videojs html file (residing in the same directory):</p>
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta charset=utf-8 /&gt;
  &lt;title&gt;videojs-contrib-hls embed&lt;/title&gt;
  
    &lt;link href=&quot;video-js.css&quot; rel=&quot;stylesheet&quot;&gt;
  &lt;/head&gt;
  &lt;body&gt;
    &lt;h1&gt;VSTream&lt;/h1&gt;
  
    &lt;video-js id=&quot;my_video_1&quot; class=&quot;vjs-default-skin&quot; controls preload=&quot;auto&quot; width=&quot;640&quot; height=&quot;268&quot;&gt;
      &lt;source src=&quot;test.m3u8&quot; type=&quot;application/x-mpegURL&quot;&gt;
    &lt;/video-js&gt;
    
    &lt;script src=&quot;video.min.js&quot;&gt;&lt;/script&gt;
    &lt;script src=&quot;videojs-http-streaming.min.js&quot;&gt;&lt;/script&gt;
    
    &lt;script&gt;
      var player = videojs('my_video_1');
    &lt;/script&gt;
    
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  <p>I open this in Firefox (or Chrome, or Edge, none works) and use its debugger which in the console shows:</p>
  <blockquote>
  <p>VIDEOJS: WARN: A plugin named &quot;reloadSourceOnError&quot; already exists.
  You may want to avoid re-registering plugins! video.min.js:12:977
  Specified “type” attribute of “application/x-mpegURL” is not
  supported. Load of media resource test.m3u8 failed. vstream.html All
  candidate resources failed to load. Media load paused. vstream.html
  XML Parsing Error: syntax error Location: file:///C:/test/test.m3u8
  Line Number 1, Column 1: 2 test.m3u8:1:1 MouseEvent.mozPressure is
  deprecated. Use PointerEvent.pressure instead. video.min.js:12:9031
  VIDEOJS: ERROR: (CODE:3 MEDIA_ERR_DECODE) Playback cannot continue. No
  available working or supported playlists.  Object { code: 3, message:
  &quot;Playback cannot continue. No available working or supported
  playlists.&quot; } video.min.js:12:977</p>
  </blockquote>
  <p>This doesn't make much sense to me. Why would it throw an XML parsing error for an m3u8 file? Of course, the MEDIA_ERR_DECODE points in some direction, but the same problem persists with fMP4 files.</p>
  <p>The relevant ffmpeg c++ code (format is &quot;hls&quot; and formatContext works well in other scenarios, gop is 2):</p>
  <pre><code>    AVDictionary* options = 0;
      if (fragmented)
      {
          // type
          if (codecID == AV_CODEC_ID_H264)
              av_dict_set (&amp;options, &quot;hls_segment_type&quot;, &quot;fmp4&quot;, 0);
          else
              av_dict_set (&amp;options, &quot;hls_segment_type&quot;, &quot;mpegts&quot;, 0);
  
          av_dict_set (&amp;options, &quot;hls_time&quot;, &quot;2.0&quot;, 0);
          av_dict_set_int (&amp;options, &quot;hls_list_size&quot;, 5, 0);
          av_dict_set (&amp;options, &quot;hls_flags&quot;, &quot;delete_segments&quot;, 0);
      }
  
      int ret = avformat_write_header (formatContext, &amp;options);
  </code></pre>
  <p>...which returns success. Then writing frames</p>
  <pre><code>    int ret = avcodec_send_frame (videoStream-&gt;codecContext, frame);
      av_init_packet (avPacket);
      AVRational timeBase = videoStream-&gt;getTimeBase ();
      avPacket-&gt;stream_index = streams.indexOf (videoStream);
      ret = avcodec_receive_packet (videoStream-&gt;codecContext, avPacket);
      avPacket-&gt;duration = av_rescale_q (1, videoStream-&gt;codecContext-&gt;time_base, videoStream-&gt;getTimeBase ());
      pts += avPacket-&gt;duration;
      avPacket-&gt;pts = pts;
      avPacket-&gt;dts = pts;    //  AV_NOPTS_VALUE;
      ret = av_interleaved_write_frame (formatContext, avPacket);
  </code></pre>
  <p>(videoStream here is an internal object representing the avstream).
  I've omitted error checks for clarity. All return values show success.
  Thanks for any help on this!</p>