-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f84d8c1
commit 4ffbf18
Showing
7 changed files
with
145 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import React, {Component} from 'react'; | ||
|
||
// we'll do this later | ||
// http://www.sitepoint.com/use-html5-full-screen-api/ | ||
|
||
class Fullscreen { | ||
|
||
// need to handle if in fullscreen or not in mediacontainer | ||
// shouldComponentUpdate(nextProps) { | ||
// return this.props.fullscreen !== nextProps.fullscreen; | ||
// } | ||
|
||
_handleFullscreen() { | ||
|
||
const {player} = this.props; | ||
|
||
// need to get correct fullscreen on componentDidMount | ||
// instead of checking here every time | ||
if(player.requestFullscreen) { | ||
player.requestFullscreen(); | ||
} else if(player.webkitRequestFullscreen) { | ||
player.webkitRequestFullscreen(); | ||
} else if(player.mozRequestFullScreen) { | ||
player.mozRequestFullScreen(); | ||
} | ||
} | ||
|
||
render() { | ||
return( | ||
<button onClick={::this._handleFullscreen}> | ||
Fullscreen | ||
</button> | ||
); | ||
} | ||
} | ||
|
||
export default Fullscreen; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import React, {Component} from 'react'; | ||
|
||
class MuteUnmute { | ||
|
||
shouldComponentUpdate(nextProps) { | ||
return this.props.muted !== nextProps.muted; | ||
} | ||
|
||
_handleMuteUnmute() { | ||
|
||
const {player} = this.props; | ||
|
||
if(player.muted === false) { | ||
player.muted = true; | ||
} else { | ||
player.muted = false; | ||
} | ||
} | ||
|
||
render() { | ||
return( | ||
<button onClick={::this._handleMuteUnmute}> | ||
{this.props.muted ? 'Unmute' : 'Mute'} | ||
</button> | ||
); | ||
} | ||
} | ||
|
||
export default MuteUnmute; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import React, {Component} from 'react'; | ||
|
||
class Progress { | ||
|
||
dragging = false | ||
|
||
_handleChange(e) { | ||
const {player} = this.props; | ||
player.currentTime = e.target.value; | ||
} | ||
|
||
_handleDragging() { | ||
this.dragging = true; | ||
} | ||
|
||
_handleDrag(e) { | ||
|
||
const {player} = this.props; | ||
|
||
if(this.dragging) { | ||
|
||
player.currentTime = e.target.value; | ||
|
||
if(e.type === 'mouseup') { | ||
this.dragging = false; | ||
} | ||
} | ||
} | ||
|
||
render() { | ||
return( | ||
<input | ||
type="range" | ||
step="any" | ||
max={(this.props.duration).toFixed(4)} | ||
value={this.props.current} | ||
onChange={::this._handleChange} | ||
onMouseDown={::this._handleDragging} | ||
onMouseMove={::this._handleDrag} | ||
onMouseUp={::this._handleDrag} | ||
/> | ||
); | ||
} | ||
} | ||
|
||
export default Progress; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
import MediaContainer from './MediaPlayer'; | ||
import MediaContainer from './MediaContainer'; | ||
import PlayPause from './PlayPause'; | ||
import Progress from './Progress'; | ||
import MuteUnmute from './MuteUnmute'; | ||
import Fullscreen from './Fullscreen'; | ||
|
||
export { MediaContainer, PlayPause }; | ||
export { MediaContainer, PlayPause, Progress, MuteUnmute, Fullscreen }; |