Android Studio 上的 Youtube 视频 link

Youtube Video link on Android Studio

我正在显示来自 firebase 的数据库,我想用 YouTube link 替换图像或只在应用程序上显示视频。另外,我正在为 recyclerview 使用卡片视图。如果我想在我的锻炼数据库中将 link 保存为“视频”,我将如何实现?

要在您的 android 应用程序中显示 YouTube 视频,请查看此库: android youtube player github

您只需将视频 ID 添加到此视图,它就会显示来自 youtube 的视频:

<com.pierfrancescosoffritti.androidyoutubeplayer.core.player.views.YouTubePlayerView
        android:id="@+id/youtube_player_view"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        
        app:videoId="S0Q4gqBUs7c"
        app:autoPlay="true" />