标签:file 展示 core tom jar etl http jni eset
3、把整个jniLibs文件夹里面的所有内容都拷贝到你项目src/main/里,详情如下图所示:
4、然后在你项目build.gradle进行关联
android {
sourceSets {
main {
jniLibs.srcDirs = [‘src/main/jniLibs‘]
}
}
}
dependencies {
implementation files(‘libs/pldroid-player-2.1.6.jar‘)
implementation ‘com.bugsnag:bugsnag-android-ndk:1.1.2‘
implementation ‘com.android.support:appcompat-v7:27.1.0‘
implementation ‘com.journeyapps:zxing-android-embedded:3.0.2@aar‘
implementation ‘com.google.zxing:core:3.2.0‘
}
5、然后在你项目xml布局里添加如下代码,PLVideoView控件:
<com.pili.pldroid.player.widget.PLVideoView
android:id="@+id/VideoView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center" />
6、最后去在你Activity里找到这个控件并配置播放器代码:
mVideoView = findViewById(R.id.VideoView);
AVOptions options = new AVOptions();
options.setInteger(AVOptions.KEY_PREPARE_TIMEOUT, 10 * 1000);
options.setInteger(AVOptions.KEY_MEDIACODEC, AVOptions.MEDIA_CODEC_SW_DECODE);
options.setInteger(AVOptions.KEY_LIVE_STREAMING, 1 );
options.setInteger(AVOptions.KEY_LOG_LEVEL, 0);
mVideoView.setAVOptions(options);
// Set some listeners
mVideoView.setOnInfoListener(mOnInfoListener);
mVideoView.setOnVideoSizeChangedListener(mOnVideoSizeChangedListener);
mVideoView.setOnBufferingUpdateListener(mOnBufferingUpdateListener);
mVideoView.setOnCompletionListener(mOnCompletionListener);
mVideoView.setOnErrorListener(mOnErrorListener);
mVideoView.setOnVideoFrameListener(mOnVideoFrameListener);
mVideoView.setOnAudioFrameListener(mOnAudioFrameListener);
mVideoView.setVideoPath(videoPath);
mVideoView.setDisplayAspectRatio(mDisplayAspectRatio);
mVideoView.setLooping(true);
// You can also use a custom `MediaController` widget
mMediaController = new MediaController(this, !mIsLiveStreaming, mIsLiveStreaming);
mMediaController.setOnClickSpeedAdjustListener(mOnClickSpeedAdjustListener);
mVideoView.setMediaController(mMediaController);
最后展示一下效果:
最后附上本人github,代码下载地址:https://github.com/Visen123/MyShortVideo ,如果觉得使用方便,请给我的github 点个赞,谢谢
标签:file 展示 core tom jar etl http jni eset
原文地址:http://blog.51cto.com/1206995290qq/2335201