相关疑难解决方法(0)

如何从网址播放视频

我是android开发的初学者,尝试从链接播放视频.但它给出了错误"sorry,we can't play this video".我尝试了很多链接但是对于所有链接它显示相同的错误.

我的代码如下

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();
     }
}
Run Code Online (Sandbox Code Playgroud)

Logcat显示以下错误消息:

04-12 15:04:54.245: ERROR/PlayerDriver(554): HandleErrorEvent: PVMFErrTimeout
Run Code Online (Sandbox Code Playgroud)

android video-streaming android-videoview

40
推荐指数
4
解决办法
14万
查看次数

无法在客户端打开文件,在Android中尝试服务器端错误

我试图通过我的android程序通过其URL播放YouTube视频.我用过setVideoURI(uri); 函数也设置URI,正如stackoverflow中关于此的其他POST所建议的那样.但我得到无法在客户端打开文件,尝试服务器端错误.你能弄清楚我的代码有什么问题吗?

但我可以通过评论代码播放任何本地视频.

这是我的android代码 -

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;
    }
}
Run Code Online (Sandbox Code Playgroud)

这是日志错误 -

  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: …
Run Code Online (Sandbox Code Playgroud)

android android-videoview

11
推荐指数
1
解决办法
4万
查看次数

Android VideoView无法播放视频错误,特别是.mp4

我正在尝试在我的应用程序中播放视频,但我得不能播放此视频错误.我遇到了很多相关的问题.他们已经要求在玩家准备好后开始播放视频.我也是这样做的.但无法弄清楚问题.请在下面找到我的代码.

public class Video extends Activity implements MediaPlayer.OnPreparedListener, MediaPlayer.OnErrorListener {

public VideoView vidPlayer;

@Override
protected void onCreate(Bundle savedInstanceState) {

    setup();
    activateVideoPlayer();
}

public void setup() {
    setContentView(R.layout.step_video);        
    vidPlayer = (VideoView) findViewById(R.id.videoPlayer);
    String playableUrl = "http://teststreaming7v.s3.amazonaws.com/public/7515/1374782317346-beagle_puppy_howl_640x360_448_main.mp4";

}

@Override
public void onPrepared(final MediaPlayer mediaPlayer) {
    mediaPlayer.setLooping(false);
    mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
        startPlayer();
    videoLoaded = true;
    mediaPlayer.setOnBufferingUpdateListener(new MediaPlayer.OnBufferingUpdateListener() {
        // show updated information about the buffering progress
        public void onBufferingUpdate(MediaPlayer mp, int percent) {
            Log.d(this.getClass().getName(), "percent: " + percent);

        }
    });

    mediaPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {

        public …
Run Code Online (Sandbox Code Playgroud)

video android android-videoview

7
推荐指数
1
解决办法
1万
查看次数