Comments (4)
@assafb81,
I closed this issue assuming it was resolved with the code you used.
Standard video ratios are 16:9 which is why the video height is multiplied by 0.562. Videos with these ratios should never see black bars inline in theory. With the different videos I've used I've never had seen black bars until I use a video with a unique ratio.
It looks like you're trying to display the entire content of a video where the ratio is not 16:9, naturally you'll either see black bars or need to zoom to cover the player. You've applied a specific height and added marginHorizontal: 30 outside the scope of the video player and quoting from the readme:
Avoid adding alignItems: 'center' to the container, it can cause fullscreen mode to disappear :D
Perhaps you may want to re-consider your container styling.
However, if your video is 16:9 this could be an issue related to react-native-video. Maybe it might be worth looking at the issues in that module.
from react-native-af-video-player.
Hi @assafb81 do you have images/videos + code to demonstrate your issue?
from react-native-af-video-player.
See this screenshot, when clicking play the video is actually take part of its container and not filling the entire video container -> there are black bar on top and at the bottom of the video:
the relevant code is:
<View style={isFullScreen
? [styles.fullScreen, { height }]
: [styles.background, styles.inline, containerStyle ]}
>
<Video
style={isFullScreen ? [styles.fullScreen, { height }] : styles.inline}
.....
/>
</View>
the relevant style classes are:
background: {
backgroundColor: '#000',
justifyContent: 'center',
alignItems: 'center',
},
inline: {
height: Win.width * INLINE_VIDEO_RATIO,
alignSelf: 'stretch',
},
fullScreen: {
...StyleSheet.absoluteFillObject,
zIndex: 3,
},
containerStyle: {
marginLeft: 30,
marginRight: 30,
marginTop: '20%',
},
The height
is taken from:
const Win = Dimensions.get('window');
const INLINE_VIDEO_RATIO = 0.5625;
constructor() {
this.state: {
height: Win.width * INLINE_VIDEO_RATIO,
},
}
height field is changed in onRotate method:
const { width, height } = Dimensions.get('window');
in landscape its:
this.setState({
height,
});
in portrait its:
this.setState({
height: width * INLINE_VIDEO_RATIO,
});
UPDATE
when I change resizeMode
from contain
to cover
the video fill the entire space, not seeing the black bars above and at the bottom but the video is "zoomed-in" and the edges are cut.
After deeper investigation I think I know what is the issue - the problem is the containerStyle
class.
I want the video have space from the left and right - for some reason marginLeft
and marginRight
also affect the height of the video container children - video and controls.
videoContainer style class looks in the end when in inline:
alignItems: "center",
justifyContent: "center",
marginLeft: 30,
marginRight: 30,
marginTop: "20%",
height: 202.5,
alignSelf: "stretch"
from react-native-af-video-player.
@abbasfreestyle
why did you close this.
I added the code as you can see above and also image.
I will refine the issue:
when the videoContainer
class contain the following:
marginLeft: 30,
marginRight: 30,
I can see the black bars.
I am adding the margin because I want to place the video element when inline in the center of the screen and not spread on the entire width of the screen.
When I remove the marginLeft
and marginRight
the issue is solved but the video is not in the center of the screen and its spread on the entire width of the screen.
from react-native-af-video-player.
Related Issues (20)
- Removing header on full screen HOT 2
- Buffer HOT 1
- Hide controls when playing by default HOT 1
- No background audio on real iOS device HOT 5
- Full screen, as long as the player appears, it will lead to StatusBar HOT 1
- hideFullScreenControl does not hide the full screen control HOT 2
- Since this package doesn't seen to be updated, I've made an updated fork HOT 2
- Video goes off its intended screen area HOT 1
- An error ocorred in install
- logo is required??? HOT 1
- Not able to install this library on React-native 60.5 HOT 3
- how can i handle multiple video in single screen and can i put video advertise in each and every video.. and only one video play which item i viewable and other are pause or stop. HOT 1
- Facing issue at the time of installation HOT 1
- Android Crash On Slider HOT 1
- View Config not found for BVLinearGradient
- Is It Support android 9 and 10? HOT 1
- Does it support HLS links? (NOT AN ISSUE)
- Android issue: error while updating property src of a view managed by RCTVideo null request header HOT 3
- Getting error after installation HOT 3
- No onBuffer function HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-af-video-player.