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
d7381365
authored
2014-10-07 20:56:57 -0400
by
David LaPalomento
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge pull request #151 from amfr/fix_timeouts
Fix timeouts
2 parents
5662e402
e64ce8ac
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
8 deletions
src/xhr.js
test/videojs-hls.html
test/xhr_test.js
src/xhr.js
View file @
d738136
...
...
@@ -42,13 +42,6 @@
request
.
withCredentials
=
true
;
}
if
(
options
.
timeout
)
{
if
(
request
.
timeout
===
0
)
{
request
.
timeout
=
options
.
timeout
;
request
.
ontimeout
=
function
()
{
request
.
timedout
=
true
;
};
}
else
{
// polyfill XHR2 by aborting after the timeout
abortTimeout
=
window
.
setTimeout
(
function
()
{
if
(
request
.
readyState
!==
4
)
{
request
.
timedout
=
true
;
...
...
@@ -56,7 +49,6 @@
}
},
options
.
timeout
);
}
}
request
.
onreadystatechange
=
function
()
{
// wait until the request completes
...
...
test/videojs-hls.html
View file @
d738136
...
...
@@ -58,6 +58,7 @@
<script
src=
"m3u8_test.js"
></script>
<script
src=
"playlist-loader_test.js"
></script>
<script
src=
"decrypter_test.js"
></script>
<script
src=
"xhr_test.js"
></script>
</head>
<body>
<div
id=
"qunit"
></div>
...
...
test/xhr_test.js
0 → 100644
View file @
d738136
(
function
(
window
,
videojs
,
undefined
)
{
'use strict'
;
/*
XHR test suite
*/
var
xhr
;
module
(
'XHR'
,
{
setup
:
function
()
{
xhr
=
sinon
.
useFakeXMLHttpRequest
();
},
teardown
:
function
()
{
xhr
.
restore
();
}
});
test
(
'handles xhr timeouts correctly'
,
function
()
{
var
error
;
var
clock
=
sinon
.
useFakeTimers
();
videojs
.
Hls
.
xhr
({
url
:
'http://example.com'
,
timeout
:
1
},
function
(
innerError
)
{
error
=
innerError
;
});
clock
.
tick
(
1
);
strictEqual
(
error
,
'timeout'
,
'called with timeout error'
);
clock
.
restore
();
});
})(
window
,
window
.
videojs
);
Please
register
or
sign in
to post a comment