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
c0d2ed06
authored
2014-03-14 16:15:55 -0400
by
Gary Katsevman
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
convert segmentXHR to use xhr helper
1 parent
64547ed3
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
16 deletions
src/videojs-hls.js
src/videojs-hls.js
View file @
c0d2ed0
...
...
@@ -639,31 +639,24 @@ var
}
// request the next segment
segmentXhr
=
new
window
.
XMLHttpRequest
();
segmentXhr
.
open
(
'GET'
,
segmentUri
);
segmentXhr
.
responseType
=
'arraybuffer'
;
segmentXhr
.
onreadystatechange
=
function
()
{
// wait until the request completes
if
(
this
.
readyState
!==
4
)
{
return
;
}
segmentXhr
=
xhr
({
url
:
segmentUri
,
responseType
:
'arraybuffer'
},
function
(
error
,
url
)
{
// the segment request is no longer outstanding
segmentXhr
=
null
;
// trigger an error if the request was not successful
if
(
this
.
status
>=
400
)
{
if
(
error
)
{
player
.
hls
.
error
=
{
status
:
this
.
status
,
message
:
'HLS segment request error at URL: '
+
segmentUri
,
message
:
'HLS segment request error at URL: '
+
url
,
code
:
(
this
.
status
>=
500
)
?
4
:
2
};
// try moving on to the next segment
player
.
hls
.
mediaIndex
++
;
return
;
}
}
else
{
// stop processing if the request was aborted
if
(
!
this
.
response
)
{
return
;
...
...
@@ -698,9 +691,10 @@ var
// figure out what stream the next segment should be downloaded from
// with the updated bandwidth information
updateCurrentPlaylist
();
};
}
});
startTime
=
+
new
Date
();
segmentXhr
.
send
(
null
);
};
// load the MediaSource into the player
...
...
Please
register
or
sign in
to post a comment