如何发挥从网址视频 [英] how to play video from url

查看:133
本文介绍了如何发挥从网址视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是初学android开发,并尝试从链接播放视频。但它给错误对不起,我们无法播放此视频。我试过很多的联系,但所有链接的显示同样的错误。

我的code是以下

 公共类VideoDemo延伸活动{

        私有静态最后弦乐路径=htt​​p://demo.digi-corp.com/S2LWebservice/Resources/SampleVideo.mp4;
 私人VideoView视频;
 私人的MediaController CTLR;
 @覆盖
 公共无效的onCreate(包冰柱){
            super.onCreate(冰柱);
            。getWindow()和setFormat(PixelFormat.TRANSLUCENT);
            的setContentView(R.layout.videoview);

            视频=(VideoView)findViewById(R.id.video);
            video.setVideoPath(路径);

            CTLR =新的MediaController(本);
            ctlr.setMediaPlayer(视频)
            video.setMediaController(CTLR);
            video.requestFocus();
     }
}
 


LogCat中显示以下错误信息:

  04-12 15:04:54.245:ERROR / PlayerDriver(554):HandleErrorEvent:PVMFErrTimeout
 

解决方案

它是与你的链接和内容。请尝试以下两个链接:

 字符串路径=htt​​p://www.ted.com/talks/download/video/8584/talk/761;
    字符串PATH1 =htt​​p://commonsware.com/misc/test2.3gp;

    开放的我们的uri = Uri.parse(路径1);

    VideoView视频=(VideoView)findViewById(R.id.VideoView01);
    video.setVideoURI(URI);
    video.start();
 

开始路径1,它是一个小重量轻的视频流,然后尝试在路径,这是一个更高的分辨率比路径1,一个完美的高分辨率的手机。

I am beginner in android development and try to play video from link. But it's giving error "sorry,we can't play this video". I tried so many links but for all links its show same error.

My code is the following

public class VideoDemo extends Activity {

        private static final String path ="http://demo.digi-corp.com/S2LWebservice/Resources/SampleVideo.mp4";
 private VideoView video;
 private MediaController ctlr;
 @Override
 public void onCreate(Bundle icicle) {
            super.onCreate(icicle);
            getWindow().setFormat(PixelFormat.TRANSLUCENT);
            setContentView(R.layout.videoview);

            video = (VideoView) findViewById(R.id.video);
            video.setVideoPath(path);

            ctlr = new MediaController(this);
            ctlr.setMediaPlayer(video);
            video.setMediaController(ctlr);
            video.requestFocus();
     }
}


Logcat shows following error message:

04-12 15:04:54.245: ERROR/PlayerDriver(554): HandleErrorEvent: PVMFErrTimeout

解决方案

It has something to do with your link and content. Try the following two links:

    String path="http://www.ted.com/talks/download/video/8584/talk/761";
    String path1="http://commonsware.com/misc/test2.3gp";

    Uri uri=Uri.parse(path1);

    VideoView video=(VideoView)findViewById(R.id.VideoView01);
    video.setVideoURI(uri);
    video.start();

Start with "path1", it is a small light weight video stream and then try the "path", it is a higher resolution than "path1", a perfect high resolution for the mobile phone.

这篇关于如何发挥从网址视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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