@@ -9,6 +9,7 @@ import { connect } from 'react-redux';
9
9
import { isPlaying } from '../actions/isPlaying' ;
10
10
import { hasStopped } from '../actions/hasStopped' ;
11
11
import { setVolume } from '../actions/setVolume' ;
12
+ import { setFullscreen } from '../actions/setFullscreen' ;
12
13
13
14
import Button from '../components/Button.jsx' ;
14
15
import Volume from '../components/Volume.jsx' ;
@@ -23,6 +24,10 @@ export class PlaybackControls extends Component {
23
24
this . props . hasStoppedAction ( true ) ;
24
25
}
25
26
27
+ _onFullscreenButtonClick ( ) {
28
+ this . props . setFullscreenAction ( ! this . props . fullscreen ) ;
29
+ }
30
+
26
31
_onVolumeChange ( event ) {
27
32
const volumeValue = _ . get ( event , 'target.value' ) ;
28
33
this . props . setVolumeAction ( volumeValue ) ;
@@ -31,12 +36,14 @@ export class PlaybackControls extends Component {
31
36
render ( ) {
32
37
const playPauseButtonText = this . props . isPlaying ? 'pause' : 'play' ;
33
38
const stopButtonText = 'stop' ;
39
+ const fullscreenText = 'fullscreen' ;
34
40
35
41
return (
36
42
< div >
37
43
< Progress currentTime = { this . props . currentTime } duration = { this . props . duration } />
38
44
< Button onClick = { this . _onPlayButtonClick . bind ( this ) } text = { playPauseButtonText } />
39
45
< Button onClick = { this . _onStopButtonClick . bind ( this ) } text = { stopButtonText } />
46
+ < Button onClick = { this . _onFullscreenButtonClick . bind ( this ) } text = { fullscreenText } />
40
47
< Volume onChange = { this . _onVolumeChange . bind ( this ) } />
41
48
</ div >
42
49
) ;
@@ -45,26 +52,30 @@ export class PlaybackControls extends Component {
45
52
46
53
PlaybackControls . propTypes = {
47
54
isPlaying : React . PropTypes . bool ,
55
+ duration : React . PropTypes . number ,
56
+ currentTime : React . PropTypes . number ,
57
+ fullscreen : React . PropTypes . bool ,
48
58
isPlayingAction : React . PropTypes . func ,
49
59
hasStoppedAction : React . PropTypes . func ,
50
60
setVolumeAction : React . PropTypes . func ,
51
- duration : React . PropTypes . number ,
52
- currentTime : React . PropTypes . number
61
+ setFullscreenAction : React . PropTypes . func
53
62
} ;
54
63
55
64
function mapStateToProps ( state ) {
56
65
return {
57
66
isPlaying : state . playback . isPlaying ,
58
67
duration : state . playback . duration ,
59
- currentTime : state . playback . currentTime
68
+ currentTime : state . playback . currentTime ,
69
+ fullscreen : state . playback . fullscreen
60
70
} ;
61
71
}
62
72
63
73
function mapDispatchToProps ( dispatch ) {
64
74
return {
65
75
isPlayingAction : bindActionCreators ( isPlaying , dispatch ) ,
66
76
hasStoppedAction : bindActionCreators ( hasStopped , dispatch ) ,
67
- setVolumeAction : bindActionCreators ( setVolume , dispatch )
77
+ setVolumeAction : bindActionCreators ( setVolume , dispatch ) ,
78
+ setFullscreenAction : bindActionCreators ( setFullscreen , dispatch )
68
79
} ;
69
80
}
70
81
0 commit comments