d4644b36 by David LaPalomento

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.
1 parent 0c39e6ff
......@@ -12,6 +12,7 @@
<link rel="stylesheet" href="css/normalize.min.css">
<link rel="stylesheet" href="css/main.css">
<link rel="stylesheet" href="../../node_modules/video.js/dist/video-js/video-js.css">
<script src="js/vendor/modernizr-2.6.2.min.js"></script>
</head>
......
......@@ -111,12 +111,15 @@
requests = [];
fakeXhr.onCreate = function(xhr) {
xhr.startTime = t;
xhr.delivered = 0;
requests.push(xhr);
};
// initialize the HLS tech
fixture.innerHTML = '';
video = document.createElement('video');
video.className = 'video-js vjs-default-skin';
video.controls = true;
fixture.appendChild(video);
player = videojs(video, {
techOrder: ['hls'],
......@@ -170,7 +173,6 @@
// deliver responses if they're ready
requests = requests.reduce(function(remaining, request) {
var arrival = request.startTime + propagationDelay,
delivered = Math.max(0, bandwidths[i].bandwidth * (t - arrival)),
segmentSize = +request.url.match(/(\d+)-\d+$/)[1] * segmentDuration;
// playlist responses
......@@ -185,7 +187,11 @@
}
// segment responses
if (delivered > segmentSize) {
if (t >= arrival) {
request.delivered += results.bandwidth[t].bandwidth;
}
if (request.delivered >= segmentSize) {
// segment responses are delivered after the propagation
// delay and the transmission time have elapsed
buffered += segmentDuration;
......