Merge pull request #1039 from shlokamin/master
adds audioOnly option that always displays poster image (if provided)…
This commit is contained in:
commit
e4e3ce1877
10
README.md
10
README.md
@ -218,6 +218,7 @@ var styles = StyleSheet.create({
|
||||
|
||||
### Configurable props
|
||||
* [allowsExternalPlayback](#allowsexternalplayback)
|
||||
* [audioOnly](#audioonly)
|
||||
* [ignoreSilentSwitch](#ignoresilentswitch)
|
||||
* [muted](#muted)
|
||||
* [paused](#paused)
|
||||
@ -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
|
||||
|
5
Video.js
5
Video.js
@ -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});
|
||||
}
|
||||
|
||||
@ -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});
|
||||
}
|
||||
|
||||
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user