e22b9e82 by Tom Johnson

code cleanup for intra seek, needs newest SWF

1 parent b910b291
...@@ -112,7 +112,7 @@ var ...@@ -112,7 +112,7 @@ var
112 player.currentTime = function(value) { 112 player.currentTime = function(value) {
113 if(value) { 113 if(value) {
114 try { 114 try {
115 player.el().getElementsByClassName('vjs-tech')[0].vjs_setProperty('currentTime', 0); 115 player.el().getElementsByClassName('vjs-tech')[0].vjs_setProperty('currentTime', value);
116 player.el().getElementsByClassName('vjs-tech')[0].vjs_setProperty('appendBytesAction', 'resetSeek'); 116 player.el().getElementsByClassName('vjs-tech')[0].vjs_setProperty('appendBytesAction', 'resetSeek');
117 player.el().getElementsByClassName('vjs-tech')[0].vjs_setProperty('appendBytesAction', 'resetBegin'); 117 player.el().getElementsByClassName('vjs-tech')[0].vjs_setProperty('appendBytesAction', 'resetBegin');
118 } catch(err) { 118 } catch(err) {
...@@ -120,7 +120,6 @@ var ...@@ -120,7 +120,6 @@ var
120 } 120 }
121 player.hls.sourceBuffer.appendBuffer(segmentParser.getFlvHeader()); 121 player.hls.sourceBuffer.appendBuffer(segmentParser.getFlvHeader());
122 player.hls.mediaIndex = player.hls.selectSegmentIndexByTime(value); 122 player.hls.mediaIndex = player.hls.selectSegmentIndexByTime(value);
123 console.log(value, parseInt(value-player.hls.getSegmentByTime(value).timeRange.start,10));
124 fillBuffer(parseInt(value-player.hls.getSegmentByTime(value).timeRange.start,10)); 123 fillBuffer(parseInt(value-player.hls.getSegmentByTime(value).timeRange.start,10));
125 } else { 124 } else {
126 try { 125 try {
...@@ -352,14 +351,14 @@ var ...@@ -352,14 +351,14 @@ var
352 console.log(player.hls.selectPlaylist().segments[player.hls.mediaIndex].duration); 351 console.log(player.hls.selectPlaylist().segments[player.hls.mediaIndex].duration);
353 console.log((segmentParser.getTags().length/player.hls.selectPlaylist().segments[player.hls.mediaIndex].duration)*gotoSecond); 352 console.log((segmentParser.getTags().length/player.hls.selectPlaylist().segments[player.hls.mediaIndex].duration)*gotoSecond);
354 */ 353 */
355 var segmentCount = 100; //(segmentParser.getTags().length/player.hls.selectPlaylist().segments[player.hls.mediaIndex].duration)*gotoSecond; 354 var seekToTagIndex = parseInt((segmentParser.getTags().length/player.hls.selectPlaylist().segments[player.hls.mediaIndex].duration)*gotoSecond,10);
356 var xx = 0; 355 var seekToTagCounter = 0;
357 356
358 //drain until where you want in the buffer 357 //drain until where you want in the buffer
359 while(xx<segmentCount) 358 while(seekToTagCounter<seekToTagIndex)
360 { 359 {
361 segmentParser.getNextTag(); 360 segmentParser.getNextTag();
362 xx++; 361 seekToTagCounter++;
363 } 362 }
364 } 363 }
365 364
...@@ -367,6 +366,18 @@ var ...@@ -367,6 +366,18 @@ var
367 player.hls.sourceBuffer.appendBuffer(segmentParser.getNextTag().bytes, player); 366 player.hls.sourceBuffer.appendBuffer(segmentParser.getNextTag().bytes, player);
368 } 367 }
369 368
369 /*
370 if(player.hls.mediaIndex === player.hsl.selectPlaylist.segments.length-1)
371 {
372 try {
373 // TODO - Still need to test this. This tells the Flash Player the stream is over
374 // player.el().getElementsByClassName('vjs-tech')[0].vjs_setProperty('appendBytesAction', 'endSequence');
375 } catch(err) {
376
377 }
378 }
379 */
380
370 segmentXhr = null; 381 segmentXhr = null;
371 player.hls.mediaIndex++; 382 player.hls.mediaIndex++;
372 383
......