UI refinement for intra segment seek
Showing
1 changed file
with
13 additions
and
8 deletions
... | @@ -110,6 +110,8 @@ var | ... | @@ -110,6 +110,8 @@ var |
110 | }; | 110 | }; |
111 | 111 | ||
112 | player.currentTime = function(value) { | 112 | player.currentTime = function(value) { |
113 | var returnValue; | ||
114 | |||
113 | if(value) { | 115 | if(value) { |
114 | try { | 116 | try { |
115 | player.el().getElementsByClassName('vjs-tech')[0].vjs_setProperty('currentTime', value); | 117 | player.el().getElementsByClassName('vjs-tech')[0].vjs_setProperty('currentTime', value); |
... | @@ -120,10 +122,16 @@ var | ... | @@ -120,10 +122,16 @@ var |
120 | } | 122 | } |
121 | player.hls.sourceBuffer.appendBuffer(segmentParser.getFlvHeader()); | 123 | player.hls.sourceBuffer.appendBuffer(segmentParser.getFlvHeader()); |
122 | player.hls.mediaIndex = player.hls.selectSegmentIndexByTime(value); | 124 | player.hls.mediaIndex = player.hls.selectSegmentIndexByTime(value); |
123 | fillBuffer(parseInt(value-player.hls.getSegmentByTime(value).timeRange.start,10)); | 125 | fillBuffer(value-player.hls.getSegmentByTime(value).timeRange.start); |
124 | } else { | 126 | } else { |
125 | try { | 127 | try { |
126 | return player.el().getElementsByClassName('vjs-tech')[0].vjs_getProperty('currentTime'); | 128 | returnValue = player.el().getElementsByClassName('vjs-tech')[0].vjs_getProperty('currentTime'); |
129 | if(returnValue > player.duration()) { | ||
130 | returnValue = player.duration(); | ||
131 | } else if (returnValue < 0) { | ||
132 | returnValue = 0; | ||
133 | } | ||
134 | return returnValue; | ||
127 | } catch(err) { | 135 | } catch(err) { |
128 | return 0; | 136 | return 0; |
129 | } | 137 | } |
... | @@ -345,15 +353,12 @@ var | ... | @@ -345,15 +353,12 @@ var |
345 | 353 | ||
346 | if(gotoSecond!==null && gotoSecond>0) | 354 | if(gotoSecond!==null && gotoSecond>0) |
347 | { | 355 | { |
348 | /* | ||
349 | console.log(segmentParser.getTags().length, 'total'); | ||
350 | console.log(gotoSecond, 'you want second'); | ||
351 | console.log(player.hls.selectPlaylist().segments[player.hls.mediaIndex].duration); | ||
352 | console.log((segmentParser.getTags().length/player.hls.selectPlaylist().segments[player.hls.mediaIndex].duration)*gotoSecond); | ||
353 | */ | ||
354 | var seekToTagIndex = parseInt((segmentParser.getTags().length/player.hls.selectPlaylist().segments[player.hls.mediaIndex].duration)*gotoSecond,10); | 356 | var seekToTagIndex = parseInt((segmentParser.getTags().length/player.hls.selectPlaylist().segments[player.hls.mediaIndex].duration)*gotoSecond,10); |
355 | var seekToTagCounter = 0; | 357 | var seekToTagCounter = 0; |
356 | 358 | ||
359 | //console.log('Go to:', gotoSecond); | ||
360 | //console.log('tag index:', seekToTagIndex); | ||
361 | |||
357 | //drain until where you want in the buffer | 362 | //drain until where you want in the buffer |
358 | while(seekToTagCounter<seekToTagIndex) | 363 | while(seekToTagCounter<seekToTagIndex) |
359 | { | 364 | { | ... | ... |
-
Please register or sign in to post a comment