Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adds audioOnly option that always displays poster image (if provided)… #1039

Merged
merged 3 commits into from
Jun 21, 2018
Merged
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
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ var styles = StyleSheet.create({

### Configurable props
* [allowsExternalPlayback](#allowsexternalplayback)
* [audioOnly](#audioonly)
* [ignoreSilentSwitch](#ignoresilentswitch)
* [muted](#muted)
* [paused](#paused)
Expand Down Expand Up @@ -246,6 +247,15 @@ Indicates whether the player allows switching to external playback mode such as

Platforms: iOS

#### audioOnly
Indicates whether the player should only play the audio track and instead of displaying the video track, show the poster instead.
* **false (default)** - Display the video as normal
* **true** - Show the poster and play the audio

For this to work, the poster prop must be set.

Platforms: all

#### ignoreSilentSwitch
Controls the iOS silent switch behavior
* **"inherit" (default)** - Use the default AVPlayer behavior
Expand Down
5 changes: 3 additions & 2 deletions Video.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export default class Video extends Component {
};

_onSeek = (event) => {
if (this.state.showPoster) {
if (this.state.showPoster && !this.props.audioOnly) {
this.setState({showPoster: false});
}

Expand Down Expand Up @@ -132,7 +132,7 @@ export default class Video extends Component {
};

_onPlaybackRateChange = (event) => {
if (this.state.showPoster && (event.nativeEvent.playbackRate !== 0)) {
if (this.state.showPoster && event.nativeEvent.playbackRate !== 0 && !this.props.audioOnly) {
this.setState({showPoster: false});
}

Expand Down Expand Up @@ -307,6 +307,7 @@ Video.propTypes = {
ignoreSilentSwitch: PropTypes.oneOf(['ignore', 'obey']),
disableFocus: PropTypes.bool,
controls: PropTypes.bool,
audioOnly: PropTypes.bool,
currentTime: PropTypes.number,
progressUpdateInterval: PropTypes.number,
useTextureView: PropTypes.bool,
Expand Down