Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/DefaultPlayer/DefaultPlayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ const DefaultPlayer = ({
</video>
<Overlay
onClick={onPlayPauseClick}
copy={copy.overlay}
{...video} />
{ controls && controls.length && !video.error
? <div className={styles.controls}>
Expand Down
15 changes: 15 additions & 0 deletions src/DefaultPlayer/Overlay/Overlay.css
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
margin-left: -30px;
background-color: rgba(0,0,0,0.7);
border-radius: 10px;
border: none;
padding:0;
outline: none;
cursor: pointer;
}

.icon {
Expand All @@ -34,3 +38,14 @@
margin-left: -20px;
transform: translateY(-50%);
}

.srOnly {
border: 0;
clip: rect(0 0 0 0);
height: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute;
width: 1px;
}
32 changes: 18 additions & 14 deletions src/DefaultPlayer/Overlay/Overlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,44 +9,48 @@ export default class Overlay extends Component {
const {
error,
paused,
loading
loading,
copy
} = this.props;
const iconProps = {
className: styles.icon,
height: 40,
width: 40,
fill: '#fff'
fill: '#fff',
'aria-hidden': true,
};
if (error) {
return (
<span className={styles.inner}>
<button className={styles.inner}>
<span className={styles.srOnly}>{copy.error}</span>
<Report {...iconProps} />
</span>
</button>
);
} else if (loading) {
return (
<span className={styles.inner}>
<button className={styles.inner}>
<span className={styles.srOnly}>{copy.loading}</span>
<Spin {...iconProps} />
</span>
</button>
);
} else if (paused) {
return (
<span className={styles.inner}>
<button className={styles.inner}>
<span className={styles.srOnly}>{copy.paused}</span>
<PlayArrow {...iconProps} />
</span>
</button>
);
}
}

render () {
const { className, onClick } = this.props;
return (
<div className={[
styles.component,
className
].join(' ')}
onClick={onClick}>
{ this.renderContent() }
<div
className={[styles.component, className].join(' ')}
onClick={onClick}
>
{this.renderContent()}
</div>
);
}
Expand Down
7 changes: 6 additions & 1 deletion src/DefaultPlayer/copy.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ const copy = {
volume: 'Change volume',
fullscreen: 'View video fullscreen',
seek: 'Seek video',
captions: 'Toggle captions'
captions: 'Toggle captions',
overlay: {
loading: 'Loading Video...',
paused: 'Play Video',
error: 'Unable to play video'
}
};

export default copy;