在Android上播放http视频失败:无法打开

时间:2019-07-10 09:10:04

标签: android video

这是示例视频: https://www.hf.uio.no/imv/english/research/projects/sma/subprojects/Soundsaber/videos/soundsaber3-1.mov

我想开发一个页面来加载此示例视频。

运行时,Android Studio的控制台提示我无法打开此视频:

W/MediaPlayer: Couldn't open https://www.hf.uio.no/imv/english/research/projects/sma/subprojects/Soundsaber/videos/soundsaber3-1.mov: java.io.FileNotFoundException: No content provider: https://www.hf.uio.no/imv/english/research/projects/sma/subprojects/Soundsaber/videos/soundsaber3-1.mov
V/MediaHTTPService: MediaHTTPService(android.media.MediaHTTPService@a5821b9): Cookies: null
V/MediaHTTPService: makeHTTPConnection: CookieManager created: java.net.CookieManager@f5d355f

请告诉我处理方法吗?还是我需要使用新的视频库来执行此操作?

这是我的工作:

private lateinit var mc : MediaController
private lateinit var thisVideo  : VideoView

override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)

    setContentView(R.layout.activity_video)
    supportActionBar?.setDisplayHomeAsUpEnabled(true)
    supportActionBar?.hide()

    val videoLink = intent.getStringExtra("video_link")
    if(videoLink.isNotEmpty()){
        val uri = Uri.parse(videoLink)
        thisVideo = findViewById<VideoView>(R.id.videoView)

        thisVideo.setVideoPath(videoLink)
        mc = MediaController(this )
        thisVideo.setMediaController(mc)
        thisVideo.start()
    }
}

0 个答案:

没有答案