如何解决适用于Mac的Visual Studio 2019 Android应用程序Webview无法播放Youtube视频
我正在为iOS和Android编写跨平台XForms应用程序。我在xaml中有一个嵌入式WebView控件。我要传递的URL是带有YouTube视频链接的页面。
当我在真实设备或模拟器上的iOS上运行该应用程序时,一切正常。
当我在装有Android 10的Pixel 2上在Android上运行该应用程序时,会播放音频,但没有视频。只是黑屏。
我正在使用VS2019 for Mac和目标api 29。
我在调试窗口中确实得到了一些有趣的输出:
[VideoCapabilities] Unrecognized profile 2130706433 for video/avc
[VideoCapabilities] Unrecognized profile 2130706434 for video/avc
[VideoCapabilities] Unrecognized profile 2130706433 for video/avc
[VideoCapabilities] Unrecognized profile 2130706434 for video/avc
[VideoCapabilities] Unrecognized profile 2130706433 for video/avc
[VideoCapabilities] Unrecognized profile 2130706434 for video/avc
[] PlayerBase::PlayerBase()
[cr_MediaCodecBridge] create MediaCodec video decoder,mime video/avc
[] TrackPlayerBase::TrackPlayerBase()
[libOpenSLES] Emulating old channel mask behavior (ignoring positional mask 0x3,using default mask 0x3 based on channel count of 2)
[OMXClient] IOmx service obtained
[VideoCapabilities] Unrecognized profile 2130706433 for video/avc
[VideoCapabilities] Unrecognized profile 2130706434 for video/avc
[MediaCodec] MediaCodec will operate in async mode
[SurfaceUtils] connecting to surface 0x77fd67a010,reason connectToSurface
[MediaCodec] [OMX.qcom.video.decoder.avc] setting surface generation to 10594305
[SurfaceUtils] disconnecting from surface 0x77fd67a010,reason connectToSurface(reconnect)
[SurfaceUtils] connecting to surface 0x77fd67a010,reason connectToSurface(reconnect)
[SurfaceUtils] set up nativeWindow 0x77fd67a010 for 426x240,color 0x7fa30c06,rotation 0,usage 0x20002900
[Gralloc3] allocator 3.x is not supported
[SurfaceUtils] set up nativeWindow 0x77fd67a010 for 432x240,usage 0x20002900
[NdkImageReader] acquireImageLocked: Overriding buffer format YUV_420_888 to 0x7fa30c06.
[AudioManager] Use of stream types is deprecated for operations other than volume control
[AudioManager] See the documentation of requestAudioFocus() for what to use instead with android.media.AudioAttributes to qualify your playback use case
[chromium] [ERROR:web_contents_delegate.cc(224)] WebContentsDelegate::CheckMediaAccessPermission: Not supported.
[chromium] [ERROR:web_contents_delegate.cc(224)] WebContentsDelegate::CheckMediaAccessPermission: Not supported.
[CameraManagerGlobal] Connecting to camera service
[cr_media] Requires MODIFY_AUDIO_SETTINGS and RECORD_AUDIO. No audio device will be available for recording
解决方法
在评论中,您可以看到Jason搜索了google。我进行了搜索并将搜索范围限制为1年,最重要的答案回答了我的问题。在这里:
Youtube videos shown black screen in webView when click on play button
这是关于更改AndroidManifest.xml的第五条评论:
“我找到了它。真正的原因在清单文件中。只需从应用程序标记中删除这些行即可。android:hardwareAccelerated =“ false” android:largeHeap =“ true”完成。Youtube视频未显示黑屏–卡迪亚·哈默德(Khadija Hameed)19年9月26日在11:41
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。