gpt4 book ai didi

android - 音频流的 PhoneGap Android 权限问题

转载 作者:搜寻专家 更新时间:2023-11-01 09:21:12 25 4
gpt4 key购买 nike

我的应用程序几乎完成了 phonegap我确实在 iOS 上开发了应用程序,现在我需要为 Android 导出和生成 apk

是几年前应用程序的 v2 应用程序我正在使用 adobe phonegap build 生成 apk

较旧的应用程序工作正常,当我从 Play 商店下载并安装时,它询问我是否授予“照片/多媒体元素/文件”权限

如果我点击播放按钮流式传输正确开始,在新应用程序上它不会播放音频流,当我从保管箱安装应用程序时它不会流式传输音频

我正在使用 OnePlus 6t 作为测试设备

开始音频流我使用这个代码(我在以前的版本中做的广告)

myaudio = new Audio('http://mystream.net:1935/live/myapp.stream/playlist.m3u8');
myaudio.id = 'playerMyAdio';
myaudio.play()

我尝试添加

<preference name="android.permission.INTERNET" value="none" />
<preference name="android.permission.MEDIA_CONTENT_CONTROL" value="none" />

在其他问题中找到,但它不起作用

phonegap -v 返回 8.2.2

这是我的config.xml,我猜是权限问题

<?xml version='1.0' encoding='utf-8'?>
<widget id="it.myapp.app" version="2.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0">
<name>myapp</name>
<description>
myapp
</description>
<author email="info@myapp.com" href="http://www.myapp.com">
MyAPP
</author>
<content src="index.html" />
<preference name="Orientation" value="portrait" />
<preference name="DisallowOverscroll" value="true" />
<preference name="android-minSdkVersion" value="19" />
<preference name="BackupWebStorage" value="none" />
<preference name="SplashScreen" value="splash" />
<preference name="SplashScreenDelay" value="100" />
<preference name="AutoHideSplashScreen" value="true" />
<preference name="StatusBarStyle" value="lightcontent" />
<platform name="android">
<preference name="ShowSplashScreenSpinner" value="false" />
<preference name="android.permission.INTERNET" value="none" />
<preference name="android.permission.MEDIA_CONTENT_CONTROL" value="none" />
</platform>
<platform name="android">
<icon qualifier="ldpi" src="res/icons/android/icon-36-ldpi.png" />
<icon qualifier="mdpi" src="res/icons/android/icon-48-mdpi.png" />
<icon qualifier="hdpi" src="res/icons/android/icon-72-hdpi.png" />
<icon qualifier="xhdpi" src="res/icons/android/icon-96-xhdpi.png" />
<icon qualifier="xxhdpi" src="res/icons/android/icon-144-xxhdpi.png" />
<icon qualifier="xxxhdpi" src="res/icons/android/icon-192-xxxhdpi.png" />
<splash qualifier="ldpi" src="res/screens/android/screen-ldpi-portrait.png" />
<splash qualifier="mdpi" src="res/screens/android/screen-mdpi-portrait.png" />
<splash qualifier="hdpi" src="res/screens/android/screen-hdpi-portrait.png" />
<splash qualifier="xhdpi" src="res/screens/android/screen-xhdpi-portrait.png" />
</platform>
<platform name="ios">
<icon height="20" platform="ios" src="res/icons/ios/icon-20.png" width="20" />
<icon height="40" platform="ios" src="res/icons/ios/icon-20@2x.png" width="40" />
<icon height="60" platform="ios" src="res/icons/ios/icon-20@3x.png" width="60" />
<icon height="29" platform="ios" src="res/icons/ios/icon-29.png" width="29" />
<icon height="58" platform="ios" src="res/icons/ios/icon-29@2x.png" width="58" />
<icon height="87" platform="ios" src="res/icons/ios/icon-29@3x.png" width="87" />
<icon height="80" platform="ios" src="res/icons/ios/icon-40@2x.png" width="80" />
<icon height="120" platform="ios" src="res/icons/ios/icon-40@3x.png" width="120" />
<icon height="50" platform="ios" src="res/icons/ios/icon-50.png" width="50" />
<icon height="100" platform="ios" src="res/icons/ios/icon-50@2x.png" width="100" />
<icon height="57" platform="ios" src="res/icons/ios/icon-57.png" width="57" />
<icon height="114" platform="ios" src="res/icons/ios/icon-57@2x.png" width="114" />
<icon height="180" platform="ios" src="res/icons/ios/icon-60@3x.png" width="180" />
<icon height="72" platform="ios" src="res/icons/ios/icon-72.png" width="72" />
<icon height="144" platform="ios" src="res/icons/ios/icon-72@2x.png" width="144" />
<icon height="76" platform="ios" src="res/icons/ios/icon-76.png" width="76" />
<icon height="152" platform="ios" src="res/icons/ios/icon-76@2x.png" width="152" />
<icon height="167" platform="ios" src="res/icons/ios/icon-83.5@2x.png" width="167" />
<icon height="1024" platform="ios" src="res/icons/ios/icon-1024.png" width="1024" />
<splash height="480" platform="ios" src="res/screens/ios/screen-iphone-portrait.png" width="320" />
<splash height="960" platform="ios" src="res/screens/ios/screen-iphone-portrait-2x.png" width="640" />
<splash height="1136" platform="ios" src="res/screens/ios/screen-iphone-portrait-568h-2x.png" width="640" />
<splash height="1334" platform="ios" src="res/screens/ios/screen-iphone-portrait-667h.png" width="750" />
<splash height="2208" platform="ios" src="res/screens/ios/screen-iphone-portrait-736h.png" width="1242" />
<splash height="1024" platform="ios" src="res/screens/ios/screen-ipad-portrait.png" width="768" />
<splash height="2048" platform="ios" src="res/screens/ios/screen-ipad-portrait-2x.png" width="1536" />
<splash height="320" platform="ios" src="res/screens/ios/screen-iphone-landscape.png" width="480" />
<splash height="640" platform="ios" src="res/screens/ios/screen-iphone-landscape-2x.png" width="960" />
<splash height="640" platform="ios" src="res/screens/ios/screen-iphone-landscape-568h-2x.png" width="1136" />
<splash height="750" platform="ios" src="res/screens/ios/screen-iphone-landscape-667h.png" width="1334" />
<splash height="1242" platform="ios" src="res/screens/ios/screen-iphone-landscape-736h.png" width="2208" />
<splash height="768" platform="ios" src="res/screens/ios/screen-ipad-landscape.png" width="1024" />
<splash height="1536" platform="ios" src="res/screens/ios/screen-ipad-landscape-2x.png" width="2048" />
<splash height="2732" platform="ios" src="res/screens/ios/Default@2x~universal~anyany.png" width="2732" />
</platform>
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<platform name="android">
<allow-intent href="market:*" />
</platform>
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
</platform>
<plugin name="cordova-plugin-whitelist" spec="^1.3.3" />
<plugin name="cordova-plugin-x-socialsharing" source="npm" version="5.4.0" />
<plugin name="nl.kingsquare.cordova.background-audio" spec="^1.0.1" />
<plugin name="cordova-plugin-splashscreen" spec="^5.0.2" />
<plugin name="cordova-plugin-statusbar" spec="^2.4.2" />
<engine name="browser" spec="^5.0.4" />
<engine name="ios" spec="^4.5.5" />
<engine name="android" spec="~7.1.4" />
</widget>

最佳答案

OnePlus 6T 似乎运行当前版本的 Android 操作系统,默认情况下限制 HTTP 流量。

对于 Cordova,您需要像这样引用 network_security_config.xml:

<platform name="android">
<edit-config xmlns:android="http://schemas.android.com/apk/res/android" file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application">
<application android:networkSecurityConfig="@xml/network_security_config" />
</edit-config>
<resource-file src="network_security_config.xml" target="app/src/main/res/xml/network_security_config.xml" />
</platform>

network_security_config.xml 需要排除这个:

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<domain-config cleartextTrafficPermitted="true">
<domain>mystream.net</domain>
</domain-config>
</network-security-config>

关于android - 音频流的 PhoneGap Android 权限问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55262037/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com