e8fc6fc0 by David LaPalomento

Merge pull request #12 from videojs/bugfix/autoplay

Autoplay if requested
2 parents bd468d14 fe02f9d6
......@@ -584,6 +584,10 @@ var
src: videojs.URL.createObjectURL(mediaSource),
type: "video/flv"
}]);
if (player.options().autoplay) {
player.play();
}
};
videojs.plugin('hls', function() {
......
......@@ -55,7 +55,7 @@ var
module('HLS', {
setup: function() {
// mock out Flash feature for phantomjs
// mock out Flash features for phantomjs
oldFlashSupported = videojs.Flash.isSupported;
videojs.Flash.isSupported = function() {
return true;
......@@ -118,6 +118,20 @@ module('HLS', {
}
});
test('starts playing if autoplay is specified', function() {
var plays = 0;
player.play = function() {
plays++;
};
player.options().autoplay = true;
player.hls('manifest/playlist.m3u8');
videojs.mediaSources[player.currentSrc()].trigger({
type: 'sourceopen'
});
strictEqual(1, plays, 'play was called');
});
test('loads the specified manifest URL on init', function() {
var loadedmanifest = false, loadedmetadata = false;
player.on('loadedmanifest', function() {
......