基于迅雷Aplayer封装
allprojects {
repositories {
...
maven { url 'https://www.jitpack.io' }
}
}
dependencies {
implementation 'com.github.W252016021:Aplayer:1.2.0'
}
new APlayer(this).setTitle(fileModel.getFileName()).setUrl(fileModel.getFilePath()).setResquestCode(201).start();
//201用于回调播放完成事件,可空
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
Log.e("info", "onActivityResult: requestCode->" + requestCode + "|resultCode->" + resultCode);
if (requestCode == 201) {
Toast.makeText(this, "播放完毕", Toast.LENGTH_SHORT).show();
}
}
-keep class com.aplayer.** {*;}