Android媒体播放器无法播放RTSP流投掷错误(100,0)

时间:2012-04-02 09:45:51

标签: android media-player android-videoview rtsp wowza

我正在尝试使用视频视图播放rtsp流: -

@Override
    protected void onCreate(Bundle savedInstanceState) {
        HEADER_BLOCK = true;
        this.requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.video_view);
        super.onCreate(savedInstanceState);

        progressDialog = ProgressDialog.show(this, "Loading", "Opening video...", true);
        mediaController = new MediaController(VideoStreamingActivity.this);
        videoView = (VideoView) findViewById(R.id.myvideoview);
        videoView.setMediaController(mediaController);
        videoView.setVideoURI(Uri.parse(streamerUrl));
        videoView.setOnPreparedListener(new OnPreparedListener() {
            @Override
            public void onPrepared(MediaPlayer mp) {
                progressDialog.dismiss();
                videoView.start();
                startTime = startTime * 60000;
                videoView.seekTo(Integer.parseInt(String.valueOf(startTime).substring(0, String.valueOf(startTime).indexOf("."))));
                mediaController.show();
            }
        });

        videoView.setOnErrorListener(new OnErrorListener() {
            @Override
            public boolean onError(MediaPlayer mp, int what, int extra) {
                progressDialog.dismiss();
                if(what==1 && extra==-1){
                    Toast.makeText(VideoStreamingActivity.this,
                            "Sorry!! unable to play the video since the video not compatible with your android player.", 
                            Toast.LENGTH_LONG).show();
                } else {
                    Toast.makeText(VideoStreamingActivity.this,
                            "Unable to play selected video", Toast.LENGTH_LONG).show();
                }
                VideoStreamingActivity.super.onBackPressed();
                return true;
            }
        });
    }

'streamerUrl'是从wowza服务器生成的正确的rtsp url ...但是在logcat中我收到了以下错误。

04-02 09:22:41.476: D/VideoView(9178): onMeasure()
04-02 09:22:41.476: I/VideoView(9178):     Setting size: 320x221
04-02 09:22:41.484: D/VideoView(9178): onMeasure()
04-02 09:22:41.484: I/VideoView(9178):     Setting size: 320x221
04-02 09:22:41.546: V/GoogleAnalyticsTracker(9178): HTTP Response Code: 200
04-02 09:22:41.578: I/MediaPlayer(9178): path is null
04-02 09:22:41.578: D/MediaPlayer(9178): Couldn't open file on client side, trying server side
04-02 09:22:41.679: D/VideoView(9178): onMeasure()
04-02 09:22:41.679: I/VideoView(9178):     Setting size: 320x221
04-02 09:22:41.679: D/VideoView(9178): onMeasure()
04-02 09:22:41.679: I/VideoView(9178):     Setting size: 320x221
04-02 09:22:50.210: W/AudioSystem(9178): AudioFlinger server died!
04-02 09:22:50.210: W/IMediaDeathNotifier(9178): media server died
04-02 09:22:50.210: E/MediaPlayer(9178): error (100, 0)
04-02 09:22:50.210: E/MediaPlayer(9178): Error (100,0)
04-02 09:22:50.210: D/VideoView(9178): Error: 100,0

谁能告诉我们发生什么事?

1 个答案:

答案 0 :(得分:0)

记得在manifest.xml文件中添加互联网访问权限:

<uses-permission android:name="android.permission.INTERNET" />

你可以通过尝试来测试rtsp视频流:

rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov

如果它仍然不起作用,请让我知道问题是什么