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
8f63b1a9
authored
2014-01-14 07:37:26 -0800
by
Tom Johnson
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
remove time range object dependency on segments
1 parent
467fa2fe
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
22 deletions
src/videojs-hls.js
src/videojs-hls.js
View file @
8f63b1a
...
...
@@ -111,7 +111,6 @@ var
};
player
.
on
(
'ready'
,
function
()
{
player
.
muted
(
true
);
tech
=
player
.
el
().
querySelector
(
'.vjs-tech'
);
tech
.
vjs_setProperty
(
'playerId'
,
player
.
P
);
});
...
...
@@ -122,40 +121,39 @@ var
fillBuffer
(
seekValue
*
1000
);
});
player
.
on
(
'waiting'
,
function
()
{
if
(
player
.
currentTime
()
>=
player
.
duration
()
&&
player
.
hls
.
isLastSegment
())
{
player
.
pause
();
player
.
trigger
(
'ended'
);
}
player
.
on
(
'ended'
,
function
()
{
//console.log('ended received');
});
player
.
hls
.
isLastSegment
=
function
()
{
return
player
.
hls
.
mediaIndex
===
player
.
hls
.
selectPlaylist
().
segments
.
length
;
};
player
.
hls
.
getSegmentByTime
=
function
(
time
)
{
var
index
,
currentSegment
;
player
.
hls
.
getSegmentIndexByTime
=
function
(
time
)
{
var
index
,
counter
,
currentSegmentRange
,
timeRanges
;
if
(
player
.
hls
.
media
&&
player
.
hls
.
media
.
segments
)
{
timeRanges
=
[];
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
currentSegment
;
}
currentSegment
Range
=
{}
;
currentSegmentRange
.
start
=
(
index
===
0
)
?
0
:
timeRanges
[
index
-
1
].
end
;
currentSegmentRange
.
end
=
currentSegmentRange
.
start
+
player
.
hls
.
media
.
segments
[
index
].
duration
;
timeRanges
.
push
(
currentSegmentRange
);
}
}
};
player
.
hls
.
getSegmentIndexByTime
=
function
(
time
)
{
var
index
,
currentSegment
;
if
(
player
.
hls
.
media
&&
player
.
hls
.
media
.
segments
)
{
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
;
for
(
counter
=
0
;
counter
<
timeRanges
.
length
;
counter
++
){
if
(
time
>=
timeRanges
[
counter
].
start
&&
time
<
timeRanges
[
counter
].
end
)
{
return
counter
;
}
}
return
null
;
}
return
null
;
};
/**
...
...
@@ -355,10 +353,18 @@ var
targetTag
=
tagIndex
;
}
}
try
{
tech
.
vjs_setProperty
(
'lastSeekedTime'
,
segmentParser
.
getTags
()[
targetTag
].
pts
/
1000
);
}
catch
(
err
)
{
}
while
(
bleedIndex
<
targetTag
)
{
segmentParser
.
getNextTag
();
bleedIndex
++
;
}
}
while
(
segmentParser
.
tagsAvailable
())
{
...
...
Please
register
or
sign in
to post a comment