android-libvlc多曲面问题

android-libvlc多曲面问题,android,android-fragments,android-view,vlc,libvlc,Android,Android Fragments,Android View,Vlc,Libvlc,我想知道是否有可能在同一布局中使用两个曲面,并同时查看每个曲面。在未来,我将使用视频视图的网格视图,但每个视频视图都使用vlc 我使用fragment修改了这个示例() 结果是我只看到一个视频…我如何解决 从log cat中,我没有看到重要的错误,但我认为android UIThread存在渲染问题 Java编码 public class MultipleVideoPlayFragmentActivity extends FragmentActivity { public final stat

我想知道是否有可能在同一布局中使用两个曲面,并同时查看每个曲面。在未来,我将使用视频视图的网格视图,但每个视频视图都使用vlc

我使用fragment修改了这个示例()

结果是我只看到一个视频…我如何解决

从log cat中,我没有看到重要的错误,但我认为android UIThread存在渲染问题

Java编码

public class MultipleVideoPlayFragmentActivity extends FragmentActivity {

public final static String LOCATION = "com.compdigitec.libvlcandroidsample.MultipleVideoPlayFragmentActivity.location";
private static final String TAG = "MediaPlayer";
public String mFilePatha;

@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    setContentView(R.layout.activity_multiple_video_play_fragment);
    Intent intent = getIntent();
    mFilePatha = intent.getExtras().getString(LOCATION);
}

public static class VideoFragment extends Fragment implements
        SurfaceHolder.Callback, IVideoPlayer {
    public final static String TAG = "LibVLCAndroidSample/VideoActivity";

    public final static String LOCATION = "com.compdigitec.libvlcandroidsample.VideoFragment.location";

    private String mFilePath;

    // display surface
    private SurfaceView mSurface;
    private SurfaceHolder holder;

    // media player
    private LibVLC libvlc;
    private int mVideoWidth;
    private int mVideoHeight;
    private final static int VideoSizeChanged = -1;

    /*************
     * Activity
     *************/

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        return inflater.inflate(R.layout.sample, container, false);
    }

    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        // Receive path to play from intent

        Log.d(TAG, "Playing back " + mFilePath);
        mFilePath = ((MultipleVideoPlayFragmentActivity) getActivity()).mFilePatha;
        // mFilePath="rtsp://192.168.4.125:554/0";
        // mFilePath="android.resource://it.nexera.visiamobile/raw/sample_mpeg4";
        mSurface = (SurfaceView) getView().findViewById(R.id.surface);
        holder = mSurface.getHolder();
        holder.addCallback(this);
    }

    @Override
    public void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);
        setSize(mVideoWidth, mVideoHeight);
    }

    @Override
    public void onResume() {
        super.onResume();
        createPlayer(mFilePath);
    }

    @Override
    public void onPause() {
        super.onPause();
        releasePlayer();
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        releasePlayer();
    }

    /*************
     * Surface
     *************/

    public void surfaceCreated(SurfaceHolder holder) {
    }

    public void surfaceChanged(SurfaceHolder surfaceholder, int format,
            int width, int height) {
        if (libvlc != null)
            libvlc.attachSurface(holder.getSurface(), this);
    }

    public void surfaceDestroyed(SurfaceHolder surfaceholder) {
    }

    private void setSize(int width, int height) {
        mVideoWidth = width;
        mVideoHeight = height;
        if (mVideoWidth * mVideoHeight <= 1)
            return;

        // get screen size
        int w = getActivity().getWindow().getDecorView().getWidth();
        int h = getActivity().getWindow().getDecorView().getHeight();

        // getWindow().getDecorView() doesn't always take orientation into
        // account, we have to correct the values
        boolean isPortrait = getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT;
        if (w > h && isPortrait || w < h && !isPortrait) {
            int i = w;
            w = h;
            h = i;
        }

        float videoAR = (float) mVideoWidth / (float) mVideoHeight;
        float screenAR = (float) w / (float) h;

        if (screenAR < videoAR)
            h = (int) (w / videoAR);
        else
            w = (int) (h * videoAR);

        // force surface buffer size
        holder.setFixedSize(mVideoWidth, mVideoHeight);

        // set display size
        LayoutParams lp = mSurface.getLayoutParams();
        lp.width = w;
        lp.height = h;
        mSurface.setLayoutParams(lp);
        mSurface.invalidate();
    }

    @Override
    public void setSurfaceSize(int width, int height, int visible_width,
            int visible_height, int sar_num, int sar_den) {
        Message msg = Message.obtain(mHandler, VideoSizeChanged, width,
                height);
        msg.sendToTarget();
    }

    /*************
     * Player
     *************/

    private void createPlayer(String media) {
        releasePlayer();
        try {
            if (media.length() > 0) {
                Toast toast = Toast.makeText(this.getActivity(), media,
                        Toast.LENGTH_LONG);
                toast.setGravity(
                        Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL, 0, 0);
                toast.show();
            }

            // Create a new media player
            libvlc = LibVLC.getInstance();
            libvlc.setHardwareAcceleration(LibVLC.HW_ACCELERATION_DISABLED);
            libvlc.setSubtitlesEncoding("");
            libvlc.setAout(LibVLC.AOUT_OPENSLES);
            libvlc.setTimeStretching(true);
            libvlc.setChroma("RV32");
            libvlc.setVerboseMode(true);
            // LibVLC.restart(this.getActivity());
            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);
        } catch (Exception e) {
            Toast.makeText(this.getActivity(), "Error creating player!",
                    Toast.LENGTH_LONG).show();
        }
    }

    private void releasePlayer() {
        if (libvlc == null)
            return;
        EventHandler.getInstance().removeHandler(mHandler);
        libvlc.stop();
        libvlc.detachSurface();
        holder = null;
        libvlc.closeAout();
        libvlc.destroy();
        libvlc = null;

        mVideoWidth = 0;
        mVideoHeight = 0;
    }

    /*************
     * Events
     *************/

    private Handler mHandler = new MyHandler(this);

    private static class MyHandler extends Handler {
        private WeakReference<VideoFragment> mOwner;

        public MyHandler(VideoFragment owner) {
            mOwner = new WeakReference<VideoFragment>(owner);
        }

        @Override
        public void handleMessage(Message msg) {
            VideoFragment player = mOwner.get();

            // SamplePlayer events
            if (msg.what == VideoSizeChanged) {
                player.setSize(msg.arg1, msg.arg2);
                return;
            }

            // Libvlc events
            Bundle b = msg.getData();
            switch (b.getInt("event")) {
            case EventHandler.MediaPlayerEndReached:
                player.releasePlayer();
                break;
            case EventHandler.MediaPlayerPlaying:
            case EventHandler.MediaPlayerPaused:
            case EventHandler.MediaPlayerStopped:
            default:
                break;
            }
        }
    }
}

}
<?xml version="1.0" encoding="utf-8"?>
公共类MultipleVideoPlayFragmentActivity扩展了FragmentActivity{
public final static String LOCATION=“com.compdigitec.libvlcandroidsample.MultipleVideoPlayFragmentActivity.LOCATION”;
私有静态最终字符串标记=“MediaPlayer”;
公共字符串mFilePatha;
@凌驾
创建公共空间(捆绑冰柱){
超级冰柱;
setContentView(R.layout.activity\u multiple\u video\u play\u fragment);
Intent=getIntent();
mFilePatha=intent.getExtras().getString(位置);
}
公共静态类VideoFragment扩展了片段实现
SurfaceHolder.回拨,IVideoPlayer{
公共最终静态字符串标记=“LibVLCAndroidSample/VideoActivity”;
public final static String LOCATION=“com.compdigitec.libvlcandroidsample.VideoFragment.LOCATION”;
私有字符串路径;
//显示面
私人表面查看MSsurface;
私人土地持有人;
//媒体播放器
私人图书馆;
私有整数宽度;
私人身高;
私有最终静态int VideoSizeChanged=-1;
/*************
*活动
*************/
@凌驾
创建视图上的公共视图(布局、充气机、视图组容器、,
Bundle savedInstanceState){
返回充气机。充气(右布局图。样品,容器,假);
}
@凌驾
已创建ActivityState上的公共无效(Bundle savedInstanceState){
super.onActivityCreated(savedInstanceState);
//接收从意图播放的路径
Log.d(标记“回放”+mFilePath);
mFilePath=((MultipleVideoPlayFragmentActivity)getActivity()).mFilePatha;
//mFilePath=”rtsp://192.168.4.125:554/0";
//mFilePath=“android。resource://it.nexera.visiamobile/raw/sample_mpeg4";
mSurface=(SurfaceView)getView().findViewById(R.id.surface);
holder=mssurface.getHolder();
holder.addCallback(本);
}
@凌驾
公共无效OnConfiguration已更改(配置newConfig){
super.onConfigurationChanged(newConfig);
设置大小(mVideoWidth、mVideoHeight);
}
@凌驾
恢复时公开作废(){
super.onResume();
createPlayer(mFilePath);
}
@凌驾
公共无效暂停(){
super.onPause();
释放玩家();
}
@凌驾
公共空间{
super.ondestory();
释放玩家();
}
/*************
*表面
*************/
已创建的公共空白表面(表面持有人){
}
public void surfaceChanged(SurfaceHolder SurfaceHolder,int格式,
整数宽度,整数高度){
if(libvlc!=null)
libvlc.attachSurface(holder.getSurface(),this);
}
公共空间表面已覆盖(表面层表面层){
}
专用void设置大小(整数宽度、整数高度){
mVideoWidth=宽度;
mVideoHeight=高度;
如果(mvideowith*mvideowith请尝试此选项:

--- libvlc = LibVLC.getInstance();
+++ libvlc = new LibVLC();
另外,您使用的是什么版本的LibVLC android


p.p.S.

我也有同样的问题。我所做的是遵循VLC自己的示例()并制作相同的build.gradle等

我的代码如下:

MainActivity.java

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

import tools.nubicam.com.rtsptest.R;


public class MainActivity extends Activity {

    public final static String TAG = "MainActivity";

    @Override
    protected void onCreate(Bundle savedInstanceState) {


        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        Button startButton = (Button)findViewById(R.id.buttonStart);
        startButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                Intent intent = new Intent(MainActivity.this, VideoActivity.class);
                EditText textRTSP = (EditText)findViewById(R.id.textRTSPUrl);
                intent.putExtra(VideoActivity.RTSP_URL, textRTSP.getText().toString());
                startActivity(intent);
            }
        });

    }

}
import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.Gravity;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.widget.Toast;

import org.videolan.libvlc.IVLCVout;
import org.videolan.libvlc.LibVLC;
import org.videolan.libvlc.Media;
import org.videolan.libvlc.MediaPlayer;
import org.videolan.libvlc.media.VideoView;


import java.lang.ref.WeakReference;
import java.util.ArrayList;

import tools.nubicam.com.rtsptest.R;

public class VideoActivity<USE_TEXTURE_VIEW, ENABLE_SUBTITLES, False> extends Activity implements IVLCVout.Callback    {
    public final static String TAG = "VideoActivity";

    public static final String RTSP_URL = "rtspurl";

    // display surface
    private SurfaceView mSurface;
    private SurfaceHolder holder;

    // media player
    private LibVLC libvlc;
    private MediaPlayer mMediaPlayer = null;
    private int mVideoWidth;
    private int mVideoHeight;
    private final static int VideoSizeChanged = -1;


    private final MediaPlayer.EventListener mPlayerListener = new MyPlayerListener(this);

    private String rtspUrl;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.sample);

        // Get URL
        Intent intent = getIntent();
        rtspUrl = intent.getExtras().getString(RTSP_URL);
        Log.d(TAG, "Playing back " + rtspUrl);

        mSurface = (SurfaceView) findViewById(R.id.surface);
        holder = mSurface.getHolder();
        //holder.addCallback(this);

    }


    @Override
    protected void onResume() {
        super.onResume();
        createPlayer(rtspUrl);
    }

    private void createPlayer(String rtspUrl) {
        releasePlayer();
        try {
            if (rtspUrl.length() > 0) {
                Toast toast = Toast.makeText(this, rtspUrl, Toast.LENGTH_LONG);
                toast.setGravity( Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL, 0, 0);
                toast.show();
            }

            ArrayList<String> options = new ArrayList<String>();
            options.add("-vvv"); // verbosity
            //options.add("--aout=opensles");
            //options.add("--audio-time-stretch"); // time stretching
            //options.add("--avcodec-codec=h264");
            //options.add("--file-logging");
            //options.add("--logfile=vlc-log.txt");

            options.add("--network-caching=150");
            options.add("--clock-jitter=0");
            options.add("--clock-synchro=0");

            //options.add("--http-reconnect");
            //options.add("--network-caching="+6*1000);

            libvlc = new LibVLC(this, options);
            ///holder.setKeepScreenOn(true);

            // Create media player
            mMediaPlayer = new MediaPlayer(libvlc);
            mMediaPlayer.setEventListener(mPlayerListener);

            // Set up video output
            final IVLCVout vout = mMediaPlayer.getVLCVout();
            vout.setVideoView(mSurface);
            //vout.setSubtitlesView(mSurfaceSubtitles);
            vout.addCallback(this);
            vout.attachViews();

            Media m = new Media(libvlc, Uri.parse(rtspUrl));

            mMediaPlayer.setMedia(m);
            mMediaPlayer.play();

//            m.setHWDecoderEnabled(true, false);
//            m.addOption(":network-caching=150");
//            m.addOption(":clock-jitter=0");
//            m.addOption(":clock-synchro=0");


        } catch (Exception e) {
            Toast.makeText(this, "Error creating player!", Toast.LENGTH_LONG).show();
        }

    }

    @Override
    protected void onStart() {
        super.onStart();
        int cnt = 0;
        cnt += 1;
        Toast.makeText(this, cnt + "", Toast.LENGTH_SHORT).show();
    }

    @Override
    protected void onPause() {
        super.onPause();
        releasePlayer();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        releasePlayer();
    }


    @Override
    public void onSurfacesCreated(IVLCVout vlcVout) {
        int cnt = 30;
        cnt += 1;
        Toast.makeText(this, cnt + "", Toast.LENGTH_SHORT).show();
    }

    @Override
    public void onSurfacesDestroyed(IVLCVout vlcVout) {
        int cnt = 20;
        cnt += 1;
        Toast.makeText(this, cnt + "", Toast.LENGTH_SHORT).show();
    }


    @Override
    public void onPointerCaptureChanged(boolean hasCapture) {
        int cnt = 10;
        cnt += 1;
        Toast.makeText(this, cnt + "", Toast.LENGTH_SHORT).show();
    }


    public void releasePlayer() {
        if (libvlc == null)
            return;
        mMediaPlayer.stop();
        final IVLCVout vout = mMediaPlayer.getVLCVout();
        vout.removeCallback(this);
        vout.detachViews();
        holder = null;
        libvlc.release();
        libvlc = null;

        mVideoWidth = 0;
        mVideoHeight = 0;
    }

    private static class MyPlayerListener implements MediaPlayer.EventListener {
        private WeakReference<VideoActivity> mOwner;

        public MyPlayerListener(VideoActivity owner) {
            mOwner = new WeakReference<VideoActivity>(owner);
        }

        @Override
        public void onEvent(org.videolan.libvlc.MediaPlayer.Event event) {
            VideoActivity player = mOwner.get();

            switch(event.type) {
                case MediaPlayer.Event.EndReached:
                    Log.d(TAG, "MediaPlayerEndReached");
                    Toast.makeText(player.getApplicationContext(), "Event EndReached", Toast.LENGTH_SHORT).show();
                    player.releasePlayer();
                    break;
                case MediaPlayer.Event.Opening:
                    Toast.makeText(player.getApplicationContext(), "Event Opening", Toast.LENGTH_SHORT).show();
                    break;
                case MediaPlayer.Event.Buffering:
                    Toast.makeText(player.getApplicationContext(), "Event Buffering", Toast.LENGTH_SHORT).show();
                    break;
                case MediaPlayer.Event.Playing:
                    Toast.makeText(player.getApplicationContext(), "Event Playing", Toast.LENGTH_SHORT).show();
                    break;
                case MediaPlayer.Event.Paused:
                    Toast.makeText(player.getApplicationContext(), "Event Paused", Toast.LENGTH_SHORT).show();
                    break;
                case MediaPlayer.Event.Stopped:
                    Toast.makeText(player.getApplicationContext(), "Event Stopped", Toast.LENGTH_SHORT).show();
                    break;
                default:
                    break;
            }
        }
    }

}
VideoActivity.java

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

import tools.nubicam.com.rtsptest.R;


public class MainActivity extends Activity {

    public final static String TAG = "MainActivity";

    @Override
    protected void onCreate(Bundle savedInstanceState) {


        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        Button startButton = (Button)findViewById(R.id.buttonStart);
        startButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                Intent intent = new Intent(MainActivity.this, VideoActivity.class);
                EditText textRTSP = (EditText)findViewById(R.id.textRTSPUrl);
                intent.putExtra(VideoActivity.RTSP_URL, textRTSP.getText().toString());
                startActivity(intent);
            }
        });

    }

}
import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.Gravity;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.widget.Toast;

import org.videolan.libvlc.IVLCVout;
import org.videolan.libvlc.LibVLC;
import org.videolan.libvlc.Media;
import org.videolan.libvlc.MediaPlayer;
import org.videolan.libvlc.media.VideoView;


import java.lang.ref.WeakReference;
import java.util.ArrayList;

import tools.nubicam.com.rtsptest.R;

public class VideoActivity<USE_TEXTURE_VIEW, ENABLE_SUBTITLES, False> extends Activity implements IVLCVout.Callback    {
    public final static String TAG = "VideoActivity";

    public static final String RTSP_URL = "rtspurl";

    // display surface
    private SurfaceView mSurface;
    private SurfaceHolder holder;

    // media player
    private LibVLC libvlc;
    private MediaPlayer mMediaPlayer = null;
    private int mVideoWidth;
    private int mVideoHeight;
    private final static int VideoSizeChanged = -1;


    private final MediaPlayer.EventListener mPlayerListener = new MyPlayerListener(this);

    private String rtspUrl;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.sample);

        // Get URL
        Intent intent = getIntent();
        rtspUrl = intent.getExtras().getString(RTSP_URL);
        Log.d(TAG, "Playing back " + rtspUrl);

        mSurface = (SurfaceView) findViewById(R.id.surface);
        holder = mSurface.getHolder();
        //holder.addCallback(this);

    }


    @Override
    protected void onResume() {
        super.onResume();
        createPlayer(rtspUrl);
    }

    private void createPlayer(String rtspUrl) {
        releasePlayer();
        try {
            if (rtspUrl.length() > 0) {
                Toast toast = Toast.makeText(this, rtspUrl, Toast.LENGTH_LONG);
                toast.setGravity( Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL, 0, 0);
                toast.show();
            }

            ArrayList<String> options = new ArrayList<String>();
            options.add("-vvv"); // verbosity
            //options.add("--aout=opensles");
            //options.add("--audio-time-stretch"); // time stretching
            //options.add("--avcodec-codec=h264");
            //options.add("--file-logging");
            //options.add("--logfile=vlc-log.txt");

            options.add("--network-caching=150");
            options.add("--clock-jitter=0");
            options.add("--clock-synchro=0");

            //options.add("--http-reconnect");
            //options.add("--network-caching="+6*1000);

            libvlc = new LibVLC(this, options);
            ///holder.setKeepScreenOn(true);

            // Create media player
            mMediaPlayer = new MediaPlayer(libvlc);
            mMediaPlayer.setEventListener(mPlayerListener);

            // Set up video output
            final IVLCVout vout = mMediaPlayer.getVLCVout();
            vout.setVideoView(mSurface);
            //vout.setSubtitlesView(mSurfaceSubtitles);
            vout.addCallback(this);
            vout.attachViews();

            Media m = new Media(libvlc, Uri.parse(rtspUrl));

            mMediaPlayer.setMedia(m);
            mMediaPlayer.play();

//            m.setHWDecoderEnabled(true, false);
//            m.addOption(":network-caching=150");
//            m.addOption(":clock-jitter=0");
//            m.addOption(":clock-synchro=0");


        } catch (Exception e) {
            Toast.makeText(this, "Error creating player!", Toast.LENGTH_LONG).show();
        }

    }

    @Override
    protected void onStart() {
        super.onStart();
        int cnt = 0;
        cnt += 1;
        Toast.makeText(this, cnt + "", Toast.LENGTH_SHORT).show();
    }

    @Override
    protected void onPause() {
        super.onPause();
        releasePlayer();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        releasePlayer();
    }


    @Override
    public void onSurfacesCreated(IVLCVout vlcVout) {
        int cnt = 30;
        cnt += 1;
        Toast.makeText(this, cnt + "", Toast.LENGTH_SHORT).show();
    }

    @Override
    public void onSurfacesDestroyed(IVLCVout vlcVout) {
        int cnt = 20;
        cnt += 1;
        Toast.makeText(this, cnt + "", Toast.LENGTH_SHORT).show();
    }


    @Override
    public void onPointerCaptureChanged(boolean hasCapture) {
        int cnt = 10;
        cnt += 1;
        Toast.makeText(this, cnt + "", Toast.LENGTH_SHORT).show();
    }


    public void releasePlayer() {
        if (libvlc == null)
            return;
        mMediaPlayer.stop();
        final IVLCVout vout = mMediaPlayer.getVLCVout();
        vout.removeCallback(this);
        vout.detachViews();
        holder = null;
        libvlc.release();
        libvlc = null;

        mVideoWidth = 0;
        mVideoHeight = 0;
    }

    private static class MyPlayerListener implements MediaPlayer.EventListener {
        private WeakReference<VideoActivity> mOwner;

        public MyPlayerListener(VideoActivity owner) {
            mOwner = new WeakReference<VideoActivity>(owner);
        }

        @Override
        public void onEvent(org.videolan.libvlc.MediaPlayer.Event event) {
            VideoActivity player = mOwner.get();

            switch(event.type) {
                case MediaPlayer.Event.EndReached:
                    Log.d(TAG, "MediaPlayerEndReached");
                    Toast.makeText(player.getApplicationContext(), "Event EndReached", Toast.LENGTH_SHORT).show();
                    player.releasePlayer();
                    break;
                case MediaPlayer.Event.Opening:
                    Toast.makeText(player.getApplicationContext(), "Event Opening", Toast.LENGTH_SHORT).show();
                    break;
                case MediaPlayer.Event.Buffering:
                    Toast.makeText(player.getApplicationContext(), "Event Buffering", Toast.LENGTH_SHORT).show();
                    break;
                case MediaPlayer.Event.Playing:
                    Toast.makeText(player.getApplicationContext(), "Event Playing", Toast.LENGTH_SHORT).show();
                    break;
                case MediaPlayer.Event.Paused:
                    Toast.makeText(player.getApplicationContext(), "Event Paused", Toast.LENGTH_SHORT).show();
                    break;
                case MediaPlayer.Event.Stopped:
                    Toast.makeText(player.getApplicationContext(), "Event Stopped", Toast.LENGTH_SHORT).show();
                    break;
                default:
                    break;
            }
        }
    }

}
建造.梯度(vlc.)

格拉德尔酒店

org.gradle.jvmargs=-Xmx1536m
android.useAndroidX=true
android.enableJetifier=true
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
gradle-wrapper.properties

org.gradle.jvmargs=-Xmx1536m
android.useAndroidX=true
android.enableJetifier=true
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip

我在后台服务中也遇到了同样的问题,我尝试运行了多个LibVLC实例,但这不起作用,只播放了最后一个流。你用多个片段解决了问题?不,用于android的Vlc不支持多个实例,但我知道Vlc工作人员正在进行这项工作。查看官方Vlc开发者论坛。Hi@tulkas85:-我是fac同样的问题。我正在尝试使用这个链接-它在android 5.0上运行良好,但在6.0上存在渲染问题。这意味着流不能正常获得。那边有些闪烁。
org.gradle.jvmargs=-Xmx1536m
android.useAndroidX=true
android.enableJetifier=true
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip