【问题标题】:Visual Studio 2019 for Mac Android App Webview Not Playing Youtube VideoVisual Studio 2019 for Mac Android App Webview 不播放 Youtube 视频
【发布时间】:2020-09-17 00:03:20
【问题描述】:

我正在为 iOS 和 Android 编写一个跨平台的 XForms 应用程序。我在 xaml 中有一个嵌入式 WebView 控件。我传入的 URL 是一个包含 YouTube 视频链接的页面。

当我在 iOS 上运行应用程序时,无论是真实设备还是模拟器,一切正常。

当我在带有 Android 10 的 Pixel 2 上运行该应用程序时,会播放音频但没有视频。这只是一个黑屏。

我正在使用 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, color 0x7fa30c06, rotation 0, 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

【问题讨论】:

  • 在 Android 网络视图中有很多关于 Youtube 的现有帖子 - 你读过其中的任何一个吗? google.com/…
  • 其实我已经做了很多谷歌搜索。我没有做的只是搜索stackoverflow。那是我的错误。我已经阅读了几件事。我想我的搜索技巧不如你。如果我按去年的所有内容过滤您的搜索,那么第一个答案就是它。对于发现这个的其他人,这是 androidmanifest.xml 中的应用程序设置
  • 如果您的问题已经解决,您可以在答案中发布并接受它。

标签: android xamarin video


【解决方案1】:

在 cmets 中,您可以看到 Jason 搜索了 google。我进行了搜索并将其限制为 1 年,最佳答案回答了我的问题。这里是:

Youtube videos shown black screen in webView when click on play button

这是关于更改 AndroidManifest.xml 的第 5 条评论:

“我找到了。真正的原因在清单文件中。只需从应用程序标签中删除这些行即可。android:hardwareAccelerated="false" android:largeHeap="true" 完成。Youtube 视频不显示黑屏——Khadija Hameed 2019 年 9 月 26 日 11:41"

【讨论】:

    猜你喜欢
    • 2013-07-13
    • 2014-02-10
    • 2012-12-14
    • 2012-06-07
    • 2017-12-23
    • 2012-09-24
    • 2013-07-20
    • 2016-10-25
    • 1970-01-01
    相关资源
    最近更新 更多