-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Poster and Video being displayed #1509
Comments
I'm not using audioOnly prop, but still both poster and video rendering.
|
Also a problem for me. @tscrip what version didn't have this problem? I can repro it on 4.0.1 |
As a workaround, we wrapped the video player in a view and added an renderPoster() {
if (this.state.paused && this.elapsedTime === 0) {
return (
<Image
style={styles.videoPoster}
source={this.videoPosterUrl}
resizeMode="contain"
/>
);
} else {
return (null);
}
}
render() {
return (
<View style={styles.videoComponent}>
<Video
ref={(ref) => { this.videoRef = ref; }}
style={styles.nativeVideoControls}
source={this.props.source}
paused={this.state.paused}
resizeMode="contain"
onProgress={this.onProgress}
onEnd={this.onEnd}
onError={this.onError}
onLoad={this.onLoaded}
ignoreSilentSwitch="ignore"
/>
{ this.renderPoster() }
</View>
);
} Styles look like this, for reference: const ASPECT_RATIO = 16 / 9;
const styles = StyleSheet.create({
nativeVideoControls: {
top: 0,
height: '100%',
},
videoComponent: {
width: '100%',
height: 'auto',
minWidth: '100%',
aspectRatio: ASPECT_RATIO,
backgroundColor: COLORS.BLACK,
},
videoContainer: {
height: 'auto',
},
videoPoster: {
top: 0,
width: '100%',
minWidth: '100%',
height: 'auto',
aspectRatio: ASPECT_RATIO,
position: 'absolute',
backgroundColor: COLORS.WHITE,
},
}); |
Awesome, thanks, we'll take this approach too |
We're facing the same issues after upgrading from 3.2.1 to 4.4.0. Maybe it has something to do with this commit : 95cea76 |
Same issue here. Any update on this? |
Reason seems to be a view wrapping the poster, undoing the absolute positioning of it. And the wrapper takes the style from nativeProps...
Here is my temporary fix, let me know if this fixes other peoples issues. I can submit a PR over the weekend.
(By setting absolute position on the Video the "poster wrapper" becomes absolute as well. Looks like it was introduced 9 months ago 55e0e4d |
Same issue. iOS
### Android
My code is as follows:
|
@akhilsanker I just submitted a PR, can you try it out and see if that fixes your issue? |
Hi @jenshandersson , |
Fixed on 4.4.2 |
Thanks @JoeM-RP that worked for me as this is still an issue in 4.4.2 |
This is still an issue in 5.0.2 |
I feel like in audioonly mode it is fooling users. Video keeps playing and only poster stays at the top. There should be actual implementation which doesn't use bandwidth for video only use audio bandwidth when audio-only flag is set. Then audio only is only meaningful when there is bandwidth saving to switch from video to audio. But in current player implementation both mode use same bandwidth. |
Current behavior
When using a Video Element along with the poster prop, I am getting both displayed instead of one or the other. This was not a problem with the last version of the player.
Reproduction steps
Create React Code like this:
Expected behavior
I would expect the poster to be displayed until you click the play button. On clicking play, it would hide the poster and start the video.
Platform
Which player are you experiencing the problem on:
The text was updated successfully, but these errors were encountered: