0

我需要在增强图像上播放 YouTube 视频。我正在尝试使用 YouTube 播放器 API 在增强图像上播放 YouTube 视频。但是,问题是视频没有显示只有音频正在播放。谁能帮我实现我的要求?

这是我用于 YouTube 播放器视图的 xml 文件。我使用 3rd 方库来加载 YouTube 视频。

<com.pierfrancescosoffritti.androidyoutubeplayer.core.player.views.YouTubePlayerView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/youTubePlayer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:showYouTubeButton="false"
app:videoId="pIAQV0u72iI"
app:showFullScreenButton="false" />

这是我为 YouTube 视频添加的 YouTube 场景形式类。

class SwarmSceneYouTube(val image: AugmentedImage?, val arItemData: ArListData?) :
AugmentedImageNodeGroup() {
    override fun onInit() {
        YouTubeVideoNode().init(anchorNode, this, image, arItemData)
    }
}

class YouTubeVideoNode : AugmentedImageNode(ArResources.youTubeRenderable) {
    override fun initLayout() {
    super.initLayout()
        val youTubePlayer = ArResources.youTubeRenderable.get().view.youTubePlayer
    }
    override fun modifyLayout() {
        super.modifyLayout()
        localRotation = ArResources.youTubeRenderableRotation
    }
}
4

1 回答 1

0

我看到您正在使用特定的库来嵌入视频。

此存储库在过去 17 个月中似乎没有任何更新,但您会看到列出的一些问题与您的问题类似:

最好在这些讨论中添加您的示例。

虽然它没有被标记为已关闭,但最有希望的修复可能是这个注释:

先生,我调试了这个问题,当 Android System WebView 禁用并且 google chrome 工作是默认的 Web 界面时,它会出现。一旦 Android System WebView 启用它就会自动消失

Android WebView 功能可能因设备而异,因此对某些功能的支持可能存在问题。众所周知,这会特别影响 DRM,而 DRM 反过来通常会显示您看到的音频但没有视频播放的症状。看到这个答案:https ://stackoverflow.com/a/47688092/334402

鉴于最近没有活动,最好也检查一下官方的 YouTube API。

于 2021-04-12T08:06:18.557 回答