LibVLC android search and redirect

I have a problem with searching in my own Android application. When I forward my rtmp video (MP4 source), the VLC holds and plays well after 60-120 seconds.

My device is armv7 android TV STB BOX.

        // Create a new media player
        libvlc = LibVLC.getInstance();
        libvlc.setHardwareAcceleration(LibVLC.HW_ACCELERATION_FULL);
        //libvlc.setSubtitlesEncoding("");
        //libvlc.setAout(LibVLC.VOUT_ANDROID_SURFACE);
        //libvlc.setTimeStretching(false);
        //libvlc.setFrameSkip(true);

        libvlc.setSubtitlesEncoding("");
        libvlc.setTimeStretching(false);
        libvlc.setFrameSkip(true);
        libvlc.setChroma("RV32");
        libvlc.setVerboseMode(true);
        libvlc.setAout(-1);
        libvlc.setDeblocking(4);
        libvlc.setNetworkCaching(0);



        //libvlc.setChroma("RV32");
        //libvlc.setVerboseMode(false);
        //libvlc.setDeblocking(1);
        //libvlc.setNetworkCaching(2500);
        LibVLC.restart(this);
        EventHandler.getInstance().addHandler(mHandler);
        holder.setFormat(PixelFormat.RGBX_8888);
        holder.setKeepScreenOn(true);
        MediaList list = libvlc.getMediaList();
        list.clear();
        list.add(new Media(libvlc, LibVLC.PathToURI(media)), false);
        libvlc.playIndex(0);

On another player, such as MXPlayer, there is no problem with this. Vitamio works well, but there is a problem with audio sync. Without searching for video on VLC, it works well, below is my action back and forth:

switch (event.getKeyCode()) {

        // next
        case 87:

            s = false;

            if (length > 0L) {
                Long t = time+60000L;
                if (t < length) {
                    //libvlc.clearBuffer();
                    libvlc.setTime(time+60000L);
                    libvlc.play();
                }
            }

            break;
        // prev
        case 88:

            s = false;

            if (length > 0L) {
                Long t = time-60000L;
                if (t > 0) {
                    libvlc.setTime(time-60000L);
                    libvlc.play();
                }
            }

            break;
    }
+4
source share
1 answer

I could not understand your question, but if it cannot establish the position of the seeking player when MedaiPlayer is not playing, calling setPosition during the game does the trick:

        if(!isPlaying){
            mp.play();//otherwise not seekable for some silly reason
            mp.setTime((long)pos);
            mp.pause();
        }else{
            mp.setTime((long)pos);
        }

mp - MediaPlayer, . getLength() , iso !

0

All Articles