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
4547e309
authored
2014-01-07 22:12:52 -0800
by
Tom Johnson
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
update for seeking to segment border. requires videojs-swf/feature/hls-seeking based swf
1 parent
2bb5356c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
0 deletions
src/m3u8/m3u8-parser.js
src/videojs-hls.js
src/m3u8/m3u8-parser.js
View file @
4547e30
...
...
@@ -351,7 +351,13 @@
if
(
entry
.
duration
>=
0
)
{
currentUri
.
duration
=
entry
.
duration
;
}
currentUri
.
timeRange
=
{};
currentUri
.
timeRange
.
start
=
(
uris
.
length
>
0
)
?
uris
[
uris
.
length
-
1
].
timeRange
.
end
:
0
;
currentUri
.
timeRange
.
end
=
currentUri
.
timeRange
.
start
+
currentUri
.
duration
;
this
.
manifest
.
segments
=
uris
;
},
'media-sequence'
:
function
()
{
if
(
!
isFinite
(
entry
.
number
))
{
...
...
src/videojs-hls.js
View file @
4547e30
...
...
@@ -109,6 +109,34 @@ var
return
1
;
// HAVE_METADATA
};
player
.
currentTime
=
function
(
value
)
{
if
(
value
)
{
player
.
el
().
getElementsByClassName
(
'vjs-tech'
)[
0
].
vjs_setProperty
(
'currentTime'
,
0
);
player
.
hls
.
mediaIndex
=
player
.
hls
.
selectSegmentByTime
(
value
);
fillBuffer
();
}
else
{
return
player
.
el
().
getElementsByClassName
(
'vjs-tech'
)[
0
].
vjs_getProperty
(
'currentTime'
);
}
}
player
.
hls
.
selectSegmentByTime
=
function
(
time
)
{
if
(
player
.
hls
.
media
&&
player
.
hls
.
media
.
segments
)
{
var
index
,
currentSegment
;
for
(
index
=
0
;
index
<
player
.
hls
.
media
.
segments
.
length
;
index
++
)
{
currentSegment
=
player
.
hls
.
media
.
segments
[
index
];
if
(
time
>
currentSegment
.
timeRange
.
start
&&
time
<=
currentSegment
.
timeRange
.
end
)
{
return
index
;
}
}
}
}
/**
* Chooses the appropriate media playlist based on the current
* bandwidth estimate and the player size.
...
...
@@ -210,6 +238,8 @@ var
if
(
parser
.
manifest
.
totalDuration
)
{
// update the duration
player
.
duration
(
parser
.
manifest
.
totalDuration
);
// Notify the flash layer
player
.
el
().
getElementsByClassName
(
'vjs-tech'
)[
0
].
vjs_setProperty
(
'duration'
,
parser
.
manifest
.
totalDuration
);
}
player
.
trigger
(
'loadedmanifest'
);
player
.
trigger
(
'loadedmetadata'
);
...
...
Please
register
or
sign in
to post a comment