我需要在增强图像上播放 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
}
}