请选择 进入手机版 | 继续访问电脑版

ADOBE AIR 24+ IOS camera 权限管理

[复制链接]
小浣熊 发表于 2021-1-3 12:03:06 | 显示全部楼层 |阅读模式 打印 上一主题 下一主题
发布的XML节点中插入:
  1.     high    Assets.car   CFBundleIconNameAppIconNSCameraUsageDescriptionYou need camera permission to start broadcasting.NSMicrophoneUsageDescriptionYou need microphone permission to start broadcasting.NSLocationAlwaysUsageDescriptionYou need GPS permission to display location information on the map.NSLocationWhenInUseUsageDescriptionYou need GPS permission to display location information on the map.UIDeviceFamily12]]>
复制代码
e.g.
The icon of iOS 11 was solved.
The camera and microphone permissions are resolved.
This time, I have trouble with Geolocation’s permission.
Added the following to InfoAdditions of app.xml.
NSLocationWhenInUseUsageDescription
You need GPS permission to display location information on the map.
geo_location.requestPermission does not work.
Please look at the Sample Code.
geo_location.locationAlwaysUsePermission=false;
I set to use GPS when using the application.
It seems that it was added from AIR 29, but is there any problem?
--------------------------------Sample----------------------------
  1. import flash.display.Sprite;import flash.display.StageAlign;import flash.display.StageScaleMode;import flash.events.PermissionEvent;import flash.media.Camera;import flash.media.Microphone;import flash.media.Video;import flash.permissions.PermissionStatus;var video:Video;var cam:Camera;var microphone:Microphone;var nc:NetConnection = null;var nsPublish:NetStream = null;       var geo_location;function connectGPS(){if (Geolocation.isSupported){geo_location = new Geolocation();geo_location.locationAlwaysUsePermission=false;//geo_location.setRequestedUpdateInterval(10000);//geo_location.addEventListener(GeolocationEvent.UPDATE,gps_event);if (Geolocation.permissionStatus != PermissionStatus.GRANTED){geo_location.addEventListener(PermissionEvent.PERMISSION_STATUS, function(e:PermissionEvent):void {if (e.status == PermissionStatus.GRANTED){   rtmp_publish();}else{// permission denied}});try {geo_location.requestPermission();//No Good!} catch(e:Error){// another request is in progress}}else{rtmp_publish();}}}///I am correcting the previous sample  /    if (Camera.isSupported)            {                cam = Camera.getCamera();                if (Camera.permissionStatus != PermissionStatus.GRANTED)                {                    cam.addEventListener(PermissionEvent.PERMISSION_STATUS, function(e:PermissionEvent):void {                        if (e.status == PermissionStatus.GRANTED)                        {                            connectCamera();                        }                        else                        {                            // permission denied                        }                    });                    try {                        cam.requestPermission();//OK!                    } catch(e:Error)                    {                        // another request is in progress                    }                }                else                {                    connectCamera();                }            }function connectCamera():void{nc = new NetConnection();nc.connect("rtmp://Streaming_Server_name:1935/liveapplication_name");nc.addEventListener(NetStatusEvent.NET_STATUS, ncOnStatus);}function ncOnStatus(infoObject:NetStatusEvent){//trace("nc: "+infoObject.info.code+" ("+infoObject.info.description+")");if (infoObject.info.code == "NetConnection.Connect.Success"){nsPublish = new NetStream(nc);cam.setMode(640,360, 30);cam.setQuality(0, 70);video = new Video(640, 360);video.attachCamera(cam);addChild(video);if (Microphone.isSupported){microphone = Microphone.getMicrophone();if (Microphone.permissionStatus != PermissionStatus.GRANTED){microphone.addEventListener(PermissionEvent.PERMISSION_STATUS, function(e:PermissionEvent):void {if (e.status == PermissionStatus.GRANTED){connectGPS();}else{// permission denied}});try {microphone.requestPermission();    //OK!} catch(e:Error){// another request is in progress}}else{connectGPS();}}}}function rtmp_publish(){trace("microphone="+Microphone.names);microphone.codec=SoundCodec.NELLYMOSER;microphone.rate=44;microphone.gain=60;microphone.setSilenceLevel(0);nsPublish.attachCamera(cam);nsPublish.attachAudio(microphone);nsPublish.publish("myStream");trace("TEST LIVE");}
复制代码
来源:https://blog.csdn.net/baidu_41821436/article/details/112057037
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则


专注素材教程免费分享
全国免费热线电话

18768367769

周一至周日9:00-23:00

反馈建议

27428564@qq.com 在线QQ咨询

扫描二维码关注我们

Powered by Discuz! X3.4© 2001-2013 Comsenz Inc.( 蜀ICP备2021001884号-1 )