Can someone help me, how to load video on my viewholder ? it is possible or not ? if possible how to load
interface DummyMusicDataSource {
fun getMusicData(context: Context): List<Music>
}
class DummyMusicDataSourceImpl() : DummyMusicDataSource {
override fun getMusicData(context: Context): List<Music> {
return mutableListOf(
Music(
title = "title",
imgUrl = "https://raw.githubusercontent.com/ryhanhxx/img_asset/main/IMG_MATERI_3.jpg",
desc = context.getString(R.string.desc_materi_1),
videoUrl = "https://www.youtube.com/watch?v=XpwWeAsXnvA",
),
)
}
}
And this is my viewholder, how to show/play the video from url on video player on my project, someone help me :)
private fun showMusicData(music: Music?) {
music?.apply {
binding.ivImg.load(this.imgUrl) {
crossfade(true)
}
// TODO: how to load youtube url video...
binding.tvTitle.text = this.title
binding.tvDesc.text = this.desc
}
}