├── .DS_Store ├── .gitignore ├── LICENSE ├── README.md ├── app ├── .DS_Store ├── .gitignore ├── build.gradle ├── libs │ └── logtools.jar ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── kk │ │ └── taurus │ │ └── avplayer │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── assets │ │ └── video │ │ │ └── big_buck_bunny.mp4 │ ├── java │ │ └── com │ │ │ └── kk │ │ │ └── taurus │ │ │ └── avplayer │ │ │ ├── App.java │ │ │ ├── HomeActivity.java │ │ │ ├── adapter │ │ │ ├── ListAdapter.java │ │ │ ├── OnItemClickListener.java │ │ │ ├── PlayPagerAdapter.java │ │ │ ├── RecyclerBaseVideoContentAdapter.java │ │ │ ├── SettingAdapter.java │ │ │ └── VideoListPagerAdapter.java │ │ │ ├── base │ │ │ ├── BSPlayer.java │ │ │ └── ISPayer.java │ │ │ ├── bean │ │ │ ├── RecyclerBaseVideoBean.java │ │ │ ├── SettingItem.java │ │ │ └── VideoBean.java │ │ │ ├── cover │ │ │ ├── CloseCover.java │ │ │ ├── CompleteCover.java │ │ │ ├── ControllerCover.java │ │ │ ├── DanmuCover.java │ │ │ ├── ErrorCover.java │ │ │ ├── GestureCover.java │ │ │ └── LoadingCover.java │ │ │ ├── event_producer │ │ │ └── DanmuDataProducer.java │ │ │ ├── play │ │ │ ├── DataInter.java │ │ │ ├── DemoDataProvider.java │ │ │ ├── ListPlayer.java │ │ │ ├── OnHandleListener.java │ │ │ ├── ReceiverGroupManager.java │ │ │ └── ShareAnimationPlayer.java │ │ │ ├── ui │ │ │ ├── BaseVideoViewActivity.java │ │ │ ├── DetailPlayActivity.java │ │ │ ├── InputUrlPlayActivity.java │ │ │ ├── MultiPlayActivity.java │ │ │ ├── MusicPlayActivity.java │ │ │ ├── RecyclerBaseVideoActivity.java │ │ │ ├── ShareAnimationActivityA.java │ │ │ ├── ShareAnimationActivityB.java │ │ │ ├── SplashActivity.java │ │ │ ├── ViewPagerPlayActivity.java │ │ │ ├── fragment │ │ │ │ └── VideoListFragment.java │ │ │ ├── listplay │ │ │ │ ├── ListPlayActivity.java │ │ │ │ └── MultiListActivity.java │ │ │ └── window │ │ │ │ ├── FloatWindowActivity.java │ │ │ │ └── WindowVideoViewActivity.java │ │ │ ├── utils │ │ │ ├── DataUtils.java │ │ │ ├── ImageDisplayEngine.java │ │ │ ├── MediaGlideModule.java │ │ │ ├── OrientationHelper.java │ │ │ ├── OrientationSensor.java │ │ │ ├── PUtil.java │ │ │ ├── RandomUtils.java │ │ │ └── WindowPermissionCheck.java │ │ │ └── view │ │ │ ├── SmileView.java │ │ │ └── VisualizerView.java │ ├── jniLibs │ │ └── armeabi-v7a │ │ │ ├── libijkffmpeg.so │ │ │ ├── libijkplayer.so │ │ │ └── libijksdl.so │ └── res │ │ ├── drawable-v24 │ │ └── ic_launcher_foreground.xml │ │ ├── drawable │ │ ├── ic_launcher_background.xml │ │ ├── selector_play_state.xml │ │ ├── selector_seek_bar_thumb.xml │ │ ├── shape_controller_bottom_gradient.xml │ │ ├── shape_controller_top_gradient.xml │ │ ├── shape_next.xml │ │ ├── shape_replay.xml │ │ ├── style_video_player_video_bottom_seekbar.xml │ │ └── style_video_player_video_seekbar.xml │ │ ├── layout-v21 │ │ └── activity_share_animation_b.xml │ │ ├── layout │ │ ├── activity_base_video_view.xml │ │ ├── activity_detail_page.xml │ │ ├── activity_home.xml │ │ ├── activity_input_url_play.xml │ │ ├── activity_list.xml │ │ ├── activity_multi_list.xml │ │ ├── activity_multi_play.xml │ │ ├── activity_recycler_base_video.xml │ │ ├── activity_recycler_base_video_type_item.xml │ │ ├── activity_recycler_base_video_type_video.xml │ │ ├── activity_share_animation_a.xml │ │ ├── activity_share_animation_b.xml │ │ ├── activity_splash.xml │ │ ├── activity_test_play.xml │ │ ├── activity_view_pager_play.xml │ │ ├── activity_window_switch_play.xml │ │ ├── activity_window_video_view.xml │ │ ├── fragment_list.xml │ │ ├── item_pager_play.xml │ │ ├── item_setting.xml │ │ ├── item_video.xml │ │ ├── layout_close_cover.xml │ │ ├── layout_complete_cover.xml │ │ ├── layout_controller_cover.xml │ │ ├── layout_danmu_cover.xml │ │ ├── layout_dark_mode_title_bar.xml │ │ ├── layout_error_cover.xml │ │ ├── layout_gesture_cover.xml │ │ ├── layout_loading_cover.xml │ │ └── layout_window.xml │ │ ├── menu │ │ └── main_menu.xml │ │ ├── mipmap-hdpi │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ ├── ic_brightness_white.png │ │ ├── ic_launcher.png │ │ ├── ic_video_player_btn_pause.png │ │ ├── ic_video_player_btn_play.png │ │ ├── ic_volume_off_white.png │ │ ├── ic_volume_up_white.png │ │ ├── icon_arrow_right.png │ │ ├── icon_back_white.png │ │ ├── icon_close.png │ │ ├── icon_exit_full_screen.png │ │ ├── icon_full_screen.png │ │ ├── icon_player_back.png │ │ ├── player_icon_start_play.png │ │ ├── seek_bar_progress.png │ │ └── seek_bar_progress_default.png │ │ ├── mipmap-xxhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxxhdpi │ │ └── ic_launcher.png │ │ ├── raw │ │ └── big_buck_bunny.mp4 │ │ └── values │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── kk │ └── taurus │ └── avplayer │ └── ExampleUnitTest.java ├── build.gradle ├── exoplayer ├── .gitignore ├── bintray.gradle ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ └── java │ └── com │ └── kk │ └── taurus │ └── exoplayer │ └── ExoMediaPlayer.java ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── ijkplayer ├── .DS_Store ├── .gitignore ├── bintray.gradle ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ └── java │ └── com │ └── kk │ └── taurus │ └── ijkplayer │ ├── IjkPlayer.java │ └── RawDataSourceProvider.java ├── playerbase ├── .DS_Store ├── .gitignore ├── bintray.gradle ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ └── java │ └── com │ └── kk │ └── taurus │ └── playerbase │ ├── AVPlayer.java │ ├── assist │ ├── AssistPlay.java │ ├── BaseEventAssistHandler.java │ ├── InterEvent.java │ ├── InterKey.java │ ├── OnAssistPlayEventHandler.java │ ├── OnEventAssistHandler.java │ ├── OnVideoViewEventHandler.java │ └── RelationAssist.java │ ├── config │ ├── AppContextAttach.java │ ├── PConst.java │ ├── PlayerConfig.java │ ├── PlayerLibrary.java │ └── PlayerLoader.java │ ├── entity │ ├── DataSource.java │ ├── DecoderPlan.java │ └── TimedTextSource.java │ ├── event │ ├── BundlePool.java │ ├── EventDispatcher.java │ ├── EventKey.java │ ├── IEventDispatcher.java │ ├── OnErrorEventListener.java │ └── OnPlayerEventListener.java │ ├── extension │ ├── BaseEventProducer.java │ ├── DelegateReceiverEventSender.java │ ├── EventCallback.java │ ├── EventProducer.java │ ├── IProducerGroup.java │ ├── NetworkEventProducer.java │ ├── ProducerEventSender.java │ ├── ProducerGroup.java │ └── ReceiverEventSender.java │ ├── log │ ├── DebugLog.java │ └── PLog.java │ ├── player │ ├── BaseInternalPlayer.java │ ├── IPlayer.java │ ├── IPlayerProxy.java │ ├── OnBufferingListener.java │ ├── OnTimerUpdateListener.java │ ├── SysMediaPlayer.java │ └── TimerCounterProxy.java │ ├── provider │ ├── BaseDataProvider.java │ └── IDataProvider.java │ ├── receiver │ ├── AbsCoverContainer.java │ ├── BaseCover.java │ ├── BaseLevelCoverContainer.java │ ├── BaseReceiver.java │ ├── CoverComparator.java │ ├── DefaultLevelCoverContainer.java │ ├── GroupValue.java │ ├── ICover.java │ ├── ICoverHandle.java │ ├── ICoverStrategy.java │ ├── IReceiver.java │ ├── IReceiverGroup.java │ ├── OnReceiverEventListener.java │ ├── PlayerStateGetter.java │ ├── ReceiverGroup.java │ ├── StateGetter.java │ └── ValueInter.java │ ├── record │ ├── DefaultRecordKeyProvider.java │ ├── OnRecordCallBack.java │ ├── PlayRecord.java │ ├── PlayRecordManager.java │ ├── PlayValueGetter.java │ ├── RecordCache.java │ ├── RecordInvoker.java │ ├── RecordKeyProvider.java │ └── RecordProxyPlayer.java │ ├── render │ ├── AspectRatio.java │ ├── IRender.java │ ├── RenderMeasure.java │ ├── RenderSurfaceView.java │ └── RenderTextureView.java │ ├── style │ ├── IStyleSetter.java │ ├── StyleSetter.java │ ├── ViewOvalRectOutlineProvider.java │ └── ViewRoundRectOutlineProvider.java │ ├── touch │ ├── BaseGestureCallbackHandler.java │ ├── ContainerTouchHelper.java │ ├── OnTouchGestureListener.java │ └── TouchEventIndicator.java │ ├── utils │ ├── NetworkUtils.java │ ├── PUtils.java │ ├── RectUtils.java │ └── TimeUtil.java │ ├── widget │ ├── BaseVideoView.java │ ├── IVideoView.java │ └── SuperContainer.java │ └── window │ ├── FloatWindow.java │ ├── FloatWindowParams.java │ ├── IWindow.java │ ├── WindowHelper.java │ └── WindowVideoView.java ├── screenshot ├── Screenshot_001.jpeg ├── Screenshot_002.jpeg ├── Screenshot_003.jpeg ├── Screenshot_004.jpeg ├── Screenshot_005.jpeg ├── Screenshot_006.jpeg ├── frame_structure01.jpg ├── frame_structure02.png ├── frame_structure03.png ├── frame_structure04.png ├── mtime.png ├── piaoshen.png ├── playerbase_top_slogen.png ├── qrcode.png ├── qrcode_qq_group.jpg ├── receiver_cover_life_cycle.jpg ├── widget_struct.jpg └── yingmidayuan.png └── settings.gradle /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiajunhui/PlayerBase/35e204437766f95dfce9e0449625584a7c64bc7f/.DS_Store -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # Files for the ART/Dalvik VM 6 | *.dex 7 | 8 | # Java class files 9 | *.class 10 | 11 | # Generated files 12 | bin/ 13 | gen/ 14 | out/ 15 | 16 | # Gradle files 17 | .gradle/ 18 | build/ 19 | 20 | # Local configuration file (sdk path, etc) 21 | local.properties 22 | 23 | # Proguard folder generated by Eclipse 24 | proguard/ 25 | 26 | # Log Files 27 | *.log 28 | 29 | # Android Studio Navigation editor temp files 30 | .navigation/ 31 | 32 | # Android Studio captures folder 33 | captures/ 34 | 35 | # Intellij 36 | *.iml 37 | .idea/ 38 | 39 | # Keystore files 40 | *.jks 41 | -------------------------------------------------------------------------------- /app/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiajunhui/PlayerBase/35e204437766f95dfce9e0449625584a7c64bc7f/app/.DS_Store -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 28 5 | defaultConfig { 6 | applicationId "com.kk.taurus.avplayer" 7 | minSdkVersion 16 8 | targetSdkVersion 28 9 | versionCode 1 10 | versionName "1.0" 11 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 12 | ndk { 13 | //目前手机主流cpu架构是armeabi-v7a,所以通常情况下只考虑armeabi-v7a(除非特殊情况,比如TBS只有armeabi so库) 14 | // https://zhuanlan.zhihu.com/p/26833002 15 | // 1,如果同时保留 armeabi 和 armeabi-v7a 两个文件夹,则必须保证这两个文件夹中 .so 数量一致 16 | // 2,如果只存在armeabi-v7a,则对只提供 armeabi 版本的第三方 .so,原样复制一份到 armeabi-v7a 文件夹 17 | abiFilters 'armeabi-v7a' 18 | } 19 | } 20 | buildTypes { 21 | release { 22 | minifyEnabled true 23 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 24 | } 25 | compileOptions{ 26 | sourceCompatibility JavaVersion.VERSION_1_8 27 | targetCompatibility JavaVersion.VERSION_1_8 28 | } 29 | } 30 | 31 | lintOptions{ 32 | abortOnError false 33 | } 34 | 35 | } 36 | 37 | dependencies { 38 | implementation fileTree(include: ['*.jar'], dir: 'libs') 39 | implementation 'androidx.appcompat:appcompat:1.1.0' 40 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3' 41 | testImplementation 'junit:junit:4.12' 42 | androidTestImplementation 'androidx.test:runner:1.2.0' 43 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' 44 | implementation 'com.jiajunhui.xapp.medialoader:medialoader:1.2.1' 45 | implementation 'androidx.recyclerview:recyclerview:1.1.0' 46 | implementation 'com.lovedise:permissiongen:0.0.6' 47 | implementation 'com.github.bumptech.glide:glide:4.9.0' 48 | annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0' 49 | implementation 'com.jakewharton:butterknife:10.1.0' 50 | annotationProcessor 'com.jakewharton:butterknife-compiler:10.1.0' 51 | debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.5.4' 52 | releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.4' 53 | implementation project(':exoplayer') 54 | implementation project(':ijkplayer') 55 | implementation 'com.google.android.material:material:1.0.0' 56 | 57 | implementation 'com.github.ctiao:DanmakuFlameMaster:0.9.25' 58 | implementation 'com.github.ctiao:ndkbitmap-armv7a:0.9.21' 59 | 60 | implementation 'com.google.android.exoplayer:extension-rtmp:2.12.2' 61 | 62 | } 63 | -------------------------------------------------------------------------------- /app/libs/logtools.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiajunhui/PlayerBase/35e204437766f95dfce9e0449625584a7c64bc7f/app/libs/logtools.jar -------------------------------------------------------------------------------- /app/src/androidTest/java/com/kk/taurus/avplayer/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.kk.taurus.avplayer; 2 | 3 | import android.content.Context; 4 | import androidx.test.InstrumentationRegistry; 5 | import androidx.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumented test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.kk.taurus.avplayer", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/assets/video/big_buck_bunny.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiajunhui/PlayerBase/35e204437766f95dfce9e0449625584a7c64bc7f/app/src/main/assets/video/big_buck_bunny.mp4 -------------------------------------------------------------------------------- /app/src/main/java/com/kk/taurus/avplayer/adapter/OnItemClickListener.java: -------------------------------------------------------------------------------- 1 | package com.kk.taurus.avplayer.adapter; 2 | 3 | import androidx.recyclerview.widget.RecyclerView; 4 | 5 | public interface OnItemClickListener { 6 | 7 | void onItemClick(H holder, T item, int position); 8 | 9 | } 10 | -------------------------------------------------------------------------------- /app/src/main/java/com/kk/taurus/avplayer/adapter/PlayPagerAdapter.java: -------------------------------------------------------------------------------- 1 | package com.kk.taurus.avplayer.adapter; 2 | 3 | import android.content.Context; 4 | import androidx.annotation.NonNull; 5 | import androidx.viewpager.widget.PagerAdapter; 6 | import android.view.View; 7 | import android.view.ViewGroup; 8 | import android.widget.FrameLayout; 9 | import android.widget.ImageView; 10 | 11 | import com.kk.taurus.avplayer.R; 12 | import com.kk.taurus.avplayer.bean.VideoBean; 13 | import com.kk.taurus.avplayer.utils.GlideApp; 14 | 15 | import java.util.List; 16 | 17 | public class PlayPagerAdapter extends PagerAdapter { 18 | 19 | private Context mContext; 20 | private List mItems; 21 | 22 | public PlayPagerAdapter(Context context, List list){ 23 | this.mContext = context; 24 | this.mItems = list; 25 | } 26 | 27 | @Override 28 | public int getCount() { 29 | if(mItems!=null) 30 | return mItems.size(); 31 | return 0; 32 | } 33 | 34 | @NonNull 35 | @Override 36 | public Object instantiateItem(@NonNull ViewGroup container, int position) { 37 | VideoBean bean = mItems.get(position); 38 | View itemView = View.inflate(mContext, R.layout.item_pager_play, null); 39 | FrameLayout playerContainer = itemView.findViewById(R.id.playerContainer); 40 | playerContainer.setTag(bean.getPath()); 41 | ImageView coverView = itemView.findViewById(R.id.iv_cover); 42 | GlideApp.with(mContext) 43 | .load(bean.getPath()) 44 | .centerInside() 45 | .into(coverView); 46 | container.addView(itemView); 47 | return itemView; 48 | } 49 | 50 | @Override 51 | public boolean isViewFromObject(@NonNull View view, @NonNull Object object) { 52 | return view == object; 53 | } 54 | 55 | @Override 56 | public void destroyItem(@NonNull ViewGroup container, int position, @NonNull Object object) { 57 | container.removeView((View) object); 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /app/src/main/java/com/kk/taurus/avplayer/adapter/SettingAdapter.java: -------------------------------------------------------------------------------- 1 | package com.kk.taurus.avplayer.adapter; 2 | 3 | import android.content.Context; 4 | import android.graphics.Color; 5 | import androidx.annotation.NonNull; 6 | import androidx.recyclerview.widget.RecyclerView; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | import android.widget.TextView; 10 | 11 | import com.kk.taurus.avplayer.R; 12 | 13 | import java.util.List; 14 | 15 | import com.kk.taurus.avplayer.bean.SettingItem; 16 | 17 | public class SettingAdapter extends RecyclerView.Adapter { 18 | 19 | private Context mContext; 20 | private List mItems; 21 | 22 | private OnItemClickListener onItemClickListener; 23 | 24 | public SettingAdapter(Context context, List list){ 25 | this.mContext = context; 26 | this.mItems = list; 27 | } 28 | 29 | public void setOnItemClickListener(OnItemClickListener onItemClickListener) { 30 | this.onItemClickListener = onItemClickListener; 31 | } 32 | 33 | @NonNull 34 | @Override 35 | public SettingItemHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { 36 | return new SettingItemHolder(View.inflate(mContext, R.layout.item_setting, null)); 37 | } 38 | 39 | @Override 40 | public void onBindViewHolder(@NonNull final SettingItemHolder holder, final int position) { 41 | final SettingItem item = mItems.get(position); 42 | holder.itemView.setBackgroundColor((item.getCode()/100)%2==0?Color.WHITE:Color.parseColor("#EEEEEE")); 43 | holder.settingText.setText(item.getItemText()); 44 | 45 | holder.itemView.setOnClickListener(new View.OnClickListener() { 46 | @Override 47 | public void onClick(View v) { 48 | onItemClickListener.onItemClick(holder, item, position); 49 | } 50 | }); 51 | } 52 | 53 | @Override 54 | public int getItemCount() { 55 | if(mItems!=null) 56 | return mItems.size(); 57 | return 0; 58 | } 59 | 60 | public static class SettingItemHolder extends RecyclerView.ViewHolder{ 61 | 62 | TextView settingText; 63 | 64 | public SettingItemHolder(View itemView) { 65 | super(itemView); 66 | settingText = itemView.findViewById(R.id.settingText); 67 | } 68 | 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /app/src/main/java/com/kk/taurus/avplayer/adapter/VideoListPagerAdapter.java: -------------------------------------------------------------------------------- 1 | package com.kk.taurus.avplayer.adapter; 2 | 3 | import androidx.annotation.Nullable; 4 | import androidx.fragment.app.Fragment; 5 | import androidx.fragment.app.FragmentManager; 6 | import androidx.fragment.app.FragmentStatePagerAdapter; 7 | 8 | import com.kk.taurus.avplayer.ui.fragment.VideoListFragment; 9 | 10 | import java.util.List; 11 | 12 | public class VideoListPagerAdapter extends FragmentStatePagerAdapter { 13 | 14 | private List mFragments; 15 | 16 | public VideoListPagerAdapter(FragmentManager fm, List fragments) { 17 | super(fm); 18 | mFragments = fragments; 19 | } 20 | 21 | @Override 22 | public Fragment getItem(int position) { 23 | return mFragments.get(position); 24 | } 25 | 26 | @Nullable 27 | @Override 28 | public CharSequence getPageTitle(int position) { 29 | return "列表" + (position + 1); 30 | } 31 | 32 | @Override 33 | public int getCount() { 34 | if(mFragments==null) 35 | return 0; 36 | return mFragments.size(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /app/src/main/java/com/kk/taurus/avplayer/base/ISPayer.java: -------------------------------------------------------------------------------- 1 | package com.kk.taurus.avplayer.base; 2 | 3 | 4 | import android.view.ViewGroup; 5 | 6 | import com.kk.taurus.playerbase.entity.DataSource; 7 | import com.kk.taurus.playerbase.event.OnErrorEventListener; 8 | import com.kk.taurus.playerbase.event.OnPlayerEventListener; 9 | import com.kk.taurus.playerbase.provider.IDataProvider; 10 | import com.kk.taurus.playerbase.receiver.GroupValue; 11 | import com.kk.taurus.playerbase.receiver.IReceiver; 12 | import com.kk.taurus.playerbase.receiver.IReceiverGroup; 13 | import com.kk.taurus.playerbase.receiver.OnReceiverEventListener; 14 | 15 | /** 16 | * Created by JiaJunHui on 2018/6/21. 17 | */ 18 | public interface ISPayer { 19 | 20 | int RECEIVER_GROUP_CONFIG_SILENCE_STATE = 1; 21 | int RECEIVER_GROUP_CONFIG_LIST_STATE = 2; 22 | int RECEIVER_GROUP_CONFIG_DETAIL_PORTRAIT_STATE = 3; 23 | int RECEIVER_GROUP_CONFIG_FULL_SCREEN_STATE = 4; 24 | 25 | void addOnPlayerEventListener(OnPlayerEventListener onPlayerEventListener); 26 | 27 | boolean removePlayerEventListener(OnPlayerEventListener onPlayerEventListener); 28 | 29 | void addOnErrorEventListener(OnErrorEventListener onErrorEventListener); 30 | 31 | boolean removeErrorEventListener(OnErrorEventListener onErrorEventListener); 32 | 33 | void addOnReceiverEventListener(OnReceiverEventListener onReceiverEventListener); 34 | 35 | boolean removeReceiverEventListener(OnReceiverEventListener onReceiverEventListener); 36 | 37 | void setReceiverGroup(IReceiverGroup receiverGroup); 38 | 39 | IReceiverGroup getReceiverGroup(); 40 | 41 | void removeReceiver(String receiverKey); 42 | 43 | void addReceiver(String key, IReceiver receiver); 44 | 45 | void attachContainer(ViewGroup userContainer); 46 | 47 | void play(DataSource dataSource); 48 | 49 | void play(DataSource dataSource, boolean updateRender); 50 | 51 | void setDataProvider(IDataProvider dataProvider); 52 | 53 | GroupValue getGroupValue(); 54 | 55 | void updateGroupValue(String key, Object value); 56 | 57 | void registerOnGroupValueUpdateListener(IReceiverGroup.OnGroupValueUpdateListener onGroupValueUpdateListener); 58 | 59 | void unregisterOnGroupValueUpdateListener(IReceiverGroup.OnGroupValueUpdateListener onGroupValueUpdateListener); 60 | 61 | boolean isInPlaybackState(); 62 | 63 | boolean isPlaying(); 64 | 65 | int getCurrentPosition(); 66 | 67 | int getState(); 68 | 69 | void pause(); 70 | 71 | void resume(); 72 | 73 | void stop(); 74 | 75 | void reset(); 76 | 77 | void rePlay(int position); 78 | 79 | void destroy() ; 80 | 81 | } 82 | -------------------------------------------------------------------------------- /app/src/main/java/com/kk/taurus/avplayer/bean/RecyclerBaseVideoBean.java: -------------------------------------------------------------------------------- 1 | package com.kk.taurus.avplayer.bean; 2 | 3 | import com.kk.taurus.avplayer.utils.DataUtils; 4 | 5 | import java.util.ArrayList; 6 | import java.util.List; 7 | 8 | /** 9 | * @author KaraShokZ (张耀中) 10 | * DESCRIPTION 11 | * @name RecyclerBaseVideoBean 12 | * @date 2021/01/15 14:51 13 | */ 14 | public class RecyclerBaseVideoBean { 15 | 16 | public static final List getItemList(){ 17 | List itemList = new ArrayList<>(); 18 | itemList.add(new RecyclerBaseVideoBean(1)); 19 | for (int i = 0; i < 50; i++){ 20 | itemList.add(new RecyclerBaseVideoBean()); 21 | } 22 | return itemList; 23 | } 24 | public int itemType; 25 | public String videoUrl = DataUtils.VIDEO_URL_09,itemStr = "音乐和艺术如何改变世界"; 26 | 27 | public RecyclerBaseVideoBean(int itemType) { 28 | this.itemType = itemType; 29 | } 30 | 31 | public RecyclerBaseVideoBean() { 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /app/src/main/java/com/kk/taurus/avplayer/bean/VideoBean.java: -------------------------------------------------------------------------------- 1 | package com.kk.taurus.avplayer.bean; 2 | 3 | import java.io.Serializable; 4 | 5 | public class VideoBean implements Serializable { 6 | 7 | private String displayName; 8 | private String cover; 9 | private String path; 10 | 11 | public VideoBean() { 12 | } 13 | 14 | public VideoBean(String displayName, String cover, String path) { 15 | this.displayName = displayName; 16 | this.cover = cover; 17 | this.path = path; 18 | } 19 | 20 | public VideoBean(String displayName, String path) { 21 | this.displayName = displayName; 22 | this.path = path; 23 | } 24 | 25 | public String getDisplayName() { 26 | return displayName; 27 | } 28 | 29 | public void setDisplayName(String displayName) { 30 | this.displayName = displayName; 31 | } 32 | 33 | public String getCover() { 34 | return cover; 35 | } 36 | 37 | public void setCover(String cover) { 38 | this.cover = cover; 39 | } 40 | 41 | public String getPath() { 42 | return path; 43 | } 44 | 45 | public void setPath(String path) { 46 | this.path = path; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /app/src/main/java/com/kk/taurus/avplayer/cover/CloseCover.java: -------------------------------------------------------------------------------- 1 | package com.kk.taurus.avplayer.cover; 2 | 3 | import android.content.Context; 4 | import android.os.Bundle; 5 | import android.view.View; 6 | import android.widget.ImageView; 7 | 8 | import com.kk.taurus.avplayer.R; 9 | import com.kk.taurus.avplayer.play.DataInter; 10 | import com.kk.taurus.playerbase.receiver.BaseCover; 11 | 12 | import butterknife.BindView; 13 | import butterknife.ButterKnife; 14 | import butterknife.OnClick; 15 | import butterknife.Unbinder; 16 | 17 | public class CloseCover extends BaseCover { 18 | 19 | @BindView(R.id.iv_close) 20 | ImageView mCloseIcon; 21 | 22 | private Unbinder unbinder; 23 | 24 | public CloseCover(Context context) { 25 | super(context); 26 | } 27 | 28 | @Override 29 | public void onReceiverBind() { 30 | super.onReceiverBind(); 31 | unbinder = ButterKnife.bind(this, getView()); 32 | } 33 | 34 | @OnClick({R.id.iv_close}) 35 | public void onViewClick(View view){ 36 | notifyReceiverEvent(DataInter.Event.EVENT_CODE_REQUEST_CLOSE, null); 37 | } 38 | 39 | @Override 40 | public void onReceiverUnBind() { 41 | super.onReceiverUnBind(); 42 | unbinder.unbind(); 43 | } 44 | 45 | @Override 46 | public View onCreateCoverView(Context context) { 47 | return View.inflate(context, R.layout.layout_close_cover, null); 48 | } 49 | 50 | @Override 51 | public void onPlayerEvent(int eventCode, Bundle bundle) { 52 | 53 | } 54 | 55 | @Override 56 | public void onErrorEvent(int eventCode, Bundle bundle) { 57 | 58 | } 59 | 60 | @Override 61 | public void onReceiverEvent(int eventCode, Bundle bundle) { 62 | 63 | } 64 | 65 | @Override 66 | public int getCoverLevel() { 67 | return levelMedium(10); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /app/src/main/java/com/kk/taurus/avplayer/cover/LoadingCover.java: -------------------------------------------------------------------------------- 1 | package com.kk.taurus.avplayer.cover; 2 | 3 | import android.content.Context; 4 | import android.os.Bundle; 5 | import android.view.View; 6 | 7 | import com.kk.taurus.avplayer.R; 8 | import com.kk.taurus.playerbase.event.OnPlayerEventListener; 9 | import com.kk.taurus.playerbase.player.IPlayer; 10 | import com.kk.taurus.playerbase.receiver.BaseCover; 11 | import com.kk.taurus.playerbase.receiver.PlayerStateGetter; 12 | 13 | /** 14 | * Created by Taurus on 2018/4/15. 15 | */ 16 | 17 | public class LoadingCover extends BaseCover { 18 | 19 | public LoadingCover(Context context) { 20 | super(context); 21 | } 22 | 23 | @Override 24 | protected void onCoverAttachedToWindow() { 25 | super.onCoverAttachedToWindow(); 26 | PlayerStateGetter playerStateGetter = getPlayerStateGetter(); 27 | if(playerStateGetter!=null && isInPlaybackState(playerStateGetter)){ 28 | setLoadingState(playerStateGetter.isBuffering()); 29 | } 30 | } 31 | 32 | private boolean isInPlaybackState(PlayerStateGetter playerStateGetter){ 33 | int state = playerStateGetter.getState(); 34 | return state!= IPlayer.STATE_END 35 | && state!= IPlayer.STATE_ERROR 36 | && state!= IPlayer.STATE_IDLE 37 | && state!= IPlayer.STATE_INITIALIZED 38 | && state!= IPlayer.STATE_STOPPED; 39 | } 40 | 41 | @Override 42 | public void onPlayerEvent(int eventCode, Bundle bundle) { 43 | switch (eventCode){ 44 | case OnPlayerEventListener.PLAYER_EVENT_ON_BUFFERING_START: 45 | case OnPlayerEventListener.PLAYER_EVENT_ON_DATA_SOURCE_SET: 46 | case OnPlayerEventListener.PLAYER_EVENT_ON_PROVIDER_DATA_START: 47 | case OnPlayerEventListener.PLAYER_EVENT_ON_SEEK_TO: 48 | setLoadingState(true); 49 | break; 50 | 51 | case OnPlayerEventListener.PLAYER_EVENT_ON_VIDEO_RENDER_START: 52 | case OnPlayerEventListener.PLAYER_EVENT_ON_BUFFERING_END: 53 | case OnPlayerEventListener.PLAYER_EVENT_ON_STOP: 54 | case OnPlayerEventListener.PLAYER_EVENT_ON_PROVIDER_DATA_ERROR: 55 | case OnPlayerEventListener.PLAYER_EVENT_ON_SEEK_COMPLETE: 56 | setLoadingState(false); 57 | break; 58 | } 59 | } 60 | 61 | @Override 62 | public void onErrorEvent(int eventCode, Bundle bundle) { 63 | setLoadingState(false); 64 | } 65 | 66 | @Override 67 | public void onReceiverEvent(int eventCode, Bundle bundle) { 68 | 69 | } 70 | 71 | private void setLoadingState(boolean show){ 72 | setCoverVisibility(show?View.VISIBLE:View.GONE); 73 | } 74 | 75 | @Override 76 | public View onCreateCoverView(Context context) { 77 | return View.inflate(context, R.layout.layout_loading_cover, null); 78 | } 79 | 80 | @Override 81 | public int getCoverLevel() { 82 | return levelMedium(1); 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /app/src/main/java/com/kk/taurus/avplayer/play/DataInter.java: -------------------------------------------------------------------------------- 1 | package com.kk.taurus.avplayer.play; 2 | 3 | import com.kk.taurus.playerbase.assist.InterEvent; 4 | import com.kk.taurus.playerbase.assist.InterKey; 5 | 6 | public interface DataInter { 7 | 8 | interface Event extends InterEvent{ 9 | 10 | int EVENT_CODE_REQUEST_BACK = -100; 11 | int EVENT_CODE_REQUEST_CLOSE = -101; 12 | 13 | int EVENT_CODE_REQUEST_TOGGLE_SCREEN = -104; 14 | 15 | int EVENT_CODE_ERROR_SHOW = -111; 16 | 17 | } 18 | 19 | interface Key extends InterKey{ 20 | 21 | String KEY_IS_LANDSCAPE = "isLandscape"; 22 | 23 | String KEY_DATA_SOURCE = "data_source"; 24 | 25 | String KEY_ERROR_SHOW = "error_show"; 26 | 27 | String KEY_COMPLETE_SHOW = "complete_show"; 28 | String KEY_CONTROLLER_TOP_ENABLE = "controller_top_enable"; 29 | String KEY_CONTROLLER_SCREEN_SWITCH_ENABLE = "screen_switch_enable"; 30 | 31 | String KEY_TIMER_UPDATE_ENABLE = "timer_update_enable"; 32 | 33 | String KEY_NETWORK_RESOURCE = "network_resource"; 34 | 35 | } 36 | 37 | interface ReceiverKey{ 38 | String KEY_LOADING_COVER = "loading_cover"; 39 | String KEY_CONTROLLER_COVER = "controller_cover"; 40 | String KEY_GESTURE_COVER = "gesture_cover"; 41 | String KEY_COMPLETE_COVER = "complete_cover"; 42 | String KEY_ERROR_COVER = "error_cover"; 43 | String KEY_CLOSE_COVER = "close_cover"; 44 | String KEY_DANMU_COVER = "danmu_cover"; 45 | } 46 | 47 | interface PrivateEvent{ 48 | int EVENT_CODE_UPDATE_SEEK = -201; 49 | } 50 | 51 | interface ProducerEvent{ 52 | 53 | int ADD_DANMU_DATA = -301; 54 | 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /app/src/main/java/com/kk/taurus/avplayer/play/DemoDataProvider.java: -------------------------------------------------------------------------------- 1 | package com.kk.taurus.avplayer.play; 2 | 3 | import android.os.Handler; 4 | import android.os.Looper; 5 | import android.text.TextUtils; 6 | 7 | import com.kk.taurus.avplayer.utils.DataUtils; 8 | import com.kk.taurus.playerbase.entity.DataSource; 9 | import com.kk.taurus.playerbase.provider.BaseDataProvider; 10 | 11 | public class DemoDataProvider extends BaseDataProvider { 12 | 13 | private Handler mHandler = new Handler(Looper.getMainLooper()); 14 | private Runnable mDelayRunnable; 15 | 16 | @Override 17 | public void handleSourceData(final DataSource sourceData) { 18 | if(TextUtils.isEmpty(sourceData.getData())){ 19 | cancel(); 20 | //模拟请求数据的过程 21 | mHandler.postDelayed(mDelayRunnable = new Runnable() { 22 | @Override 23 | public void run() { 24 | DataSource data = new DataSource(DataUtils.VIDEO_URL_08); 25 | data.setTitle("音乐和艺术如何改变世界"); 26 | //success result data 27 | onProviderMediaDataSuccess(data); 28 | //if occur error, you can call this method 29 | //onProviderMediaDataError(bundle); 30 | } 31 | }, 1000); 32 | }else{ 33 | onProviderMediaDataSuccess(sourceData); 34 | } 35 | } 36 | 37 | @Override 38 | public void cancel() { 39 | if(mDelayRunnable!=null) 40 | mHandler.removeCallbacks(mDelayRunnable); 41 | } 42 | 43 | @Override 44 | public void destroy() { 45 | cancel(); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /app/src/main/java/com/kk/taurus/avplayer/play/OnHandleListener.java: -------------------------------------------------------------------------------- 1 | package com.kk.taurus.avplayer.play; 2 | 3 | public interface OnHandleListener { 4 | 5 | void onBack(); 6 | void onToggleScreen(); 7 | 8 | } 9 | -------------------------------------------------------------------------------- /app/src/main/java/com/kk/taurus/avplayer/ui/RecyclerBaseVideoActivity.java: -------------------------------------------------------------------------------- 1 | package com.kk.taurus.avplayer.ui; 2 | 3 | import androidx.appcompat.app.AppCompatActivity; 4 | import androidx.recyclerview.widget.LinearLayoutManager; 5 | import androidx.recyclerview.widget.RecyclerView; 6 | 7 | import android.os.Bundle; 8 | 9 | import com.kk.taurus.avplayer.R; 10 | import com.kk.taurus.avplayer.adapter.RecyclerBaseVideoContentAdapter; 11 | import com.kk.taurus.avplayer.bean.RecyclerBaseVideoBean; 12 | 13 | public class RecyclerBaseVideoActivity extends AppCompatActivity { 14 | 15 | RecyclerBaseVideoContentAdapter mAdapter; 16 | 17 | @Override 18 | protected void onCreate(Bundle savedInstanceState) { 19 | super.onCreate(savedInstanceState); 20 | setContentView(R.layout.activity_recycler_base_video); 21 | RecyclerView contentRv = findViewById(R.id.content_rv); 22 | contentRv.setLayoutManager(new LinearLayoutManager(this)); 23 | contentRv.setAdapter(mAdapter = new RecyclerBaseVideoContentAdapter(RecyclerBaseVideoBean.getItemList())); 24 | } 25 | 26 | @Override 27 | protected void onDestroy() { 28 | super.onDestroy(); 29 | mAdapter.onDestroy(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /app/src/main/java/com/kk/taurus/avplayer/ui/ShareAnimationActivityB.java: -------------------------------------------------------------------------------- 1 | package com.kk.taurus.avplayer.ui; 2 | 3 | import android.os.Bundle; 4 | import androidx.annotation.Nullable; 5 | import androidx.appcompat.app.AppCompatActivity; 6 | import android.view.WindowManager; 7 | import android.widget.RelativeLayout; 8 | 9 | import com.kk.taurus.avplayer.R; 10 | import com.kk.taurus.avplayer.play.ShareAnimationPlayer; 11 | import com.kk.taurus.playerbase.entity.DataSource; 12 | 13 | import butterknife.BindView; 14 | import butterknife.ButterKnife; 15 | 16 | public class ShareAnimationActivityB extends AppCompatActivity { 17 | 18 | public static final String KEY_DATA = "data_source"; 19 | 20 | @BindView(R.id.top_container) 21 | RelativeLayout mTopContainer; 22 | 23 | @Override 24 | protected void onCreate(@Nullable Bundle savedInstanceState) { 25 | super.onCreate(savedInstanceState); 26 | setContentView(R.layout.activity_share_animation_b); 27 | ButterKnife.bind(this); 28 | 29 | getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); 30 | 31 | DataSource dataSource = (DataSource) getIntent().getSerializableExtra(KEY_DATA); 32 | 33 | DataSource useData = null; 34 | DataSource playData = ShareAnimationPlayer.get().getDataSource(); 35 | boolean dataChange = playData!=null && !playData.getData().equals(dataSource.getData()); 36 | if(!ShareAnimationPlayer.get().isInPlaybackState() || dataChange){ 37 | useData = dataSource; 38 | } 39 | 40 | ShareAnimationPlayer.get().play(mTopContainer, useData); 41 | 42 | } 43 | 44 | @Override 45 | protected void onDestroy() { 46 | super.onDestroy(); 47 | ShareAnimationPlayer.get().destroy(); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /app/src/main/java/com/kk/taurus/avplayer/ui/SplashActivity.java: -------------------------------------------------------------------------------- 1 | package com.kk.taurus.avplayer.ui; 2 | 3 | import android.Manifest; 4 | import android.content.Intent; 5 | import android.os.Bundle; 6 | import android.os.Handler; 7 | import android.os.Looper; 8 | import androidx.annotation.Nullable; 9 | import androidx.appcompat.app.AppCompatActivity; 10 | import android.widget.Toast; 11 | 12 | import com.kk.taurus.avplayer.R; 13 | 14 | import com.kk.taurus.avplayer.HomeActivity; 15 | import kr.co.namee.permissiongen.PermissionFail; 16 | import kr.co.namee.permissiongen.PermissionGen; 17 | import kr.co.namee.permissiongen.PermissionSuccess; 18 | 19 | /** 20 | * Created by Taurus on 2018/4/19. 21 | */ 22 | 23 | public class SplashActivity extends AppCompatActivity { 24 | 25 | @Override 26 | protected void onCreate(@Nullable Bundle savedInstanceState) { 27 | super.onCreate(savedInstanceState); 28 | setContentView(R.layout.activity_splash); 29 | 30 | new Handler(Looper.getMainLooper()).postDelayed(new Runnable() { 31 | @Override 32 | public void run() { 33 | PermissionGen.with(SplashActivity.this) 34 | .addRequestCode(100) 35 | .permissions( 36 | Manifest.permission.READ_EXTERNAL_STORAGE, 37 | Manifest.permission.WRITE_EXTERNAL_STORAGE, 38 | Manifest.permission.RECORD_AUDIO, 39 | Manifest.permission.MODIFY_AUDIO_SETTINGS 40 | ) 41 | .request(); 42 | } 43 | }, 1000); 44 | } 45 | 46 | @Override 47 | public void onRequestPermissionsResult(int requestCode, String[] permissions, 48 | int[] grantResults) { 49 | PermissionGen.onRequestPermissionsResult(this, requestCode, permissions, grantResults); 50 | } 51 | 52 | @PermissionSuccess(requestCode = 100) 53 | public void permissionSuccess() { 54 | intentToMainPage(); 55 | } 56 | 57 | @PermissionFail(requestCode = 100) 58 | public void permissionFailure(){ 59 | Toast.makeText(this, "权限拒绝,无法正常使用", Toast.LENGTH_LONG).show(); 60 | 61 | } 62 | 63 | private void intentToMainPage() { 64 | Intent intent = new Intent(getApplicationContext(), HomeActivity.class); 65 | startActivity(intent); 66 | finish(); 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /app/src/main/java/com/kk/taurus/avplayer/utils/ImageDisplayEngine.java: -------------------------------------------------------------------------------- 1 | package com.kk.taurus.avplayer.utils; 2 | 3 | import android.content.Context; 4 | import android.graphics.Bitmap; 5 | import android.graphics.drawable.BitmapDrawable; 6 | import android.graphics.drawable.Drawable; 7 | import androidx.annotation.NonNull; 8 | import androidx.annotation.Nullable; 9 | import android.widget.ImageView; 10 | 11 | import com.bumptech.glide.request.target.SimpleTarget; 12 | import com.bumptech.glide.request.transition.Transition; 13 | 14 | /** 15 | * Created by Taurus on 2017/5/20. 16 | */ 17 | 18 | public class ImageDisplayEngine { 19 | 20 | public static void display(Context context, ImageView view, String path, int defaultHolder){ 21 | GlideApp.with(context) 22 | .load(path) 23 | .centerCrop() 24 | .placeholder(defaultHolder) 25 | .into(view); 26 | } 27 | 28 | public static void displayNoCenterCrop(Context context, ImageView view, String path, int defaultHolder){ 29 | GlideApp.with(context) 30 | .load(path) 31 | .placeholder(defaultHolder) 32 | .into(view); 33 | } 34 | 35 | public static void displayAsBitmap(Context context, ImageView view, String path, int defaultHolder){ 36 | GlideApp.with(context) 37 | .load(path) 38 | .centerCrop() 39 | .placeholder(defaultHolder) 40 | .into(view); 41 | } 42 | 43 | public static void displayAsBitmap(Context context, String path, final OnBitmapResourceCallBack callBack){ 44 | GlideApp.with(context) 45 | .load(path) 46 | .dontAnimate() 47 | .into(new SimpleTarget() { 48 | @Override 49 | public void onResourceReady(@NonNull Drawable resource, @Nullable Transition transition) { 50 | if(callBack!=null){ 51 | BitmapDrawable bitmapDrawable = (BitmapDrawable) resource; 52 | Bitmap bitmap = null; 53 | if(bitmapDrawable!=null){ 54 | bitmap = bitmapDrawable.getBitmap(); 55 | } 56 | callBack.onResourceReady(bitmap); 57 | } 58 | } 59 | }); 60 | } 61 | 62 | public interface OnBitmapResourceCallBack{ 63 | void onResourceReady(Bitmap bitmap); 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /app/src/main/java/com/kk/taurus/avplayer/utils/MediaGlideModule.java: -------------------------------------------------------------------------------- 1 | package com.kk.taurus.avplayer.utils; 2 | 3 | import com.bumptech.glide.annotation.GlideModule; 4 | import com.bumptech.glide.module.AppGlideModule; 5 | 6 | @GlideModule 7 | public class MediaGlideModule extends AppGlideModule { 8 | 9 | 10 | 11 | } 12 | -------------------------------------------------------------------------------- /app/src/main/java/com/kk/taurus/avplayer/utils/RandomUtils.java: -------------------------------------------------------------------------------- 1 | package com.kk.taurus.avplayer.utils; 2 | 3 | import java.util.Random; 4 | 5 | /** 6 | * author: jiajunhui 7 | * date: 2019/5/29 9:45 8 | * email: junhui.jia@wm-motor.com 9 | * Description: 随机数或随机字符工具 10 | */ 11 | public class RandomUtils { 12 | 13 | /** 14 | * 获取指定位数的随机数字 15 | * @param len 16 | * @return 17 | */ 18 | public static String getRandomNumberStr(int len){ 19 | if(len < 1) 20 | return ""; 21 | StringBuilder sb = new StringBuilder(); 22 | for(int i=0;i= Build.VERSION_CODES.M 14 | && !Settings.canDrawOverlays(activity)) { 15 | Toast.makeText(activity, "当前无权限,请授权", Toast.LENGTH_SHORT).show(); 16 | activity.startActivityForResult( 17 | new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION, 18 | Uri.parse("package:" + activity.getPackageName())), 0); 19 | return false; 20 | } 21 | return true; 22 | } 23 | 24 | public static void onActivityResult(Activity activity, 25 | int requestCode, 26 | int resultCode, 27 | Intent data, 28 | OnWindowPermissionListener onWindowPermissionListener) { 29 | if (requestCode == 0) { 30 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M 31 | && !Settings.canDrawOverlays(activity)) { 32 | Toast.makeText(activity.getApplicationContext(), "授权失败", Toast.LENGTH_SHORT).show(); 33 | if(onWindowPermissionListener!=null) 34 | onWindowPermissionListener.onFailure(); 35 | }else { 36 | Toast.makeText(activity.getApplicationContext(), "授权成功", Toast.LENGTH_SHORT).show(); 37 | if(onWindowPermissionListener!=null) 38 | onWindowPermissionListener.onSuccess(); 39 | } 40 | } 41 | } 42 | 43 | public interface OnWindowPermissionListener{ 44 | void onSuccess(); 45 | void onFailure(); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/armeabi-v7a/libijkffmpeg.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiajunhui/PlayerBase/35e204437766f95dfce9e0449625584a7c64bc7f/app/src/main/jniLibs/armeabi-v7a/libijkffmpeg.so -------------------------------------------------------------------------------- /app/src/main/jniLibs/armeabi-v7a/libijkplayer.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiajunhui/PlayerBase/35e204437766f95dfce9e0449625584a7c64bc7f/app/src/main/jniLibs/armeabi-v7a/libijkplayer.so -------------------------------------------------------------------------------- /app/src/main/jniLibs/armeabi-v7a/libijksdl.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiajunhui/PlayerBase/35e204437766f95dfce9e0449625584a7c64bc7f/app/src/main/jniLibs/armeabi-v7a/libijksdl.so -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 12 | 13 | 19 | 22 | 25 | 26 | 27 | 28 | 34 | 35 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/selector_play_state.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/selector_seek_bar_thumb.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/shape_controller_bottom_gradient.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/shape_controller_top_gradient.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/shape_next.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/shape_replay.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/style_video_player_video_bottom_seekbar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/style_video_player_video_seekbar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /app/src/main/res/layout-v21/activity_share_animation_b.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_base_video_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 11 | 12 | 17 | 18 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_detail_page.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_input_url_play.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 12 | 13 | 18 | 27 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_list.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 11 | 12 | 16 | 17 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_multi_list.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 10 | 11 | 16 | 17 | 21 | 22 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_multi_play.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 11 | 17 | 24 | 25 | 26 | 31 | 37 | 44 | 45 | 46 | 51 | 57 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_recycler_base_video.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_recycler_base_video_type_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 12 | 16 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_recycler_base_video_type_video.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 16 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_share_animation_a.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 13 | 17 | 22 | 28 | 29 | 34 | 35 | 36 | 48 | 49 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_share_animation_b.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_splash.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 14 | 15 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_view_pager_play.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 12 | 13 | 17 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_window_switch_play.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 11 | 12 |