Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
brainfood
/
videojs-contrib-hls
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
e51141bc
authored
2014-01-08 19:24:05 -0800
by
Tom Johnson
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
UI refinement for intra segment seek
1 parent
e22b9e82
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
8 deletions
src/videojs-hls.js
src/videojs-hls.js
View file @
e51141b
...
...
@@ -110,6 +110,8 @@ var
};
player
.
currentTime
=
function
(
value
)
{
var
returnValue
;
if
(
value
)
{
try
{
player
.
el
().
getElementsByClassName
(
'vjs-tech'
)[
0
].
vjs_setProperty
(
'currentTime'
,
value
);
...
...
@@ -120,10 +122,16 @@ var
}
player
.
hls
.
sourceBuffer
.
appendBuffer
(
segmentParser
.
getFlvHeader
());
player
.
hls
.
mediaIndex
=
player
.
hls
.
selectSegmentIndexByTime
(
value
);
fillBuffer
(
parseInt
(
value
-
player
.
hls
.
getSegmentByTime
(
value
).
timeRange
.
start
,
10
)
);
fillBuffer
(
value
-
player
.
hls
.
getSegmentByTime
(
value
).
timeRange
.
start
);
}
else
{
try
{
return
player
.
el
().
getElementsByClassName
(
'vjs-tech'
)[
0
].
vjs_getProperty
(
'currentTime'
);
returnValue
=
player
.
el
().
getElementsByClassName
(
'vjs-tech'
)[
0
].
vjs_getProperty
(
'currentTime'
);
if
(
returnValue
>
player
.
duration
())
{
returnValue
=
player
.
duration
();
}
else
if
(
returnValue
<
0
)
{
returnValue
=
0
;
}
return
returnValue
;
}
catch
(
err
)
{
return
0
;
}
...
...
@@ -345,15 +353,12 @@ var
if
(
gotoSecond
!==
null
&&
gotoSecond
>
0
)
{
/*
console.log(segmentParser.getTags().length, 'total');
console.log(gotoSecond, 'you want second');
console.log(player.hls.selectPlaylist().segments[player.hls.mediaIndex].duration);
console.log((segmentParser.getTags().length/player.hls.selectPlaylist().segments[player.hls.mediaIndex].duration)*gotoSecond);
*/
var
seekToTagIndex
=
parseInt
((
segmentParser
.
getTags
().
length
/
player
.
hls
.
selectPlaylist
().
segments
[
player
.
hls
.
mediaIndex
].
duration
)
*
gotoSecond
,
10
);
var
seekToTagCounter
=
0
;
//console.log('Go to:', gotoSecond);
//console.log('tag index:', seekToTagIndex);
//drain until where you want in the buffer
while
(
seekToTagCounter
<
seekToTagIndex
)
{
...
...
Please
register
or
sign in
to post a comment