Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/181.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
vlc android sdk-无法查看RTSP实时视频_Android_Vlc_Libvlc_Vlc Android - Fatal编程技术网

vlc android sdk-无法查看RTSP实时视频

vlc android sdk-无法查看RTSP实时视频,android,vlc,libvlc,vlc-android,Android,Vlc,Libvlc,Vlc Android,我一直在开发一个Android应用程序,通过RTSP显示实时流媒体视频。 假设我有一个运行良好的RTSP服务器,它可以传递h264数据包,并查看我们应该连接到的流 因此,我尝试使用本机MediaPlayer\VideoView,但没有成功(视频在播放2-3秒后被卡住,因此我加载了mrmaffen的vlc android sdk(可以找到),并使用以下代码: ArrayList<String> options = new ArrayList<String&

我一直在开发一个Android应用程序,通过RTSP显示实时流媒体视频。 假设我有一个运行良好的RTSP服务器,它可以传递h264数据包,并查看我们应该连接到的流

因此,我尝试使用本机MediaPlayer\VideoView,但没有成功(视频在播放2-3秒后被卡住,因此我加载了mrmaffen的vlc android sdk(可以找到),并使用以下代码:

            ArrayList<String> options = new ArrayList<String>();
            options.add("--no-drop-late-frames");
            options.add("--no-skip-frames");
            options.add("-vvv");
            videoVlc = new LibVLC(options);

            newVideoMediaPlayer = new org.videolan.libvlc.MediaPlayer(videoVlc);
            final IVLCVout vOut = newVideoMediaPlayer.getVLCVout();
            vOut.addCallback(this);
            vOut.setVideoView(videoView); //videoView is a pre-defined view which is part of the layout
            vOut.attachViews();
            newVideoMediaPlayer.setEventListener(this);

            Media videoMedia = new Media (videoVlc, Uri.parse(mVideoPath));
            newVideoMediaPlayer.setMedia(videoMedia);
            newVideoMediaPlayer.play();
ArrayList options=new ArrayList();
选项。添加(“--no drop late frames”);
选项。添加(“--no skip frames”);
选项。添加(“-vvv”);
videoVlc=新的LibVLC(选项);
newVideoMediaPlayer=neworg.videolan.libvlc.MediaPlayer(videoVlc);
final IVLCVout vOut=newVideoMediaPlayer.getVLCVout();
发票(本);
vOut.setVideoView(videoView);//videoView是一个预定义的视图,它是布局的一部分
附件视图();
newVideoMediaPlayer.setEventListener(此);
Media videoMedia=新媒体(videoVlc,Uri.parse(mVideoPath));
newVideoMediaPlayer.setMedia(视频媒体);
newVideoMediaPlayer.play();
问题是我看到一个空白屏幕

请记住,当我将RTSP链接仅与音频流连接时,它可以正常工作

是否有人熟悉此sdk并对此问题有想法?
提前感谢

我用以下代码播放rtsp流媒体

try {
        Uri rtspUri=Uri.parse("rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov");


        final MediaWrapper mw = new MediaWrapper(rtspUri);
        mw.removeFlags(MediaWrapper.MEDIA_FORCE_AUDIO);
        mw.addFlags(MediaWrapper.MEDIA_VIDEO);

        MediaWrapperListPlayer.getInstance().getMediaList().add(mw);

        VLCInstance.getMainMediaPlayer().setEventListener(this);
    VLCInstance.get().setOnHardwareAccelerationError(this);


    final IVLCVout vlcVout = VLCInstance.getMainMediaPlayer().getVLCVout();
    vlcVout.addCallback(this);
    vlcVout.setVideoView(mSurfaceView);
    vlcVout.attachViews();
    final SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(this);
    final String aout = VLCOptions.getAout(pref);
    VLCInstance.getMainMediaPlayer().setAudioOutput(aout);
    MediaWrapperListPlayer.getInstance().playIndex(this, 0);

    } catch (Exception e) {
        Log.e(TAG, e.toString());
    }
当您开始播放活动时,您需要启用视频跟踪

private void onPlaying() {
    stopLoadingAnimation();
    VLCInstance.getMainMediaPlayer().setVideoTrackEnabled(true);
}

这可能对您有所帮助

尝试添加此选项:

--rtsp-tcp

您是否已使用解决了此问题?谢谢,它工作正常!即使来自Google Play的Android VLC也无法播放某些流(因为它没有此选项)。在代码中:options.add(“--rtsp tcp”);new LibVLC(context,options);