当前位置:网站首页>The small program rotates the mobile phone to push the stream, and the remote pull stream picture is cut
The small program rotates the mobile phone to push the stream, and the remote pull stream picture is cut
2022-04-21 12:06:00 【jialuhu】
Due to the influence of gravity induction ,Android Small program streaming and rotating mobile phone , The picture pulled from the far end is cropped ; The applet does not open gravity sensing API, Can only be circumvented by :
The current phenomenon :
1、Android Mobile phone horizontal screen shooting , If you do not set the horizontal screen push flow ,PC The streaming picture is incomplete ; For vertical screen shooting, you need to set vertical screen streaming ;
2、iOS Horizontal screen shooting , Do not set the horizontal screen resolution ,PC Pull flow picture is complete . Set the horizontal screen resolution , The picture is incomplete ;
summary : Small program horizontal screen shooting , If you need to pull the stream end to watch the picture completely ,Android Need to set the horizontal screen resolution ,iOS No settings ; For vertical screen troubleshooting of small programs, you need to set vertical screen streaming ;
Android Mobile phone horizontal screen , The picture pulled from the far end :
Before the change :
After modification :
Proposal :
1、 First, through the applet interface wx.getSystemInfo Get the current device is android still ios;
2、 Re pass wx.onDeviceMotionChange Monitor device direction change
① If it is currently android equipment , Set when the mobile phone is horizontal videoOrientation Set to horizontal Push flow ;
Set when the mobile phone is vertical videoOrientation Set to vertica Push flow ;
② If it is currently ios equipment , Is set videoOrientation Set to vertica Push flow ;
This can ensure that the remote streaming picture is not cut
The code snippet is as follows
const that = this
wx.getSystemInfo({
success (res) {
if (res.platform == "ios"){
if (that.data.localVideo) {
console.log(that)
that.setPusherAttributesHandler({videoOrientation: 'vertical'})
}
console.log("111111111")
}else if (res.platform == "android"){
// Monitor device direction change
wx.startDeviceMotionListening({
success(){
wx.onDeviceMotionChange((result) => {
// console.log(" rotate ",result.gamma);
if(result.gamma < -40 || result.gamma > 40){
// Mobile phone horizontal screen
console.log(" Mobile phone horizontal screen use ");
that.setPusherAttributesHandler({videoOrientation: 'horizontal'})
} else{
that.setPusherAttributesHandler({videoOrientation: 'vertical'})
}
})
}
})
}
console.log(" The judgment system ",res.platform)
}
})
版权声明
本文为[jialuhu]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204211201158425.html
边栏推荐
- DR-AP6018-A-wifi6-Access-Point-Qualcomm-IPQ6010-2T2R-2.5G-ETH-port-supporting-5G-celluar-Modem-aluminum-body.
- [BSidesCF 2019]Kookie
- Dynamics CRM 365 在Plugins调用外部接口报错:请求'System.Net.WebPermission,System,Version=4.0.0.0,Culture=neutral,PublicKey=b77a5c5561934e089'类型的权限已失败
- Top stream "fitness blogger" Liu Zhenhong
- Usage Summary of hiredis and rapidjson Libraries
- Teach you to easily solve CSRF Cross Site Request Forgery Attack
- 电脑在指定时间关机的指令代码
- Extract name from given string (string, list, re "zero width assertion")
- L2-003 moon cake (25 points) (greedy)
- 笑死!程序员延寿指南开源了
猜你喜欢

How PHP removes array keys

HMS Core 6.4.0版本发布公告

去中心化VC平台CULTDAO发起对BetaMars项目投票,目前投票正在进行中
![[dark horse morning post] Tao Hong paid 260 million dividends from Zhangting MLM company in three years; Yiling pharmaceutical replied to Lianhua Qingwen dispute: the case has been reported; Tencent v](/img/d7/4671b5a74317a8f87ffd36be2b34e1.jpg)
[dark horse morning post] Tao Hong paid 260 million dividends from Zhangting MLM company in three years; Yiling pharmaceutical replied to Lianhua Qingwen dispute: the case has been reported; Tencent v

上海疫情中,新消费品牌们的坚守、放弃与救赎

骚包的中文字符提取操作(字符串,不用 re ,用 in )

Offline RL Series 4: analysis of the influence of sample complexity on model convergence

IIR second order filter in flight control

JD cloud distributed database stardb successfully completed multi-party localization adaptation certification

虚拟货币已然没有市场,为何还能对一些人产生不小的诱惑?
随机推荐
Introduction to webrtc: 2 Get screen desktop stream using getdisplaymedia
DR-AP6018-A-wifi6-Access-Point-Qualcomm-IPQ6010-2T2R-2.5G-ETH-port-supporting-5G-celluar-Modem-aluminum-body.
Usage Summary of hiredis and rapidjson Libraries
企业官网有啥用?一定要搭建官方网站吗?
The simpler the Oracle database machine is, the more reliable it is. Oracle buried the "colored egg" 11 years ago
Offline RL Series 4: analysis of the influence of sample complexity on model convergence
总有一天,阿里系数据库会将Oracle挤出市场
【软件测试系列十一】《压力测试场景及测试用例模板》
【youcans 的 OpenCV 例程200篇】159. 图像处理之固定阈值法
Chrome开发者工具详解 一
Wordpress Plugin iQ Block Country 1.2.13 通过 Zip Slip 删除任意文件
Static and non-static construction method of parent-child class loading order
海量数据2021年创收4.21亿元,数据库产品毛利率提升8.78%!
精彩联动!OpenMLDB Pulsar Connector原理和实操
马斯克活在旧互联网时代?
[software testing series I] basic knowledge of software testing
STL function usage is continuously updated
[software test series v] software test application form
基于pytorch搭建VGGNet神经网络用于花类识别
Live broadcast of changes in the Jianghu: Li Jiaqi is trapped in a luxury house, Luo Yonghao fades out, and Weiya Sydney helps broadcast it