fix play icon being displayed for non-playable content

This commit is contained in:
Akinwale Ariwodola 2019-03-11 10:08:47 +01:00
parent bac202d4ec
commit 26cd218ec0
2 changed files with 27 additions and 24 deletions

View file

@ -511,30 +511,32 @@ class FilePage extends React.PureComponent {
onStartDownloadFailed={this.startDownloadFailed} />} onStartDownloadFailed={this.startDownloadFailed} />}
{!fileInfo && <FilePrice uri={uri} style={filePageStyle.filePriceContainer} textStyle={filePageStyle.filePriceText} />} {!fileInfo && <FilePrice uri={uri} style={filePageStyle.filePriceContainer} textStyle={filePageStyle.filePriceText} />}
</View> </View>
{canLoadMedia && fileInfo && <View style={playerBgStyle} {(canLoadMedia && fileInfo && isPlayable) &&
ref={(ref) => { this.playerBackground = ref; }} <View style={playerBgStyle}
onLayout={(evt) => { ref={(ref) => { this.playerBackground = ref; }}
if (!this.state.playerBgHeight) { onLayout={(evt) => {
this.setState({ playerBgHeight: evt.nativeEvent.layout.height }); if (!this.state.playerBgHeight) {
} this.setState({ playerBgHeight: evt.nativeEvent.layout.height });
}} />} }
{canLoadMedia && fileInfo && <MediaPlayer }} />}
fileInfo={fileInfo} {(canLoadMedia && fileInfo && isPlayable) &&
assignPlayer={(ref) => { this.player = ref; }} <MediaPlayer
uri={uri} fileInfo={fileInfo}
style={playerStyle} assignPlayer={(ref) => { this.player = ref; }}
autoPlay={autoplay || this.state.autoPlayMedia} uri={uri}
onFullscreenToggled={this.handleFullscreenToggle} style={playerStyle}
onLayout={(evt) => { autoPlay={autoplay || this.state.autoPlayMedia}
if (!this.state.playerHeight) { onFullscreenToggled={this.handleFullscreenToggle}
this.setState({ playerHeight: evt.nativeEvent.layout.height }); onLayout={(evt) => {
} if (!this.state.playerHeight) {
}} this.setState({ playerHeight: evt.nativeEvent.layout.height });
onMediaLoaded={() => this.onMediaLoaded(channelName, title, uri)} }
onPlaybackStarted={this.onPlaybackStarted} }}
onPlaybackFinished={this.onPlaybackFinished} onMediaLoaded={() => this.onMediaLoaded(channelName, title, uri)}
thumbnail={metadata.thumbnail} onPlaybackStarted={this.onPlaybackStarted}
/>} onPlaybackFinished={this.onPlaybackFinished}
thumbnail={metadata.thumbnail}
/>}
{showActions && {showActions &&
<View style={filePageStyle.actions}> <View style={filePageStyle.actions}>

View file

@ -139,6 +139,7 @@ const filePageStyle = StyleSheet.create({
}, },
containedPlayerBackground: { containedPlayerBackground: {
width: '100%', width: '100%',
marginTop: 60,
height: containedMediaHeight, height: containedMediaHeight,
}, },
fullscreenPlayerBackground: { fullscreenPlayerBackground: {