使用 VideoView 流式传输或渐进式下载视频 [英] Using VideoView for streaming or progressive-download video

查看:43
本文介绍了使用 VideoView 流式传输或渐进式下载视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对如何使用 VideoView 播放视频感到困惑:从本地文件、渐进式下载和流式传输.

I'm confused about how VideoView can be used to play video: from a local file, as progressive download and streaming.

这个例子适用于我(至少在 1.5 和 2.0 上),下载文件并在本地播放.

This example work for me (on 1.5 and 2.0 at least) by downloading the file and playing it locally.

但是是否有必要在播放前下载视频:是否可以像 API 示例中的 VideoViewDemo 那样,以渐进式下载或流式播放方式播放视频,只需使用 setVideoPath 或 setVideoURI?

But is it necessary to download the video before playing: is it possible to play video as progressive download, or by streaming, simply by using setVideoPath or setVideoURI, as in VideoViewDemo in the API samples?

VideoViewDemo 代码建议使用 setVideoURI 进行流式传输,但我不清楚应该使用哪种 URL.有人有可以使用 VideoViewDemo 代码流式传输到 Android 模拟器的视频的示例 URL 吗?

The VideoViewDemo code suggests using setVideoURI for streaming, but I'm not clear what kind of URL I should be using. Does someone have an example URL for a video that can be streamed to the Android emulator using the VideoViewDemo code?

渐进式下载可以与 VideoViewDemo 一起使用吗?我收到一条抱歉,无法播放此视频"消息,使用 setVideoPath 和 URL 可以很好地与上面链接的博客示例配合使用.(这是模拟器中的问题吗?我试过 1.5 和 2.0.)

Can progressive download be used with VideoViewDemo? I get a 'sorry, this video cannot be played' message using setVideoPath with URLs that work fine with the blog example linked to above.(Is this a problem in the emulator? I've tried 1.5 and 2.0.)

我在网上找到了很多示例和文档,但到目前为止,没有一个能真正回答这个问题.

I've found a lot of examples and documentation online but, so far, nothing that really answers this question.

推荐答案

是否可以将视频播放为渐进式下载,或通过流媒体,只需使用 setVideoPath 或setVideoURI,如在 VideoViewDemo 中API 示例?

is it possible to play video as progressive download, or by streaming, simply by using setVideoPath or setVideoURI, as in VideoViewDemo in the API samples?

应该的.它当然适用于 MediaPlayer,而 VideoView 只是围绕 MediaPlayer 和一个 SurfaceView 的约 200 行包装器.

It should. It certainly works with MediaPlayer, and VideoView is just a ~200 line wrapper around MediaPlayer and a SurfaceView.

VideoViewDemo 代码建议使用setVideoURI 用于流式传输,但我不是明确我应该是什么样的 URL使用.

The VideoViewDemo code suggests using setVideoURI for streaming, but I'm not clear what kind of URL I should be using.

http://rtsp:// 可以工作,前提是视频编码正确.

http:// and rtsp:// can work, if the video was encoded properly.

有人有一个示例 URL 吗?可以流式传输的视频Android模拟器使用VideoViewDemo 代码?

Does someone have an example URL for a video that can be streamed to the Android emulator using the VideoViewDemo code?

此视频适用于 MediaPlayer,但 Nexus One 除外.

This video works with MediaPlayer, except on the Nexus One.

编辑:实际上,该链接也适用于 Nexus One.

EDIT: Actually, that link works with the Nexus One as well.

这篇关于使用 VideoView 流式传输或渐进式下载视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆