Make plugin options accessible by xhr helper
Showing
1 changed file
with
15 additions
and
0 deletions
... | @@ -31,6 +31,9 @@ videojs.hls = { | ... | @@ -31,6 +31,9 @@ videojs.hls = { |
31 | }; | 31 | }; |
32 | 32 | ||
33 | var | 33 | var |
34 | |||
35 | pluginOptions, | ||
36 | |||
34 | // the desired length of video to maintain in the buffer, in seconds | 37 | // the desired length of video to maintain in the buffer, in seconds |
35 | goalBufferLength = 5, | 38 | goalBufferLength = 5, |
36 | 39 | ||
... | @@ -109,11 +112,21 @@ var | ... | @@ -109,11 +112,21 @@ var |
109 | method: 'GET' | 112 | method: 'GET' |
110 | }, | 113 | }, |
111 | request; | 114 | request; |
115 | |||
116 | if (typeof callback !== 'function') { | ||
117 | callback = function() {}; | ||
118 | } | ||
119 | |||
112 | if (typeof url === 'object') { | 120 | if (typeof url === 'object') { |
113 | options = videojs.util.mergeOptions(options, url); | 121 | options = videojs.util.mergeOptions(options, url); |
114 | url = options.url; | 122 | url = options.url; |
115 | } | 123 | } |
116 | request = new window.XMLHttpRequest(); | 124 | request = new window.XMLHttpRequest(); |
125 | |||
126 | if (pluginOptions.withCredentials) { | ||
127 | request.withCredentials = true; | ||
128 | } | ||
129 | |||
117 | request.open(options.method, url); | 130 | request.open(options.method, url); |
118 | request.onreadystatechange = function() { | 131 | request.onreadystatechange = function() { |
119 | // wait until the request completes | 132 | // wait until the request completes |
... | @@ -299,6 +312,8 @@ var | ... | @@ -299,6 +312,8 @@ var |
299 | return; | 312 | return; |
300 | } | 313 | } |
301 | 314 | ||
315 | pluginOptions = options || {}; | ||
316 | |||
302 | srcUrl = (function() { | 317 | srcUrl = (function() { |
303 | var | 318 | var |
304 | extname, | 319 | extname, | ... | ... |
-
Please register or sign in to post a comment