Android LibVLC:视频Surface

时间:2013-09-27 10:51:14

标签: java android video-streaming libvlc

如何设置Surface以在Java-Android应用程序中显示视频?

目前我这样做:

        mSurfaceHolder = GUIconfig.videoWindow.getHolder();
        mLibVLC = LibVLC.getInstance();
        mLibVLC.init(GUIconfig.mainWindow);
        mLibVLC.useIOMX();

        mLibVLC.attachSurface(mSurfaceHolder.getSurface(), new IVideoPlayer() {

            @Override
            public void setSurfaceSize(int width, int height, int visible_width,
                    int visible_height, int sar_num, int sar_den) {

            }
        }, GUIconfig.screenWidth, GUIconfig.screenHeight);
        mLibVLC.readMedia("rtsp://129.69.207.174:8554/Stream", false);
        mLibVLC.play();

GUIconfig.videoWindow是一个SurfaceView

LogCat显示警告:yuv_rgb_neon过滤器:无法获取输出图片

它播放声音,但我看不到视频。我做错了什么?

3 个答案:

答案 0 :(得分:0)

您可以通过阅读video activity code from vlc-android

找到在活动中使用LibVLC的正确方法

HTH

答案 1 :(得分:0)

请参阅此问题Integrating videolan in Android for live streaming

你需要

mLibVLC.setHardwareAcceleration(LibVLC.HW_ACCELERATION_FULL);
mLibVLC.eventVideoPlayerActivityCreated(true); 

答案 2 :(得分:0)

LibVLC libVLC = new LibVLC();
MediaPlayer  mMediaPlayer =  new org.videolan.libvlc.MediaPlayer(libVLC);
VlcVout mVlcVout = mMediaPlayer.getVLCVout();
mVlcVout.setVideoView({**YOUR TEXTUREVIEW**});
mVlcVout.attachViews();

希望有所帮助