Android IJKPlayer封装

IJKPlayer

IJK集成播放器,拥有亮度调整、音量调整、视频全屏播放。GitHub

方法一 ARR依赖

IJKPlayer.arr

android {
    ....
    repositories {
        flatDir {
            dirs 'libs'
        }
    }
}

dependencies {
        implementation(name: 'IJKPlayer', ext: 'aar')
}

方法二 JitPack依赖

A.项目/build.grade

	allprojects {
		repositories {
			...
			maven { url 'https://jitpack.io' }
		}
	}

B.项目/app/build.grade

	dependencies {
	    implementation 'com.github.RelinRan:IJKPlayer:1.0.2'
	}

AndroidManifest.xml Activity配置

        <activity
            android:name=".XXXXX"
            android:configChanges="keyboardHidden|orientation|screenSize"></activity>

xml布局

    <com.android.ijk.player.view.IJKVideoView
        android:id="@+id/ijk"
        android:layout_width="match_parent"
        android:layout_height="220dp"
        android:background="@color/colorBlack"></com.android.ijk.player.view.IJKVideoView>

播放视频

        //初始化建议配置在Application
        IJK.config().initOptions();
        IJKVideoView ijk = findViewById(R.id.ijk);
        //播放视频
        ijk.setDataSource("http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4");
        ijk.start();
上一篇:Android Gradle文件拆解


下一篇:No implementation for org.apache.maven.model.path.PathTranslator was bound.