920621a3 by bc-bbay

Changing the discontinuity seek to be a new test

As requested by @BCdmlap, changing the discontinuity seek to be a new
test instead of a modification to an existing test.
1 parent 18b4fb56
...@@ -1261,6 +1261,56 @@ test('clears the segment buffer on seek', function() { ...@@ -1261,6 +1261,56 @@ test('clears the segment buffer on seek', function() {
1261 standardXHRResponse(requests.pop()); 1261 standardXHRResponse(requests.pop());
1262 1262
1263 // play to 6s to trigger the next segment request 1263 // play to 6s to trigger the next segment request
1264 currentTime = 6;
1265 bufferEnd = 10;
1266 player.trigger('timeupdate');
1267
1268 standardXHRResponse(requests.pop());
1269
1270 // seek back to the beginning
1271 player.currentTime(0);
1272 tags.push({ pts: 0, bytes: 0 });
1273 standardXHRResponse(requests.pop());
1274 strictEqual(aborts, 1, 'aborted once for the seek');
1275
1276 // the source buffer empties. is 2.ts still in the segment buffer?
1277 player.trigger('waiting');
1278 strictEqual(aborts, 1, 'cleared the segment buffer on a seek');
1279 });
1280
1281 test('continues playing after seek to discontinuity', function() {
1282 var aborts = 0, tags = [], currentTime, bufferEnd, oldCurrentTime;
1283
1284 videojs.Hls.SegmentParser = mockSegmentParser(tags);
1285
1286 player.src({
1287 src: 'discontinuity.m3u8',
1288 type: 'application/vnd.apple.mpegurl'
1289 });
1290 openMediaSource(player);
1291 oldCurrentTime = player.currentTime;
1292 player.currentTime = function(time) {
1293 if (time !== undefined) {
1294 return oldCurrentTime.call(player, time);
1295 }
1296 return currentTime;
1297 };
1298 player.buffered = function() {
1299 return videojs.createTimeRange(0, bufferEnd);
1300 };
1301 player.hls.sourceBuffer.abort = function() {
1302 aborts++;
1303 };
1304
1305 requests.pop().respond(200, null,
1306 '#EXTM3U\n' +
1307 '#EXTINF:10,0\n' +
1308 '1.ts\n' +
1309 '#EXT-X-DISCONTINUITY\n' +
1310 '#EXTINF:10,0\n' +
1311 '2.ts\n');
1312 standardXHRResponse(requests.pop());
1313
1264 currentTime = 1; 1314 currentTime = 1;
1265 bufferEnd = 10; 1315 bufferEnd = 10;
1266 player.trigger('timeupdate'); 1316 player.trigger('timeupdate');
......