Skip to content

Commit

Permalink
html5: autoPlay fires play asynchronously after constructor fixes #1131
Browse files Browse the repository at this point in the history
  • Loading branch information
leandromoreira committed Aug 26, 2016
1 parent 4570109 commit 3140ce0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/playbacks/html5_video/html5_video.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export default class HTML5Video extends Playback {
this.settings.right = ['fullscreen', 'volume', 'hd-indicator']

// https://github.com/clappr/clappr/issues/1076
this.options.autoPlay && this.play()
this.options.autoPlay && process.nextTick(() => this.play())
}

/**
Expand Down
7 changes: 5 additions & 2 deletions test/playbacks/html5_video_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,12 @@ describe('HTML5Video playback', function() {
expect(thereWasPlayIntent).to.be.true
})

it('isPlaying() is true immediately when autoPlay is true', function() {
it('isPlaying() is true after constructor when autoPlay is true', function(done) {
const playback = new HTML5Video({src: 'http://example.com/dash.ogg', autoPlay: true})
expect(playback.isPlaying()).to.be.true
process.nextTick(function(){
expect(playback.isPlaying()).to.be.true
done()
})
})

it('setup crossorigin attribute', function() {
Expand Down

0 comments on commit 3140ce0

Please sign in to comment.