72ece371 by David LaPalomento

Run travis tests in Firefox

Fix tests so they work in Firefox without native MediaSources. Clean up a timeout properly on dispose. Update some paths on the example page.
1 parent ea13a59a
language: node_js
sudo: false
node_js:
- '0.10'
- "stable"
install:
- npm install -g grunt-cli && npm install
notifications:
......@@ -11,6 +12,9 @@ notifications:
channels:
- "chat.freenode.net#videojs"
use_notice: true
before_script:
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
env:
global:
- secure: dM7svnHPPu5IiUMeFWW5zg+iuWNpwt6SSDi3MmVvhSclNMRLesQoRB+7Qq5J/LiKhmjpv1/GlNVV0CTsHMRhZNwQ3fo38eEuTXv99aAflEITXwSEh/VntKViHbGFubn06EnVkJoH6MX3zJ6kbiwc2QdSQbywKzS6l6quUEpWpd0=
......
......@@ -357,7 +357,7 @@ module.exports = function(grunt) {
grunt.task.run(['karma:saucelabs']);
grunt.task.run(['connect:test', 'protractor:saucelabs']);
} else {
grunt.task.run(['karma:phantomjs']);
grunt.task.run(['karma:firefox']);
}
} else {
if (tasks.length === 0) {
......
......@@ -11,8 +11,6 @@
<!-- transmuxing -->
<script src="node_modules/videojs-contrib-media-sources/node_modules/mux.js/lib/stream.js"></script>
<script src="node_modules/videojs-contrib-media-sources/node_modules/mux.js/lib/mp4-generator.js"></script>
<script src="node_modules/videojs-contrib-media-sources/node_modules/mux.js/lib/transmuxer.js"></script>
<script src="node_modules/videojs-contrib-media-sources/node_modules/mux.js/legacy/flv-tag.js"></script>
<script src="node_modules/videojs-contrib-media-sources/node_modules/mux.js/legacy/exp-golomb.js"></script>
<script src="node_modules/videojs-contrib-media-sources/node_modules/mux.js/legacy/h264-extradata.js"></script>
......@@ -23,6 +21,9 @@
<!-- Media Sources plugin -->
<script src="node_modules/videojs-contrib-media-sources/src/videojs-media-sources.js"></script>
<script>
videojs.MediaSource.webWorkerURI = 'node_modules/videojs-contrib-media-sources/src/transmuxer_worker.js';
</script>
<!-- HLS plugin -->
<script src="src/videojs-hls.js"></script>
......@@ -39,12 +40,6 @@
<script src="src/bin-utils.js"></script>
<!-- example MPEG2-TS segments -->
<!-- bipbop -->
<!-- <script src="test/tsSegment.js"></script> -->
<!-- bunnies -->
<!--<script src="test/tsSegment-bc.js"></script>-->
<style>
body {
font-family: Arial, sans-serif;
......
......@@ -10,10 +10,10 @@ var
// a fudge factor to apply to advertised playlist bitrates to account for
// temporary flucations in client bandwidth
bandwidthVariance = 1.1,
Component = videojs.getComponent('Component'),
// the amount of time to wait between checking the state of the buffer
bufferCheckInterval = 500,
Component = videojs.getComponent('Component'),
keyXhr,
keyFailed,
......@@ -133,7 +133,7 @@ videojs.Hls.prototype.src = function(src) {
// We need to trigger this asynchronously to give others the chance
// to bind to the event when a source is set at player creation
setTimeout(function() {
this.setTimeout(function() {
this.tech_.trigger('loadstart');
}.bind(this), 1);
......@@ -597,6 +597,7 @@ videojs.Hls.prototype.dispose = function() {
}
this.resetSrc_();
Component.prototype.dispose.call(this);
};
/**
......
......@@ -212,7 +212,8 @@ var
// return an absolute version of a page-relative URL
absoluteUrl = function(relativeUrl) {
return window.location.origin +
return window.location.protocol + '//' +
window.location.host +
(window.location.pathname
.split('/')
.slice(0, -1)
......@@ -239,6 +240,9 @@ module('HLS', {
el.className = 'vjs-tech vjs-mock-flash';
el.vjs_load = function() {};
el.vjs_getProperty = function(attr) {
if (attr === 'buffered') {
return [[0,0]];
}
return el[attr];
};
el.vjs_setProperty = function(attr, value) {
......@@ -470,14 +474,14 @@ test('re-initializes the playlist loader when switching sources', function() {
test('sets the duration if one is available on the playlist', function() {
var events = 0;
player.on('durationchange', function() {
events++;
});
player.src({
src: 'manifest/media.m3u8',
type: 'application/vnd.apple.mpegurl'
});
openMediaSource(player);
player.tech.on('durationchange', function() {
events++;
});
standardXHRResponse(requests[0]);
equal(player.tech.hls.mediaSource.duration, 40, 'set the duration');
......@@ -569,7 +573,8 @@ test('recognizes domain-relative URLs', function() {
standardXHRResponse(requests[0]);
standardXHRResponse(requests[1]);
strictEqual(requests[1].url,
window.location.origin + '/00001.ts',
window.location.protocol + '//' + window.location.host +
'/00001.ts',
'the first segment is requested');
});
......@@ -1349,9 +1354,11 @@ test('when outstanding XHRs are cancelled, they get aborted properly', function(
test('segmentXhr is properly nulled out when dispose is called', function() {
var
readystatechanges = 0,
oldDispose = Flash.prototype.dispose;
oldDispose = Flash.prototype.dispose,
player;
Flash.prototype.dispose = function() {};
player = createPlayer();
player.src({
src: 'manifest/media.m3u8',
type: 'application/vnd.apple.mpegurl'
......@@ -2128,7 +2135,7 @@ test('does not break if the playlist has no segments', function() {
});
test('clears the segment buffer on seek', function() {
var currentTime, bufferEnd, oldCurrentTime;
var currentTime, oldCurrentTime;
player.src({
src: 'discontinuity.m3u8',
......@@ -2142,8 +2149,8 @@ test('clears the segment buffer on seek', function() {
}
return currentTime;
};
player.buffered = function() {
return videojs.createTimeRange(0, bufferEnd);
player.tech.buffered = function() {
return videojs.createTimeRange();
};
requests.pop().respond(200, null,
......@@ -2159,7 +2166,6 @@ test('clears the segment buffer on seek', function() {
// play to 6s to trigger the next segment request
currentTime = 6;
bufferEnd = 10;
clock.tick(6000);
standardXHRResponse(requests.pop()); // 2.ts
......