From 0400734df7a38f4b100d601eb8cffd7cd9689c76 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Mon, 7 Nov 2016 19:05:32 +0100 Subject: Click video player to toggle playback --- .../javascripts/components/components/video_player.jsx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'app/assets/javascripts/components') diff --git a/app/assets/javascripts/components/components/video_player.jsx b/app/assets/javascripts/components/components/video_player.jsx index fcf966d83..209db33a7 100644 --- a/app/assets/javascripts/components/components/video_player.jsx +++ b/app/assets/javascripts/components/components/video_player.jsx @@ -46,11 +46,23 @@ const VideoPlayer = React.createClass({ this.setState({ muted: !this.state.muted }); }, + handleVideoClick (e) { + e.stopPropagation(); + + const node = ReactDOM.findDOMNode(this).querySelector('video'); + + if (node.paused) { + node.play(); + } else { + node.pause(); + } + }, + render () { return (
-
); } -- cgit