• Stars
    star
    2,913
  • Rank 15,572 (Top 0.4 %)
  • Language
    Java
  • License
    Apache License 2.0
  • Created over 7 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

The basic library of Android player will process complex business components. The access is simple。Android播放器基础库,专注于播放视图组件的高复用性和组件间的低耦合,轻松处理复杂业务。

image

PlayerBase-Core

Download API

ExoPlayerPkg

Download API

IjkPlayerPkg

Download API

博文地址Android播放器基础封装库PlayerBase

提issue注意事项

有问题先看介绍和wiki文档

项目介绍

Demo下载

使用及依赖-已适配AndroidX

需要的权限,如果targetSDK版本在Android M以上的,请注意运行时权限的处理。

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

只使用MediaPlayer

dependencies {
  
  //该依赖仅包含MediaPlayer解码
  implementation 'com.kk.taurus.playerbase:playerbase:3.4.2'
  
}

使用ExoPlayer + MediaPlayer

dependencies {
 
  //该依赖包含exoplayer解码和MediaPlayer解码
  //注意exoplayer的最小支持SDK版本为16
  implementation 'cn.jiajunhui:exoplayer:342_2132_019'
  
}

使用ijkplayer + MediaPlayer

dependencies {
  
  //该依赖包含ijkplayer解码和MediaPlayer解码
  implementation 'cn.jiajunhui:ijkplayer:342_088_012'
  //ijk官方的解码库依赖,较少格式版本且不支持HTTPS。
  implementation 'tv.danmaku.ijk.media:ijkplayer-armv7a:0.8.8'
  # Other ABIs: optional
  implementation 'tv.danmaku.ijk.media:ijkplayer-armv5:0.8.8'
  implementation 'tv.danmaku.ijk.media:ijkplayer-arm64:0.8.8'
  implementation 'tv.danmaku.ijk.media:ijkplayer-x86:0.8.8'
  implementation 'tv.danmaku.ijk.media:ijkplayer-x86_64:0.8.8'
  
}

使用ijkplayer + ExoPlayer + MediaPlayer

dependencies {
  
  //该依赖包含exoplayer解码和MediaPlayer解码
  //注意exoplayer的最小支持SDK版本为16
  implementation 'cn.jiajunhui:exoplayer:342_2132_019'

  //该依赖包含ijkplayer解码和MediaPlayer解码
  implementation 'cn.jiajunhui:ijkplayer:342_088_012'
  //ijk官方的解码库依赖,较少格式版本且不支持HTTPS。
  implementation 'tv.danmaku.ijk.media:ijkplayer-armv7a:0.8.8'
  # Other ABIs: optional
  implementation 'tv.danmaku.ijk.media:ijkplayer-armv5:0.8.8'
  implementation 'tv.danmaku.ijk.media:ijkplayer-arm64:0.8.8'
  implementation 'tv.danmaku.ijk.media:ijkplayer-x86:0.8.8'
  implementation 'tv.danmaku.ijk.media:ijkplayer-x86_64:0.8.8'
  
}

如果您添加依赖exoplayer的库,需要在gradle中增加如下配置。

buildTypes {

    //...
    
    compileOptions{
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

代码混淆时,请在proguard中添加如下保护

-keep public class * extends android.view.View{*;}

-keep public class * implements com.kk.taurus.playerbase.player.IPlayer{*;}

初始化

public class App extends Application {

    @Override
    public void onCreate() {
        //...
        
        //如果您想使用默认的网络状态事件生产者,请添加此行配置。
        //并需要添加权限 android.permission.ACCESS_NETWORK_STATE
        PlayerConfig.setUseDefaultNetworkEventProducer(true);
        //初始化库
        PlayerLibrary.init(this);
        
        //-------------------------------------------
        
        //如果添加了'cn.jiajunhui:exoplayer:xxxx'该依赖
        ExoMediaPlayer.init(this);
        
        //如果添加了'cn.jiajunhui:ijkplayer:xxxx'该依赖
        IjkPlayer.init(this);
        
        
        //播放记录的配置
        //开启播放记录
        PlayerConfig.playRecord(true);
        PlayRecordManager.setRecordConfig(
                        new PlayRecordManager.RecordConfig.Builder()
                                .setMaxRecordCount(100)
                                //.setRecordKeyProvider()
                                //.setOnRecordCallBack()
                                .build());
        
    }
    
}

交流

联系方式:[email protected]

QQ群:600201778

License

Copyright 2017 jiajunhui<[email protected]>

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0
   
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

More Repositories

1

MediaLoader

Use this library , you can load pictures,videos,audios very fast in Phone Storage.
Java
50
star
2

MediaRetriever

一个音视频封面、缩略图、多媒体信息加载工具
Java
11
star
3

BatteryIcon

A control used to display power value.
Java
10
star
4

ReboundView

Android Rebound control, for example LinearLayout, RelativeLayout, ScrollView, RecyclerView, Similar to IOS style.
Java
9
star
5

XLog

android log tools , include message log,format json log,file log ,crash log
Java
9
star
6

BaseMVP

a mvp frame page base for android app.
Kotlin
5
star
7

SmileLoading

一个有趣的微笑加载动画
Java
5
star
8

FileBase

Directory management for easy application
Java
4
star
9

XHTTP

HTTP tools based on okhttp3
Java
3
star
10

ThreadFactory

a thread pool tools
Java
2
star
11

XDisplay

a image and media thumbnail loader
Java
2
star
12

MultiScreenUDP_Terminal

Android platform multi screen interaction, the use of UDP protocol and its broadcast mechanism,this is terminal use
Java
2
star
13

MultiScreenUDP

Android platform multi screen interaction, the use of UDP protocol and its broadcast mechanism
Java
2
star
14

KKDialog

Use this library, you can easily use dialog.
Java
2
star
15

AnimEffect

View animation effects collection , You can easily add animations to your view.
Java
1
star
16

SafeSharedPreferences

a safe SharedPreferences ,Supporting cross-process usage
Java
1
star
17

CHandler

Using C++to implement a handler tool similar to Android
C++
1
star
18

Widget_Practice

用于练手的自定义控件
Java
1
star
19

MultiScreenHTTP_Terminal

This project is the control side of MultiScreenHTTP
Java
1
star
20

uiframe

A general UI framework
Java
1
star
21

Magazine

An open data interface application
Java
1
star
22

MultiScreenHTTP

Android multi screen interactive platform, the use of UDP radio equipment connection, the use of HTTP to interact.
Java
1
star
23

Plugin-Skin

This is a Android plug-in skin library
Java
1
star