Deliver the correct number of segment bytes per second
Modifying the display property on the swf object from "" to "block" without the default video.js skin causes Flash callbacks to become undefined. Added the default video.js skin and appropriate video attributes to avoid the issue.
Showing
2 changed files
with
9 additions
and
2 deletions
... | @@ -12,6 +12,7 @@ | ... | @@ -12,6 +12,7 @@ |
12 | 12 | ||
13 | <link rel="stylesheet" href="css/normalize.min.css"> | 13 | <link rel="stylesheet" href="css/normalize.min.css"> |
14 | <link rel="stylesheet" href="css/main.css"> | 14 | <link rel="stylesheet" href="css/main.css"> |
15 | <link rel="stylesheet" href="../../node_modules/video.js/dist/video-js/video-js.css"> | ||
15 | 16 | ||
16 | <script src="js/vendor/modernizr-2.6.2.min.js"></script> | 17 | <script src="js/vendor/modernizr-2.6.2.min.js"></script> |
17 | </head> | 18 | </head> | ... | ... |
... | @@ -111,12 +111,15 @@ | ... | @@ -111,12 +111,15 @@ |
111 | requests = []; | 111 | requests = []; |
112 | fakeXhr.onCreate = function(xhr) { | 112 | fakeXhr.onCreate = function(xhr) { |
113 | xhr.startTime = t; | 113 | xhr.startTime = t; |
114 | xhr.delivered = 0; | ||
114 | requests.push(xhr); | 115 | requests.push(xhr); |
115 | }; | 116 | }; |
116 | 117 | ||
117 | // initialize the HLS tech | 118 | // initialize the HLS tech |
118 | fixture.innerHTML = ''; | 119 | fixture.innerHTML = ''; |
119 | video = document.createElement('video'); | 120 | video = document.createElement('video'); |
121 | video.className = 'video-js vjs-default-skin'; | ||
122 | video.controls = true; | ||
120 | fixture.appendChild(video); | 123 | fixture.appendChild(video); |
121 | player = videojs(video, { | 124 | player = videojs(video, { |
122 | techOrder: ['hls'], | 125 | techOrder: ['hls'], |
... | @@ -170,7 +173,6 @@ | ... | @@ -170,7 +173,6 @@ |
170 | // deliver responses if they're ready | 173 | // deliver responses if they're ready |
171 | requests = requests.reduce(function(remaining, request) { | 174 | requests = requests.reduce(function(remaining, request) { |
172 | var arrival = request.startTime + propagationDelay, | 175 | var arrival = request.startTime + propagationDelay, |
173 | delivered = Math.max(0, bandwidths[i].bandwidth * (t - arrival)), | ||
174 | segmentSize = +request.url.match(/(\d+)-\d+$/)[1] * segmentDuration; | 176 | segmentSize = +request.url.match(/(\d+)-\d+$/)[1] * segmentDuration; |
175 | 177 | ||
176 | // playlist responses | 178 | // playlist responses |
... | @@ -185,7 +187,11 @@ | ... | @@ -185,7 +187,11 @@ |
185 | } | 187 | } |
186 | 188 | ||
187 | // segment responses | 189 | // segment responses |
188 | if (delivered > segmentSize) { | 190 | if (t >= arrival) { |
191 | request.delivered += results.bandwidth[t].bandwidth; | ||
192 | |||
193 | } | ||
194 | if (request.delivered >= segmentSize) { | ||
189 | // segment responses are delivered after the propagation | 195 | // segment responses are delivered after the propagation |
190 | // delay and the transmission time have elapsed | 196 | // delay and the transmission time have elapsed |
191 | buffered += segmentDuration; | 197 | buffered += segmentDuration; | ... | ... |
-
Please register or sign in to post a comment