简体   繁体   English

使用Android VideoView从VLC播放器到AVD的HTTP流

[英]HTTP streaming from VLC player to AVD using Android VideoView

I'm trying to streaming a 3gp video on android emulator (v. 2.3.3 - Eclipse IDE). 我正在尝试在Android模拟器(v。2.3.3-Eclipse IDE)上流式传输3gp视频。 I prepare a stream with VLC media player using HTTP on port 9090 without any transcoding. 我在端口9090上使用HTTP使用VLC媒体播放器准备了流,而没有任何转码。 For testing streaming I open a new instance of VLC and connecting on my local ip (192.168.1.107:9090) I see the video without any problems. 为了测试流媒体,我打开了一个新的VLC实例,并连接到我的本地IP(192.168.1.107:9090),我看到了视频,没有任何问题。 Now I try on Android using this code on onCreate(Bundle) method of my Activity class: 现在,我在Activity类的onCreate(Bundle)方法上使用以下代码在Android上进行尝试:

VideoView video = (VideoView) findViewById(R.id.video);
String uri = "http://192.168.1.107:9090";
video.setVideoURI(Uri.parse(uri));
video.setMediaController(new MediaController(this));
video.requestFocus();
video.start();

but when application starts, appears this message: "Impossible to reproduce the video". 但是当应用程序启动时,出现以下消息:“无法复制视频”。 Here the logcat: 这里的日志:

D/MediaPlayer(454): Couldn't open file on client side, trying server side
E/MediaPlayer(454): error (1, -2147483648)
E/MediaPlayer(454): Error (1,-2147483648)
D/VideoView(454): Error: 1,-2147483648

I've tried also with the URI 10.0.2.2:9090 with the same result and 127.0.0.1:9090 with the same message and the error range (1, -111) 我也尝试了URI 10.0.2.2:9090和7.0.0.1:9090的结果相同,消息和错误范围是127.0.0.1:9090(1,-111)

Note that the same video works fine if I play it on local: 请注意,如果我在本地播放同一视频,效果很好:

String uri = "android.resource://" + getPackageName() + "/" + R.raw.myvideo;

I use Windows 7 x64 . 我使用Windows 7 x64

Edit: I've also tried to upload the video on the public folder of my Dropbox with the same error, but using the original link it works! 编辑:我也曾尝试将视频上传到我的Dropbox的公用文件夹中,但存在相同的错误,但是使用原始链接就可以了! Is there a problem with my local network? 我的本地网络有问题吗? What does it mean the error (1,x)? 误差(1,x)是什么意思?

Edit2: I've started a XAMPP session on my local network and I've put the video on a folder. Edit2:我已经在本地网络上开始了XAMPP会话,并将视频放置在文件夹中。 The ip address is something like this: IP地址是这样的:

String uri = "http://192.168.1.107:8080/myfolder/myvideo.3gp";

and it works, even if this is not properly streaming, but something like active download (as the example on the web in my first edit). 即使它没有正确流式传输,也可以正常工作,但它可以进行主动下载(例如我第一次编辑时在网上的示例)。

Have you checked that your local web server delivers the video with the correct Content-Type (or mime type) set in the HTTP response header? 您是否检查过本地Web服务器是否提供了在HTTP响应标头中设置了正确的Content-Type (或mime类型)的视频?

Your original link uses Content-Type: video/3gpp 您的原始链接使用Content-Type: video/3gpp

For VLC you can specify the content or mime type on the options page. 对于VLC,您可以在选项页面上指定内容或MIME类型。 According to the documentation you have to edit the option string and add 根据文档,您必须编辑选项字符串并添加

:mime=video/3gpp

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM