我的
ReactJS
代码面临一个问题,因为我在项目中加入了
react-native-google-cast
库。
The issue is the following :
我想把来自网络的HTTP视频源投到我的Android电视上。我在我的应用程序中添加了
CastButton
,它工作得很好,可以检测到我周围的设备。
但问题是,当我想启动投射到我的安卓电视盒(
在安卓9下
),它失败了,信息如下。
"Mixed Content: The page at 'https://www.gstatic.com/cast/sdk/default_receiver/1.0/app.html?skin=https://www.gstatic.com/eureka/player/0000/skins/cast/skin.css&google_cast_bg=true' was loaded over HTTPS, but requested an insecure video 'XXXX'. This content should also be served over HTTPS."
。
经过在网络上的多次研究,我发现使用这个主题的解决方案应该可以解决问题,但事实并非如此,错误不断出现。(
安卓8:不允许使用明文HTTP流量
).
我发现文件
android/app/build/intermediates/instant_app_manifest/debug/AndroidManifest.xml:4
包含
android:targetSandboxVersion="2"
,但我不能覆盖它,因为它每次重建都会从某个地方重新加载(?
这里是我的AndroidManifest.xml文件。
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.iptvapp"
android:targetSandboxVersion="1"
android:usesCleartextTraffic="true">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:name=".MainApplication"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:allowBackup="false"
android:networkSecurityConfig="@xml/network_security_config"
android:theme="@style/AppTheme">
<meta-data
android:name="com.google.android.gms.cast.framework.OPTIONS_PROVIDER_CLASS_NAME"
android:value="com.reactnative.googlecast.GoogleCastOptionsProvider" />
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
android:launchMode="singleTask"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
</application>
</manifest>