Skip to content

Commit

Permalink
* [html5] fix uncaught dom exception for video.play. (#1877)
Browse files Browse the repository at this point in the history
  • Loading branch information
MrRaindrop authored and Hanks10100 committed Dec 12, 2016
1 parent 8bc1fe7 commit 7a0bd03
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions html5/render/browser/extend/components/video/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ function getProto (Weex) {
node.setAttribute('play-status', this.playStatus)
this.node = node
if (this.autoPlay && this.playStatus === 'play') {
this.play()
// set timer to avoid error: uncaught DOM exception: the play() request
// was interrupted by a new load request.
setTimeout(() => {
this.play()
}, 0)
}
return node
},
Expand All @@ -43,7 +47,12 @@ function getProto (Weex) {
src = this.node.getAttribute('data-src')
src && this.node.setAttribute('src', src)
}
this.node.play()
try {
this.node.play()
}
catch (err) {
// DO NOTHING.
}
},

pause () {
Expand Down

0 comments on commit 7a0bd03

Please sign in to comment.