0

我有一个显示流式 rtsp 的应用程序。如何检查它是否结束?缓冲区空了?还要别的吗?

4

2 回答 2

0
  • 套接字已关闭
  • 媒体服务器的控制通道上有什么东西吗?
于 2013-09-09T06:29:30.263 回答
0
private VideoView vidView;
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        vidView = (VideoView) findViewById(R.id.myVideo);

        uri = Uri.parse(RTSP_URL);
        vidView.setMediaController(new MediaController(this));
        vidView.setVideoURI(uri);
        vidView.requestFocus();

        vidView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
            @Override
            public void onPrepared(MediaPlayer mp) {

                Runnable runnable = new Runnable() {
                    @Override
                    public void run() {

                        vidView.start();

                    }
                };
                runOnUiThread(runnable);
            }
        });
        vidView.setOnErrorListener(new MediaPlayer.OnErrorListener() {
            @Override
            public boolean onError(MediaPlayer mp, int what, int extra) {
                Log.d("Error ", what + " " + extra);
                return false;
            }
        });
        vidView.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
            @Override
            public void onCompletion(MediaPlayer mp) {
                Log.d(getClass().getName(), " callback COMPLETE HERE ");

            }
        });


    }
于 2015-09-17T18:50:51.820 回答