, .mp4, iOS , /.
, -. VLC Android, FFMPEG SurfaceViews.
, build.grade:
compile "de.mrmaffen:vlc-android-sdk:1.0.3"
For example, you can do a new action for video and in onCreate, do the following:
mSurfaceView = (SurfaceView) findViewById(R.id.player_surface);
mSurfaceHolder = mSurfaceView.getHolder();
mSurfaceFrame = (FrameLayout) findViewById(R.id.player_surface_frame);
mMediaUrl = getIntent().getExtras().getString("videoUrl");
try {
mLibVLC = LibVLC.getInstance();
mLibVLC.setAout(mLibVLC.AOUT_AUDIOTRACK);
mLibVLC.setVout(mLibVLC.VOUT_ANDROID_SURFACE);
mLibVLC.setHardwareAcceleration(LibVLC.HW_ACCELERATION_FULL);
mLibVLC.eventVideoPlayerActivityCreated(Boolean.TRUE);
mLibVLC.init(getApplicationContext());
} catch (LibVlcException e){
Log.e(TAG, e.toString());
}
mSurfaceHolder.addCallback(mSurfaceCallback);
mSurface = mSurfaceHolder.getSurface();
mLibVLC.attachSurface(mSurface, VideoVLCActivity.this);
mLibVLC.playMRL(mMediaUrl);
You can find a lot of troubleshooting information here:
VLC for Android VideoLAN Forums
Below is a more detailed example here , although it uses a different version of libvlc.LibVLC and contains different methods, it will give you a good idea about what steps are needed to add controls, set the correct size, aspect ratio, orientation, etc.
source
share