无法在客户端打开文件,试图在Android的服务器端错误 [英] Couldn't open file on client side, trying server side Error in Android

查看:98
本文介绍了无法在客户端打开文件,试图在Android的服务器端错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图用我的Andr​​oid程序,以发挥YouTube视频可以通过URL。 我已经使用setVideoURI(URI);功能还设置URI建议的那样,在计算器对此其他职位。 但我在客户端获得的无法打开文件,试图服务器端错误。 能否请你弄清楚什么是与我的code中的问题。

I have tried to play a youtube video by its URL by my android program. I have used setVideoURI(uri); function also to set URI, as suggested by other POSTs in stackoverflow regarding this. But I am getting Couldn't open file on client side, trying server side error. Can you please figure out what is the problem with my code.

不过,我可以通过评论code播放任何本地视频。

But I am able to play any local video by commented code.

下面是我的Andr​​oid code -

Here is my android code-

public class VideoActivity extends Activity {

    //MediaPlayer song= new MediaPlayer();

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_video);

        VideoView videoView = (VideoView)this.findViewById(R.id.VVSimpleVideo);
        MediaController mc = new MediaController(this);
        mc.setAnchorView(videoView);
        mc.setMediaPlayer(videoView);
        videoView.setMediaController(mc);
        //String _path = "mnt/sdcard/Movies/MyCameraApp/video6.mp4";
        String _path = "http://www.youtube.com/watch?v=E43mgXNl0xc";
        Uri uri=Uri.parse(_path);
        videoView.setVideoURI(uri);
       //videoView.setVideoPath(_path);

        videoView.requestFocus();
        videoView.start();

    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_video, menu);
        return true;
    }
}

下面是日志错误 -

Here is the Log Error-

  10-11 04:51:23.480: D/MediaPlayer(4714): Couldn't open file on client side, trying server side
10-11 04:51:26.130: E/MediaPlayer(4714): error (1, -2147483648)
10-11 04:51:26.130: E/MediaPlayer(4714): Error (1,-2147483648)
10-11 04:51:26.130: D/VideoView(4714): Error: 1,-2147483648
10-11 04:51:26.190: D/dalvikvm(4714): GC_CONCURRENT freed 174K, 4% free 6785K/7047K, paused 4ms+3ms

在此先感谢。

Thanks in Advance.

推荐答案

一旦你得到了你管网址...,从Url.See子串VIDEO_ID下面的例子中我已经给了。

Once you get the You tube url..., Substring the Video_ID from the Url.See the example below i have given.

一旦你的rtsp链接,你可以在VideoView的这是例子

once you get the rtsp link you can play video in VideoView Here is example.

例如:如果这个环节是视频 http://www.youtube.com/watch ?V = E43mgXNl0xc

For example: If this link is the video http://www.youtube.com/watch?v=E43mgXNl0xc

然后 E43mgXNl0xc 是VIDEO_ID。

Then E43mgXNl0xc is the Video_ID.

使用该视频ID在videoview播放视频。

Use this video id to play video in videoview.

请参考以下两个链接:

链接1

链接2

一旦你的rtsp链接,你可以在VideoView玩。

Once you get the rtsp link you can play it in VideoView.

还检查我的答案<一href="http://stackoverflow.com/questions/6937615/how-to-play-youtube-video-on-videoview/11185129#11185129">Here.

这篇关于无法在客户端打开文件,试图在Android的服务器端错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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