使用 Kotlin 离线播放视频

问题描述

我正在使用 Axel Nennker enter link description here

的示例 VideoPlayer

当然,在线运行完美,但我无法播放 res 目录/raw 目录/looping.mp4 中的离线视频?

对于在线我使用:

val mediaCatalog: List<MediaDescriptionCompat> = listof(
with(MediaDescriptionCompat.Builder()) {
    setDescription("WEBM loaded over HTTP")
    setMediaId("1")
    // License - https://peach.blender.org/download/
    setMediaUri(Uri.parse("https://cdn.videvo.net/videvo_files/video/free/2016-01/small_watermarked/Forest_15_4_Videvo_preview.webm"))
    setTitle("Forest")
    setSubtitle("Streaming video")
    build()
},

离线我使用:

    with(MediaDescriptionCompat.Builder()) {
    setDescription("MP4 loaded localy")
    setMediaId("2")
    val packageName = "com.example.android.videoplayersample"
    setMediaUri(Uri.parse("android.resource://$packageName/${R.raw.looping}"))
    setTitle("Looping")
    setSubtitle("Streaming audio")
    build()
}

有人可以帮我解决给我一个提示吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)