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
f7098468
authored
2014-01-03 15:14:20 -0800
by
Tom Johnson
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
update duration on UI
1 parent
f20f58f7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
1 deletions
src/m3u8/m3u8-parser.js
src/videojs-hls.js
src/m3u8/m3u8-parser.js
View file @
f709846
...
...
@@ -284,7 +284,8 @@
// the manifest is empty until the parse stream begins delivering data
this
.
manifest
=
{
allowCache
:
true
allowCache
:
true
,
totalDuration
:
0
};
// update the manifest with the m3u8 entry from the parse stream
...
...
src/videojs-hls.js
View file @
f709846
...
...
@@ -28,6 +28,7 @@ var
segmentXhr
,
fillBuffer
,
onLoadedManifest
,
selectPlaylist
;
extname
=
(
/
[^
#?
]
*
(?:\/[^
#?
]
*
\.([^
#?
]
*
))
/
).
exec
(
player
.
currentSrc
());
...
...
@@ -66,6 +67,20 @@ var
player
.
hls
.
currentMediaIndex
=
0
;
};
onLoadedManifest
=
function
()
{
if
(
player
.
hls
.
manifest
.
totalDuration
===
0
)
{
for
(
var
i
in
player
.
hls
.
manifest
.
segments
)
{
var
currentSegment
=
player
.
hls
.
manifest
.
segments
[
i
];
currentSegment
.
timeRange
=
{};
currentSegment
.
timeRange
.
start
=
player
.
hls
.
manifest
.
totalDuration
;
currentSegment
.
timeRange
.
end
=
currentSegment
.
timeRange
.
start
+
currentSegment
.
duration
;
player
.
hls
.
manifest
.
totalDuration
+=
currentSegment
.
duration
;
}
}
player
.
duration
(
player
.
hls
.
manifest
.
totalDuration
);
};
/**
* Determines whether there is enough video data currently in the buffer
* and downloads a new segment if the buffered time is less than the goal.
...
...
@@ -144,6 +159,7 @@ var
};
player
.
on
(
'loadedmetadata'
,
fillBuffer
);
player
.
on
(
'timeupdate'
,
fillBuffer
);
player
.
on
(
'loadedmanifest'
,
onLoadedManifest
);
// download and process the manifest
(
function
()
{
...
...
Please
register
or
sign in
to post a comment