Skip to content

Commit

Permalink
Add ability to play VideoPress player
Browse files Browse the repository at this point in the history
  • Loading branch information
donnapep committed Mar 14, 2017
1 parent cfad3c7 commit e32ab0e
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ class EditorMediaModalDetailPreviewVideoPress extends Component {
componentWillReceiveProps( nextProps ) {
if ( this.props.isPlaying && ! nextProps.isPlaying ) {
this.pause();
} else if ( ! this.props.isPlaying && nextProps.isPlaying ) {
this.play();
}
}

Expand Down Expand Up @@ -128,6 +130,16 @@ class EditorMediaModalDetailPreviewVideoPress extends Component {
}
}

play() {
if ( ! this.player || ! this.player.state ) {
return;
}

if ( typeof this.player.state.play === 'function' ) {
this.player.state.play();
}
}

pause() {
if ( ! this.player || ! this.player.state ) {
return;
Expand Down

0 comments on commit e32ab0e

Please sign in to comment.