IOS app运行时不满屏,上下留有黑边


转自:http://blog.youkuaiyun.com/lilinoscar/article/details/47972815


特别是在5或者5s上运行,会出现上下有一样宽高的黑色区域,明明代码已经设置全屏了,为啥还出现这样的问题,那又如何解决呢?

因为我们的那个应用是按照320*480的size来运行的,所以导致上下有黑色。

1.解决办法就是把default-568h图片放到你的项目里,这样运行就可以解决问题。

          下载图片地址:http://download.youkuaiyun.com/detail/lilinoscar/9044251

2.就是每个应用程序启动时都会设置启动页,而这个启动页需要几张图片,你把320*480的这张图片名字改成default-568h,记得是png格式。


<view class="video" v-if="item && item.video_url"> <Player style="width: 100%;" :key="index" :index="index" :video-url="item.video_url" :cover-url="item.cover_url" @play="handleVideoPlay" /> </view> handleVideoPlay(index) { if(this.currentIndex !== null && this.currentIndex !== index) { const prevVideo = uni.createVideoContext('video'+this.currentIndex, this) prevVideo.pause() prevVideo.exitFullScreen() } this.currentIndex = index }, <template> <view class="video-box"> <video style="width: 100%;" :id="'video'+index" :src="videoUrl" :poster="coverUrl" :controls="true" :show-fullscreen-btn="true" :show-center-play-btn="true" :enable-progress-gesture="true" @fullscreenchange="handleFullscreen" @play="onPlay" @pause="onPause" @click="toggleFullscreen" ></video> </view> </template> <script> export default { props: { videoUrl: String, coverUrl: String, index: Number }, methods: { toggleFullscreen() { // const videoCtx = uni.createVideoContext('video'+this.index, this) // if(this.isFullscreen) { // videoCtx.pause() // videoCtx.exitFullScreen() // } else { // // 关键修改:移除方向参数 // videoCtx.requestFullScreen() // } const videoCtx = uni.createVideoContext('video'+this.index, this) // #ifdef APP-PLUS plus.screen.lockOrientation('portrait-primary') // 临允许横屏 // #endif videoCtx.requestFullScreen() }, handleFullscreen(e) { this.isFullscreen = e.detail.fullScreen // #ifdef APP-PLUS if(!e.detail.fullScreen) { plus.screen.lockOrientation('portrait-primary') } // #endif // #ifdef APP-PLUS && IOS plus.screen.unlockOrientation() plus.navigator.setStatusBarStyle('dark') // #endif }, onPlay() { this.$emit('play', this.index) }, onPause() { this.$emit('pause', this.index) } }, data() { return { isFullscreen: false } } } </script> <style> .video-box{ width: 100%; height: 100vh; /* 强制占满屏幕高度 */ } </style> uniapp 安卓点击视频播放全屏按钮后 也是横屏的 怎么在代码里禁止
07-22
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值