├── .gitignore ├── LICENSE ├── README.md ├── art ├── 1.png ├── 2.png ├── 3.png └── 4.png ├── build.gradle ├── constants.gradle ├── devlin.jks ├── dkplayer-java ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── dueeeke │ │ └── videoplayer │ │ ├── controller │ │ ├── BaseVideoController.java │ │ ├── ControlWrapper.java │ │ ├── GestureVideoController.java │ │ ├── IControlComponent.java │ │ ├── IGestureComponent.java │ │ ├── IVideoController.java │ │ ├── MediaPlayerControl.java │ │ └── OrientationHelper.java │ │ ├── player │ │ ├── AbstractPlayer.java │ │ ├── AndroidMediaPlayer.java │ │ ├── AndroidMediaPlayerFactory.java │ │ ├── AudioFocusHelper.java │ │ ├── PlayerFactory.java │ │ ├── ProgressManager.java │ │ ├── VideoView.java │ │ ├── VideoViewConfig.java │ │ └── VideoViewManager.java │ │ ├── render │ │ ├── IRenderView.java │ │ ├── MeasureHelper.java │ │ ├── RenderViewFactory.java │ │ ├── TextureRenderView.java │ │ └── TextureRenderViewFactory.java │ │ └── util │ │ ├── CutoutUtil.java │ │ ├── L.java │ │ └── PlayerUtils.java │ └── res │ └── values │ └── attrs.xml ├── dkplayer-players ├── exo │ ├── .gitignore │ ├── build.gradle │ ├── proguard-rules.pro │ └── src │ │ └── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ └── com │ │ │ └── dueeeke │ │ │ └── videoplayer │ │ │ └── exo │ │ │ ├── ExoMediaPlayer.java │ │ │ ├── ExoMediaPlayerFactory.java │ │ │ └── ExoMediaSourceHelper.java │ │ └── res │ │ └── values │ │ └── strings.xml └── ijk │ ├── .gitignore │ ├── build.gradle │ ├── proguard-rules.pro │ └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── dueeeke │ │ └── videoplayer │ │ └── ijk │ │ ├── IjkPlayer.java │ │ ├── IjkPlayerFactory.java │ │ └── RawDataSourceProvider.java │ ├── jniLibs │ ├── arm64-v8a │ │ ├── libijkffmpeg.so │ │ ├── libijkplayer.so │ │ └── libijksdl.so │ ├── armeabi-v7a │ │ ├── libijkffmpeg.so │ │ ├── libijkplayer.so │ │ └── libijksdl.so │ ├── armeabi │ │ ├── libijkffmpeg.so │ │ ├── libijkplayer.so │ │ └── libijksdl.so │ ├── x86 │ │ ├── libijkffmpeg.so │ │ ├── libijkplayer.so │ │ └── libijksdl.so │ └── x86_64 │ │ ├── libijkffmpeg.so │ │ ├── libijkplayer.so │ │ └── libijksdl.so │ └── res │ └── values │ └── strings.xml ├── dkplayer-sample ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── assets │ ├── test.mp4 │ └── tiktok_data │ ├── ic_launcher-web.png │ ├── java │ └── com │ │ └── dueeeke │ │ └── dkplayer │ │ ├── activity │ │ ├── BaseActivity.java │ │ ├── CpuInfoActivity.java │ │ ├── DebugActivity.java │ │ ├── MainActivity.java │ │ ├── api │ │ │ ├── ParallelPlayActivity.java │ │ │ ├── PlayRawAssetsActivity.java │ │ │ └── PlayerActivity.java │ │ ├── extend │ │ │ ├── ADActivity.java │ │ │ ├── CacheActivity.java │ │ │ ├── CustomExoPlayerActivity.java │ │ │ ├── CustomIjkPlayerActivity.java │ │ │ ├── DanmakuActivity.java │ │ │ ├── DefinitionPlayerActivity.java │ │ │ ├── FullScreenActivity.java │ │ │ ├── PadActivity.java │ │ │ └── PlayListActivity.java │ │ ├── list │ │ │ ├── DetailActivity.java │ │ │ └── tiktok │ │ │ │ ├── OnViewPagerListener.java │ │ │ │ ├── TikTok2Activity.java │ │ │ │ ├── TikTok3Activity.java │ │ │ │ ├── TikTokActivity.java │ │ │ │ └── ViewPagerLayoutManager.java │ │ └── pip │ │ │ ├── AndroidOPiPActivity.java │ │ │ ├── PIPActivity.java │ │ │ ├── PIPListActivity.java │ │ │ └── TinyScreenActivity.java │ │ ├── adapter │ │ ├── ListPagerAdapter.java │ │ ├── TikTokAdapter.java │ │ ├── TikTokListAdapter.java │ │ ├── Tiktok2Adapter.java │ │ ├── Tiktok3Adapter.java │ │ ├── VideoListViewAdapter.java │ │ ├── VideoRecyclerViewAdapter.java │ │ └── listener │ │ │ ├── OnItemChildClickListener.java │ │ │ └── OnItemClickListener.java │ │ ├── app │ │ └── MyApplication.java │ │ ├── bean │ │ ├── TiktokBean.java │ │ ├── VideoBean.java │ │ └── VideoModel.java │ │ ├── fragment │ │ ├── BaseFragment.java │ │ ├── list │ │ │ ├── ListViewFragment.java │ │ │ ├── RecyclerViewAutoPlayFragment.java │ │ │ ├── RecyclerViewFragment.java │ │ │ ├── RecyclerViewPortraitFragment.java │ │ │ ├── SeamlessPlayFragment.java │ │ │ └── TikTokListFragment.java │ │ └── main │ │ │ ├── ApiFragment.java │ │ │ ├── ExtensionFragment.java │ │ │ ├── ListFragment.java │ │ │ └── PipFragment.java │ │ ├── util │ │ ├── DataUtil.java │ │ ├── DebugTextViewHelper.java │ │ ├── IntentKeys.java │ │ ├── PIPManager.java │ │ ├── ProgressManagerImpl.java │ │ ├── Tag.java │ │ ├── Utils.java │ │ └── cache │ │ │ ├── PreloadManager.java │ │ │ ├── PreloadTask.java │ │ │ └── ProxyVideoCacheManager.java │ │ └── widget │ │ ├── CenteredImageSpan.java │ │ ├── FloatView.java │ │ ├── VerticalViewPager.java │ │ ├── component │ │ ├── AdControlView.java │ │ ├── DefinitionControlView.java │ │ ├── PipControlView.java │ │ └── TikTokView.java │ │ ├── controller │ │ ├── FloatController.java │ │ ├── PortraitWhenFullScreenController.java │ │ └── TikTokController.java │ │ ├── player │ │ ├── CustomExoMediaPlayer.java │ │ └── CustomIjkMediaPlayer.java │ │ ├── render │ │ ├── SurfaceRenderView.java │ │ └── SurfaceRenderViewFactory.java │ │ └── videoview │ │ ├── DanmukuVideoView.java │ │ ├── ExoVideoView.java │ │ └── IjkVideoView.java │ └── res │ ├── anim │ ├── anim_alpha_in.xml │ ├── anim_alpha_out.xml │ ├── anim_float_window_enter.xml │ ├── anim_float_window_exit.xml │ ├── anim_slide_bottom_in.xml │ ├── anim_slide_bottom_out.xml │ ├── anim_slide_top_in.xml │ └── anim_slide_top_out.xml │ ├── drawable-hdpi │ ├── ic_tab_extension.png │ ├── ic_tab_functions.png │ ├── ic_tab_list.png │ └── ic_tab_picture_in_picture.png │ ├── drawable-mdpi │ ├── ic_tab_extension.png │ ├── ic_tab_functions.png │ ├── ic_tab_list.png │ └── ic_tab_picture_in_picture.png │ ├── drawable-xhdpi │ ├── ic_tab_extension.png │ ├── ic_tab_functions.png │ ├── ic_tab_list.png │ └── ic_tab_picture_in_picture.png │ ├── drawable-xxhdpi │ ├── ic_tab_extension.png │ ├── ic_tab_functions.png │ ├── ic_tab_list.png │ └── ic_tab_picture_in_picture.png │ ├── drawable-xxxhdpi │ ├── ic_tab_extension.png │ ├── ic_tab_functions.png │ ├── ic_tab_list.png │ └── ic_tab_picture_in_picture.png │ ├── drawable │ ├── selector_mute_icon.xml │ ├── shape_ad_bg.xml │ └── shape_float_window_background.xml │ ├── layout │ ├── activity_custom_exo_player.xml │ ├── activity_custom_ijk_player.xml │ ├── activity_danmaku_player.xml │ ├── activity_detail.xml │ ├── activity_layout_common.xml │ ├── activity_main.xml │ ├── activity_pad.xml │ ├── activity_parallel_play.xml │ ├── activity_pip.xml │ ├── activity_pip_android_o.xml │ ├── activity_play_raw_assets.xml │ ├── activity_player.xml │ ├── activity_tiktok.xml │ ├── activity_tiktok2.xml │ ├── activity_tiktok3.xml │ ├── fragment_api.xml │ ├── fragment_extension.xml │ ├── fragment_list.xml │ ├── fragment_list_view.xml │ ├── fragment_pip.xml │ ├── fragment_recycler_view.xml │ ├── fragment_tiktok_list.xml │ ├── item_tik_tok.xml │ ├── item_tiktok_list.xml │ ├── item_video.xml │ ├── layout_ad_control_view.xml │ ├── layout_definition_control_view.xml │ ├── layout_float_controller.xml │ ├── layout_rate_item.xml │ ├── layout_rate_pop.xml │ └── layout_tiktok_controller.xml │ ├── menu │ ├── main_menu.xml │ ├── main_navigation_items.xml │ └── tiktok_impl_menu.xml │ ├── mipmap-anydpi-v26 │ ├── ic_launcher.xml │ └── ic_launcher_round.xml │ ├── mipmap-hdpi │ ├── ic_launcher.png │ ├── ic_launcher_foreground.png │ └── ic_launcher_round.png │ ├── mipmap-mdpi │ ├── ic_launcher.png │ ├── ic_launcher_foreground.png │ └── ic_launcher_round.png │ ├── mipmap-xhdpi │ ├── ic_launcher.png │ ├── ic_launcher_foreground.png │ └── ic_launcher_round.png │ ├── mipmap-xxhdpi │ ├── ic_launcher.png │ ├── ic_launcher_foreground.png │ └── ic_launcher_round.png │ ├── mipmap-xxxhdpi │ ├── ic_launcher.png │ ├── ic_launcher_foreground.png │ └── ic_launcher_round.png │ ├── raw │ └── movie │ ├── values-en │ └── strings.xml │ └── values │ ├── colors.xml │ ├── dimens.xml │ ├── ic_launcher_background.xml │ ├── ids.xml │ ├── strings.xml │ └── styles.xml ├── dkplayer-ui ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── dueeeke │ │ └── videocontroller │ │ ├── MarqueeTextView.java │ │ ├── StandardVideoController.java │ │ └── component │ │ ├── CompleteView.java │ │ ├── ErrorView.java │ │ ├── GestureView.java │ │ ├── LiveControlView.java │ │ ├── PrepareView.java │ │ ├── TitleView.java │ │ └── VodControlView.java │ └── res │ ├── drawable-hdpi │ ├── dkplayer_ic_action_arrow_back.png │ ├── dkplayer_ic_action_autorenew.png │ ├── dkplayer_ic_action_battery.png │ ├── dkplayer_ic_action_battery_10.png │ ├── dkplayer_ic_action_battery_20.png │ ├── dkplayer_ic_action_battery_30.png │ ├── dkplayer_ic_action_battery_40.png │ ├── dkplayer_ic_action_battery_50.png │ ├── dkplayer_ic_action_battery_60.png │ ├── dkplayer_ic_action_battery_70.png │ ├── dkplayer_ic_action_battery_80.png │ ├── dkplayer_ic_action_battery_90.png │ ├── dkplayer_ic_action_brightness.png │ ├── dkplayer_ic_action_close.png │ ├── dkplayer_ic_action_fast_forward.png │ ├── dkplayer_ic_action_fast_rewind.png │ ├── dkplayer_ic_action_fullscreen.png │ ├── dkplayer_ic_action_fullscreen_exit.png │ ├── dkplayer_ic_action_lock_close.png │ ├── dkplayer_ic_action_lock_open.png │ ├── dkplayer_ic_action_pause.png │ ├── dkplayer_ic_action_play_arrow.png │ ├── dkplayer_ic_action_replay.png │ ├── dkplayer_ic_action_volume_off.png │ └── dkplayer_ic_action_volume_up.png │ ├── drawable-mdpi │ ├── dkplayer_ic_action_arrow_back.png │ ├── dkplayer_ic_action_autorenew.png │ ├── dkplayer_ic_action_battery.png │ ├── dkplayer_ic_action_battery_10.png │ ├── dkplayer_ic_action_battery_20.png │ ├── dkplayer_ic_action_battery_30.png │ ├── dkplayer_ic_action_battery_40.png │ ├── dkplayer_ic_action_battery_50.png │ ├── dkplayer_ic_action_battery_60.png │ ├── dkplayer_ic_action_battery_70.png │ ├── dkplayer_ic_action_battery_80.png │ ├── dkplayer_ic_action_battery_90.png │ ├── dkplayer_ic_action_brightness.png │ ├── dkplayer_ic_action_close.png │ ├── dkplayer_ic_action_fast_forward.png │ ├── dkplayer_ic_action_fast_rewind.png │ ├── dkplayer_ic_action_fullscreen.png │ ├── dkplayer_ic_action_fullscreen_exit.png │ ├── dkplayer_ic_action_lock_close.png │ ├── dkplayer_ic_action_lock_open.png │ ├── dkplayer_ic_action_pause.png │ ├── dkplayer_ic_action_play_arrow.png │ ├── dkplayer_ic_action_replay.png │ ├── dkplayer_ic_action_volume_off.png │ └── dkplayer_ic_action_volume_up.png │ ├── drawable-xhdpi │ ├── dkplayer_ic_action_arrow_back.png │ ├── dkplayer_ic_action_autorenew.png │ ├── dkplayer_ic_action_battery.png │ ├── dkplayer_ic_action_battery_10.png │ ├── dkplayer_ic_action_battery_20.png │ ├── dkplayer_ic_action_battery_30.png │ ├── dkplayer_ic_action_battery_40.png │ ├── dkplayer_ic_action_battery_50.png │ ├── dkplayer_ic_action_battery_60.png │ ├── dkplayer_ic_action_battery_70.png │ ├── dkplayer_ic_action_battery_80.png │ ├── dkplayer_ic_action_battery_90.png │ ├── dkplayer_ic_action_brightness.png │ ├── dkplayer_ic_action_close.png │ ├── dkplayer_ic_action_fast_forward.png │ ├── dkplayer_ic_action_fast_rewind.png │ ├── dkplayer_ic_action_fullscreen.png │ ├── dkplayer_ic_action_fullscreen_exit.png │ ├── dkplayer_ic_action_lock_close.png │ ├── dkplayer_ic_action_lock_open.png │ ├── dkplayer_ic_action_pause.png │ ├── dkplayer_ic_action_play_arrow.png │ ├── dkplayer_ic_action_replay.png │ ├── dkplayer_ic_action_volume_off.png │ └── dkplayer_ic_action_volume_up.png │ ├── drawable-xxhdpi │ ├── dkplayer_ic_action_arrow_back.png │ ├── dkplayer_ic_action_autorenew.png │ ├── dkplayer_ic_action_battery.png │ ├── dkplayer_ic_action_battery_10.png │ ├── dkplayer_ic_action_battery_20.png │ ├── dkplayer_ic_action_battery_30.png │ ├── dkplayer_ic_action_battery_40.png │ ├── dkplayer_ic_action_battery_50.png │ ├── dkplayer_ic_action_battery_60.png │ ├── dkplayer_ic_action_battery_70.png │ ├── dkplayer_ic_action_battery_80.png │ ├── dkplayer_ic_action_battery_90.png │ ├── dkplayer_ic_action_brightness.png │ ├── dkplayer_ic_action_close.png │ ├── dkplayer_ic_action_fast_forward.png │ ├── dkplayer_ic_action_fast_rewind.png │ ├── dkplayer_ic_action_fullscreen.png │ ├── dkplayer_ic_action_fullscreen_exit.png │ ├── dkplayer_ic_action_lock_close.png │ ├── dkplayer_ic_action_lock_open.png │ ├── dkplayer_ic_action_pause.png │ ├── dkplayer_ic_action_play_arrow.png │ ├── dkplayer_ic_action_replay.png │ ├── dkplayer_ic_action_volume_off.png │ └── dkplayer_ic_action_volume_up.png │ ├── drawable-xxxhdpi │ ├── dkplayer_ic_action_arrow_back.png │ ├── dkplayer_ic_action_autorenew.png │ ├── dkplayer_ic_action_battery.png │ ├── dkplayer_ic_action_battery_10.png │ ├── dkplayer_ic_action_battery_20.png │ ├── dkplayer_ic_action_battery_30.png │ ├── dkplayer_ic_action_battery_40.png │ ├── dkplayer_ic_action_battery_50.png │ ├── dkplayer_ic_action_battery_60.png │ ├── dkplayer_ic_action_battery_70.png │ ├── dkplayer_ic_action_battery_80.png │ ├── dkplayer_ic_action_battery_90.png │ ├── dkplayer_ic_action_brightness.png │ ├── dkplayer_ic_action_close.png │ ├── dkplayer_ic_action_fast_forward.png │ ├── dkplayer_ic_action_fast_rewind.png │ ├── dkplayer_ic_action_fullscreen.png │ ├── dkplayer_ic_action_fullscreen_exit.png │ ├── dkplayer_ic_action_lock_close.png │ ├── dkplayer_ic_action_lock_open.png │ ├── dkplayer_ic_action_pause.png │ ├── dkplayer_ic_action_play_arrow.png │ ├── dkplayer_ic_action_replay.png │ ├── dkplayer_ic_action_volume_off.png │ └── dkplayer_ic_action_volume_up.png │ ├── drawable │ ├── dkplayer_battery_level.xml │ ├── dkplayer_layer_progress_bar.xml │ ├── dkplayer_progress_loading.xml │ ├── dkplayer_seekbar_thumb.xml │ ├── dkplayer_seekbar_thumb_normal.xml │ ├── dkplayer_seekbar_thumb_pressed.xml │ ├── dkplayer_selector_full_screen_button.xml │ ├── dkplayer_selector_lock_button.xml │ ├── dkplayer_selector_play_button.xml │ ├── dkplayer_shape_back_bg.xml │ ├── dkplayer_shape_play_bg.xml │ ├── dkplayer_shape_standard_controller_top_bg.xml │ ├── dkplayer_shape_stardard_controller_bottom_bg.xml │ └── dkplayer_shape_status_view_btn.xml │ ├── layout │ ├── dkplayer_layout_complete_view.xml │ ├── dkplayer_layout_error_view.xml │ ├── dkplayer_layout_gesture_control_view.xml │ ├── dkplayer_layout_live_control_view.xml │ ├── dkplayer_layout_prepare_view.xml │ ├── dkplayer_layout_standard_controller.xml │ ├── dkplayer_layout_title_view.xml │ └── dkplayer_layout_vod_control_view.xml │ ├── values-en │ └── strings.xml │ └── values │ ├── colors.xml │ ├── dimens.xml │ └── strings.xml ├── dkplayer-videocache ├── .gitignore ├── build.gradle └── src │ └── main │ ├── AndroidManifest.xml │ └── java │ └── com │ └── danikula │ └── videocache │ ├── ByteArrayCache.java │ ├── ByteArraySource.java │ ├── Cache.java │ ├── CacheListener.java │ ├── Config.java │ ├── GetRequest.java │ ├── HttpProxyCache.java │ ├── HttpProxyCacheServer.java │ ├── HttpProxyCacheServerClients.java │ ├── HttpUrlSource.java │ ├── IgnoreHostProxySelector.java │ ├── InterruptedProxyCacheException.java │ ├── Logger.java │ ├── Pinger.java │ ├── Preconditions.java │ ├── ProxyCache.java │ ├── ProxyCacheException.java │ ├── ProxyCacheUtils.java │ ├── Source.java │ ├── SourceInfo.java │ ├── StorageUtils.java │ ├── file │ ├── DiskUsage.java │ ├── FileCache.java │ ├── FileNameGenerator.java │ ├── Files.java │ ├── LruDiskUsage.java │ ├── Md5FileNameGenerator.java │ ├── TotalCountLruDiskUsage.java │ ├── TotalSizeLruDiskUsage.java │ └── UnlimitedDiskUsage.java │ ├── headers │ ├── EmptyHeadersInjector.java │ └── HeaderInjector.java │ └── sourcestorage │ ├── DatabaseSourceInfoStorage.java │ ├── NoSourceInfoStorage.java │ ├── SourceInfoStorage.java │ └── SourceInfoStorageFactory.java ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── other ├── module-lite.sh └── test.ffconcat ├── publish.gradle └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | /local.properties 3 | /build 4 | .idea/ 5 | .gradle -------------------------------------------------------------------------------- /art/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xusigh/dueeeke-DKVideoPlayer/b6463577ccb0fbd881f0c2991f2276332d01d200/art/1.png -------------------------------------------------------------------------------- /art/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xusigh/dueeeke-DKVideoPlayer/b6463577ccb0fbd881f0c2991f2276332d01d200/art/2.png -------------------------------------------------------------------------------- /art/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xusigh/dueeeke-DKVideoPlayer/b6463577ccb0fbd881f0c2991f2276332d01d200/art/3.png -------------------------------------------------------------------------------- /art/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xusigh/dueeeke-DKVideoPlayer/b6463577ccb0fbd881f0c2991f2276332d01d200/art/4.png -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | google() 6 | jcenter() 7 | } 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:3.5.1' 10 | classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1' 11 | classpath 'com.novoda:bintray-release:0.9.1' 12 | // NOTE: Do not place your application dependencies here; they belong 13 | // in the individual module build.gradle files 14 | } 15 | } 16 | 17 | allprojects { 18 | repositories { 19 | google() 20 | jcenter() 21 | } 22 | } 23 | 24 | task clean(type: Delete) { 25 | delete rootProject.buildDir 26 | } 27 | 28 | // 指定javadoc UTF-8格式 29 | task javadoc(type: Javadoc) { 30 | options.encoding = "utf-8" 31 | } 32 | -------------------------------------------------------------------------------- /constants.gradle: -------------------------------------------------------------------------------- 1 | project.ext { 2 | releaseVersion = '3.2.1' 3 | releaseVersionCode = 42 4 | 5 | minSdkVersion = 16 6 | targetSdkVersion = 29 7 | compileSdkVersion = 29 8 | buildToolsVersion = '28.0.3' 9 | 10 | // App dependencies 11 | ijkPlayerVersion = '0.8.8' 12 | exoPlayerVersion = '2.10.8' 13 | 14 | annotation = 'androidx.annotation:annotation:1.1.0' 15 | } -------------------------------------------------------------------------------- /devlin.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xusigh/dueeeke-DKVideoPlayer/b6463577ccb0fbd881f0c2991f2276332d01d200/devlin.jks -------------------------------------------------------------------------------- /dkplayer-java/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /dkplayer-java/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | apply from: '../constants.gradle' 3 | 4 | android { 5 | compileSdkVersion project.ext.compileSdkVersion 6 | buildToolsVersion project.ext.buildToolsVersion 7 | 8 | defaultConfig { 9 | minSdkVersion project.ext.minSdkVersion 10 | targetSdkVersion project.ext.targetSdkVersion 11 | } 12 | } 13 | 14 | dependencies { 15 | implementation fileTree(include: ['*.jar'], dir: 'libs') 16 | compileOnly project.ext.annotation 17 | } 18 | 19 | ext { 20 | releaseArtifact = 'dkplayer-java' 21 | } 22 | 23 | apply from: '../publish.gradle' -------------------------------------------------------------------------------- /dkplayer-java/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in D:\sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | 19 | # Uncomment this to preserve the line number information for 20 | # debugging stack traces. 21 | #-keepattributes SourceFile,LineNumberTable 22 | 23 | # If you keep the line number information, uncomment this to 24 | # hide the original source file name. 25 | #-renamesourcefileattribute SourceFile 26 | -------------------------------------------------------------------------------- /dkplayer-java/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /dkplayer-java/src/main/java/com/dueeeke/videoplayer/controller/IControlComponent.java: -------------------------------------------------------------------------------- 1 | package com.dueeeke.videoplayer.controller; 2 | 3 | import android.view.View; 4 | import android.view.animation.Animation; 5 | 6 | import androidx.annotation.NonNull; 7 | 8 | public interface IControlComponent { 9 | 10 | void attach(@NonNull ControlWrapper controlWrapper); 11 | 12 | View getView(); 13 | 14 | void onVisibilityChanged(boolean isVisible, Animation anim); 15 | 16 | void onPlayStateChanged(int playState); 17 | 18 | void onPlayerStateChanged(int playerState); 19 | 20 | void setProgress(int duration, int position); 21 | 22 | void onLockStateChanged(boolean isLocked); 23 | 24 | } 25 | -------------------------------------------------------------------------------- /dkplayer-java/src/main/java/com/dueeeke/videoplayer/controller/IGestureComponent.java: -------------------------------------------------------------------------------- 1 | package com.dueeeke.videoplayer.controller; 2 | 3 | public interface IGestureComponent extends IControlComponent { 4 | /** 5 | * 开始滑动 6 | */ 7 | void onStartSlide(); 8 | 9 | /** 10 | * 结束滑动 11 | */ 12 | void onStopSlide(); 13 | 14 | /** 15 | * 滑动调整进度 16 | * @param slidePosition 滑动进度 17 | * @param currentPosition 当前播放进度 18 | * @param duration 视频总长度 19 | */ 20 | void onPositionChange(int slidePosition, int currentPosition, int duration); 21 | 22 | /** 23 | * 滑动调整亮度 24 | * @param percent 亮度百分比 25 | */ 26 | void onBrightnessChange(int percent); 27 | 28 | /** 29 | * 滑动调整音量 30 | * @param percent 音量百分比 31 | */ 32 | void onVolumeChange(int percent); 33 | } 34 | -------------------------------------------------------------------------------- /dkplayer-java/src/main/java/com/dueeeke/videoplayer/controller/IVideoController.java: -------------------------------------------------------------------------------- 1 | package com.dueeeke.videoplayer.controller; 2 | 3 | public interface IVideoController { 4 | 5 | /** 6 | * 开始控制视图自动隐藏倒计时 7 | */ 8 | void startFadeOut(); 9 | 10 | /** 11 | * 取消控制视图自动隐藏倒计时 12 | */ 13 | void stopFadeOut(); 14 | 15 | /** 16 | * 控制视图是否处于显示状态 17 | */ 18 | boolean isShowing(); 19 | 20 | /** 21 | * 设置锁定状态 22 | * @param locked 是否锁定 23 | */ 24 | void setLocked(boolean locked); 25 | 26 | /** 27 | * 是否处于锁定状态 28 | */ 29 | boolean isLocked(); 30 | 31 | /** 32 | * 开始刷新进度 33 | */ 34 | void startProgress(); 35 | 36 | /** 37 | * 停止刷新进度 38 | */ 39 | void stopProgress(); 40 | 41 | /** 42 | * 显示控制视图 43 | */ 44 | void hide(); 45 | 46 | /** 47 | * 隐藏控制视图 48 | */ 49 | void show(); 50 | 51 | /** 52 | * 是否需要适配刘海 53 | */ 54 | boolean hasCutout(); 55 | 56 | /** 57 | * 获取刘海的高度 58 | */ 59 | int getCutoutHeight(); 60 | } 61 | -------------------------------------------------------------------------------- /dkplayer-java/src/main/java/com/dueeeke/videoplayer/controller/MediaPlayerControl.java: -------------------------------------------------------------------------------- 1 | package com.dueeeke.videoplayer.controller; 2 | 3 | import android.graphics.Bitmap; 4 | 5 | public interface MediaPlayerControl { 6 | 7 | void start(); 8 | 9 | void pause(); 10 | 11 | long getDuration(); 12 | 13 | long getCurrentPosition(); 14 | 15 | void seekTo(long pos); 16 | 17 | boolean isPlaying(); 18 | 19 | int getBufferedPercentage(); 20 | 21 | void startFullScreen(); 22 | 23 | void stopFullScreen(); 24 | 25 | boolean isFullScreen(); 26 | 27 | void setMute(boolean isMute); 28 | 29 | boolean isMute(); 30 | 31 | void setScreenScaleType(int screenScaleType); 32 | 33 | void setSpeed(float speed); 34 | 35 | long getTcpSpeed(); 36 | 37 | void replay(boolean resetPosition); 38 | 39 | void setMirrorRotation(boolean enable); 40 | 41 | Bitmap doScreenShot(); 42 | 43 | int[] getVideoSize(); 44 | 45 | void setRotation(float rotation); 46 | 47 | void startTinyScreen(); 48 | 49 | void stopTinyScreen(); 50 | 51 | boolean isTinyScreen(); 52 | } -------------------------------------------------------------------------------- /dkplayer-java/src/main/java/com/dueeeke/videoplayer/controller/OrientationHelper.java: -------------------------------------------------------------------------------- 1 | package com.dueeeke.videoplayer.controller; 2 | 3 | import android.content.Context; 4 | import android.view.OrientationEventListener; 5 | 6 | /** 7 | * 设备方向监听 8 | */ 9 | public class OrientationHelper extends OrientationEventListener { 10 | 11 | private long mLastTime; 12 | 13 | private OnOrientationChangeListener mOnOrientationChangeListener; 14 | 15 | public OrientationHelper(Context context) { 16 | super(context); 17 | } 18 | 19 | @Override 20 | public void onOrientationChanged(int orientation) { 21 | long currentTime = System.currentTimeMillis(); 22 | if (currentTime - mLastTime < 300) return;//300毫秒检测一次 23 | if (mOnOrientationChangeListener != null) { 24 | mOnOrientationChangeListener.onOrientationChanged(orientation); 25 | } 26 | mLastTime = currentTime; 27 | } 28 | 29 | 30 | public interface OnOrientationChangeListener { 31 | void onOrientationChanged(int orientation); 32 | } 33 | 34 | public void setOnOrientationChangeListener(OnOrientationChangeListener onOrientationChangeListener) { 35 | mOnOrientationChangeListener = onOrientationChangeListener; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /dkplayer-java/src/main/java/com/dueeeke/videoplayer/player/AndroidMediaPlayerFactory.java: -------------------------------------------------------------------------------- 1 | package com.dueeeke.videoplayer.player; 2 | 3 | import android.content.Context; 4 | 5 | public class AndroidMediaPlayerFactory extends PlayerFactory { 6 | 7 | public static AndroidMediaPlayerFactory create() { 8 | return new AndroidMediaPlayerFactory(); 9 | } 10 | 11 | @Override 12 | public AndroidMediaPlayer createPlayer(Context context) { 13 | return new AndroidMediaPlayer(context); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /dkplayer-java/src/main/java/com/dueeeke/videoplayer/player/PlayerFactory.java: -------------------------------------------------------------------------------- 1 | package com.dueeeke.videoplayer.player; 2 | 3 | import android.content.Context; 4 | 5 | public abstract class PlayerFactory

{ 6 | 7 | public abstract P createPlayer(Context context); 8 | } 9 | -------------------------------------------------------------------------------- /dkplayer-java/src/main/java/com/dueeeke/videoplayer/player/ProgressManager.java: -------------------------------------------------------------------------------- 1 | package com.dueeeke.videoplayer.player; 2 | 3 | public abstract class ProgressManager { 4 | 5 | public abstract void saveProgress(String url, long progress); 6 | 7 | public abstract long getSavedProgress(String url); 8 | 9 | } 10 | -------------------------------------------------------------------------------- /dkplayer-java/src/main/java/com/dueeeke/videoplayer/render/IRenderView.java: -------------------------------------------------------------------------------- 1 | package com.dueeeke.videoplayer.render; 2 | 3 | import android.graphics.Bitmap; 4 | import android.view.View; 5 | 6 | import androidx.annotation.NonNull; 7 | 8 | import com.dueeeke.videoplayer.player.AbstractPlayer; 9 | 10 | public interface IRenderView { 11 | 12 | /** 13 | * 关联AbstractPlayer 14 | */ 15 | void attachToPlayer(@NonNull AbstractPlayer player); 16 | 17 | /** 18 | * 设置视频宽高 19 | * @param videoWidth 宽 20 | * @param videoHeight 高 21 | */ 22 | void setVideoSize(int videoWidth, int videoHeight); 23 | 24 | /** 25 | * 设置视频旋转角度 26 | * @param degree 角度值 27 | */ 28 | void setVideoRotation(int degree); 29 | 30 | /** 31 | * 设置screen scale type 32 | * @param scaleType 类型 33 | */ 34 | void setScaleType(int scaleType); 35 | 36 | /** 37 | * 获取真实的RenderView 38 | */ 39 | View getView(); 40 | 41 | /** 42 | * 截图 43 | */ 44 | Bitmap doScreenShot(); 45 | 46 | /** 47 | * 释放资源 48 | */ 49 | void release(); 50 | 51 | } -------------------------------------------------------------------------------- /dkplayer-java/src/main/java/com/dueeeke/videoplayer/render/RenderViewFactory.java: -------------------------------------------------------------------------------- 1 | package com.dueeeke.videoplayer.render; 2 | 3 | import android.content.Context; 4 | 5 | public abstract class RenderViewFactory { 6 | 7 | public abstract IRenderView createRenderView(Context context); 8 | 9 | } 10 | -------------------------------------------------------------------------------- /dkplayer-java/src/main/java/com/dueeeke/videoplayer/render/TextureRenderViewFactory.java: -------------------------------------------------------------------------------- 1 | package com.dueeeke.videoplayer.render; 2 | 3 | import android.content.Context; 4 | 5 | public class TextureRenderViewFactory extends RenderViewFactory { 6 | 7 | public static TextureRenderViewFactory create() { 8 | return new TextureRenderViewFactory(); 9 | } 10 | 11 | @Override 12 | public IRenderView createRenderView(Context context) { 13 | return new TextureRenderView(context); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /dkplayer-java/src/main/java/com/dueeeke/videoplayer/util/L.java: -------------------------------------------------------------------------------- 1 | package com.dueeeke.videoplayer.util; 2 | 3 | import android.util.Log; 4 | 5 | import com.dueeeke.videoplayer.player.VideoViewManager; 6 | 7 | /** 8 | * 日志类 9 | * Created by dueeeke on 2017/6/5. 10 | */ 11 | 12 | public final class L { 13 | 14 | private L() { 15 | } 16 | 17 | private static final String TAG = "DKPlayer"; 18 | 19 | private static boolean isDebug = VideoViewManager.getConfig().mIsEnableLog; 20 | 21 | 22 | public static void d(String msg) { 23 | if (isDebug) { 24 | Log.d(TAG, msg); 25 | } 26 | } 27 | 28 | public static void e(String msg) { 29 | if (isDebug) { 30 | Log.e(TAG, msg); 31 | } 32 | } 33 | 34 | public static void i(String msg) { 35 | if (isDebug) { 36 | Log.i(TAG, msg); 37 | } 38 | } 39 | 40 | public static void w(String msg) { 41 | if (isDebug) { 42 | Log.w(TAG, msg); 43 | } 44 | } 45 | 46 | public static void setDebug(boolean isDebug) { 47 | L.isDebug = isDebug; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /dkplayer-java/src/main/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /dkplayer-players/exo/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /dkplayer-players/exo/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | apply from: '../../constants.gradle' 3 | 4 | android { 5 | compileSdkVersion project.ext.compileSdkVersion 6 | buildToolsVersion project.ext.buildToolsVersion 7 | 8 | defaultConfig { 9 | minSdkVersion project.ext.minSdkVersion 10 | targetSdkVersion project.ext.targetSdkVersion 11 | } 12 | } 13 | 14 | dependencies { 15 | implementation fileTree(include: ['*.jar'], dir: 'libs') 16 | implementation project(':dkplayer-java') 17 | api "com.google.android.exoplayer:exoplayer-core:$project.exoPlayerVersion" 18 | api "com.google.android.exoplayer:exoplayer-dash:$project.exoPlayerVersion" 19 | api "com.google.android.exoplayer:exoplayer-hls:$project.exoPlayerVersion" 20 | api "com.google.android.exoplayer:exoplayer-smoothstreaming:$project.exoPlayerVersion" 21 | api "com.google.android.exoplayer:extension-rtmp:$project.exoPlayerVersion" 22 | } 23 | 24 | ext { 25 | releaseArtifact = 'player-exo' 26 | } 27 | 28 | apply from: '../../publish.gradle' -------------------------------------------------------------------------------- /dkplayer-players/exo/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /dkplayer-players/exo/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | -------------------------------------------------------------------------------- /dkplayer-players/exo/src/main/java/com/dueeeke/videoplayer/exo/ExoMediaPlayerFactory.java: -------------------------------------------------------------------------------- 1 | package com.dueeeke.videoplayer.exo; 2 | 3 | import android.content.Context; 4 | 5 | import com.dueeeke.videoplayer.player.PlayerFactory; 6 | 7 | public class ExoMediaPlayerFactory extends PlayerFactory { 8 | 9 | public static ExoMediaPlayerFactory create() { 10 | return new ExoMediaPlayerFactory(); 11 | } 12 | 13 | @Override 14 | public ExoMediaPlayer createPlayer(Context context) { 15 | return new ExoMediaPlayer(context); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /dkplayer-players/exo/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /dkplayer-players/ijk/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /dkplayer-players/ijk/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | apply from: '../../constants.gradle' 3 | 4 | android { 5 | compileSdkVersion project.ext.compileSdkVersion 6 | buildToolsVersion project.ext.buildToolsVersion 7 | 8 | defaultConfig { 9 | minSdkVersion project.ext.minSdkVersion 10 | targetSdkVersion project.ext.targetSdkVersion 11 | } 12 | } 13 | 14 | dependencies { 15 | implementation fileTree(include: ['*.jar'], dir: 'libs') 16 | compileOnly project(':dkplayer-java') 17 | api "tv.danmaku.ijk.media:ijkplayer-java:$project.ijkPlayerVersion" 18 | } 19 | 20 | ext { 21 | releaseArtifact = 'player-ijk' 22 | } 23 | 24 | apply from: '../../publish.gradle' -------------------------------------------------------------------------------- /dkplayer-players/ijk/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /dkplayer-players/ijk/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | -------------------------------------------------------------------------------- /dkplayer-players/ijk/src/main/java/com/dueeeke/videoplayer/ijk/IjkPlayerFactory.java: -------------------------------------------------------------------------------- 1 | package com.dueeeke.videoplayer.ijk; 2 | 3 | import android.content.Context; 4 | 5 | import com.dueeeke.videoplayer.player.PlayerFactory; 6 | 7 | public class IjkPlayerFactory extends PlayerFactory { 8 | 9 | public static IjkPlayerFactory create() { 10 | return new IjkPlayerFactory(); 11 | } 12 | 13 | @Override 14 | public IjkPlayer createPlayer(Context context) { 15 | return new IjkPlayer(context); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /dkplayer-players/ijk/src/main/jniLibs/arm64-v8a/libijkffmpeg.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xusigh/dueeeke-DKVideoPlayer/b6463577ccb0fbd881f0c2991f2276332d01d200/dkplayer-players/ijk/src/main/jniLibs/arm64-v8a/libijkffmpeg.so -------------------------------------------------------------------------------- /dkplayer-players/ijk/src/main/jniLibs/arm64-v8a/libijkplayer.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xusigh/dueeeke-DKVideoPlayer/b6463577ccb0fbd881f0c2991f2276332d01d200/dkplayer-players/ijk/src/main/jniLibs/arm64-v8a/libijkplayer.so -------------------------------------------------------------------------------- /dkplayer-players/ijk/src/main/jniLibs/arm64-v8a/libijksdl.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xusigh/dueeeke-DKVideoPlayer/b6463577ccb0fbd881f0c2991f2276332d01d200/dkplayer-players/ijk/src/main/jniLibs/arm64-v8a/libijksdl.so -------------------------------------------------------------------------------- /dkplayer-players/ijk/src/main/jniLibs/armeabi-v7a/libijkffmpeg.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xusigh/dueeeke-DKVideoPlayer/b6463577ccb0fbd881f0c2991f2276332d01d200/dkplayer-players/ijk/src/main/jniLibs/armeabi-v7a/libijkffmpeg.so -------------------------------------------------------------------------------- /dkplayer-players/ijk/src/main/jniLibs/armeabi-v7a/libijkplayer.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xusigh/dueeeke-DKVideoPlayer/b6463577ccb0fbd881f0c2991f2276332d01d200/dkplayer-players/ijk/src/main/jniLibs/armeabi-v7a/libijkplayer.so -------------------------------------------------------------------------------- /dkplayer-players/ijk/src/main/jniLibs/armeabi-v7a/libijksdl.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xusigh/dueeeke-DKVideoPlayer/b6463577ccb0fbd881f0c2991f2276332d01d200/dkplayer-players/ijk/src/main/jniLibs/armeabi-v7a/libijksdl.so -------------------------------------------------------------------------------- /dkplayer-players/ijk/src/main/jniLibs/armeabi/libijkffmpeg.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xusigh/dueeeke-DKVideoPlayer/b6463577ccb0fbd881f0c2991f2276332d01d200/dkplayer-players/ijk/src/main/jniLibs/armeabi/libijkffmpeg.so -------------------------------------------------------------------------------- /dkplayer-players/ijk/src/main/jniLibs/armeabi/libijkplayer.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xusigh/dueeeke-DKVideoPlayer/b6463577ccb0fbd881f0c2991f2276332d01d200/dkplayer-players/ijk/src/main/jniLibs/armeabi/libijkplayer.so -------------------------------------------------------------------------------- /dkplayer-players/ijk/src/main/jniLibs/armeabi/libijksdl.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xusigh/dueeeke-DKVideoPlayer/b6463577ccb0fbd881f0c2991f2276332d01d200/dkplayer-players/ijk/src/main/jniLibs/armeabi/libijksdl.so -------------------------------------------------------------------------------- /dkplayer-players/ijk/src/main/jniLibs/x86/libijkffmpeg.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xusigh/dueeeke-DKVideoPlayer/b6463577ccb0fbd881f0c2991f2276332d01d200/dkplayer-players/ijk/src/main/jniLibs/x86/libijkffmpeg.so -------------------------------------------------------------------------------- /dkplayer-players/ijk/src/main/jniLibs/x86/libijkplayer.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xusigh/dueeeke-DKVideoPlayer/b6463577ccb0fbd881f0c2991f2276332d01d200/dkplayer-players/ijk/src/main/jniLibs/x86/libijkplayer.so -------------------------------------------------------------------------------- /dkplayer-players/ijk/src/main/jniLibs/x86/libijksdl.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xusigh/dueeeke-DKVideoPlayer/b6463577ccb0fbd881f0c2991f2276332d01d200/dkplayer-players/ijk/src/main/jniLibs/x86/libijksdl.so -------------------------------------------------------------------------------- /dkplayer-players/ijk/src/main/jniLibs/x86_64/libijkffmpeg.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xusigh/dueeeke-DKVideoPlayer/b6463577ccb0fbd881f0c2991f2276332d01d200/dkplayer-players/ijk/src/main/jniLibs/x86_64/libijkffmpeg.so -------------------------------------------------------------------------------- /dkplayer-players/ijk/src/main/jniLibs/x86_64/libijkplayer.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xusigh/dueeeke-DKVideoPlayer/b6463577ccb0fbd881f0c2991f2276332d01d200/dkplayer-players/ijk/src/main/jniLibs/x86_64/libijkplayer.so -------------------------------------------------------------------------------- /dkplayer-players/ijk/src/main/jniLibs/x86_64/libijksdl.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xusigh/dueeeke-DKVideoPlayer/b6463577ccb0fbd881f0c2991f2276332d01d200/dkplayer-players/ijk/src/main/jniLibs/x86_64/libijksdl.so -------------------------------------------------------------------------------- /dkplayer-players/ijk/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /dkplayer-sample/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /dkplayer-sample/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in D:\sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | 19 | # Uncomment this to preserve the line number information for 20 | # debugging stack traces. 21 | #-keepattributes SourceFile,LineNumberTable 22 | 23 | # If you keep the line number information, uncomment this to 24 | # hide the original source file name. 25 | #-renamesourcefileattribute SourceFile 26 | 27 | -keep class tv.danmaku.ijk.** { *; } 28 | -dontwarn tv.danmaku.ijk.** 29 | -keep class com.dueeeke.videoplayer.** { *; } 30 | -dontwarn com.dueeeke.videoplayer.** 31 | 32 | -keep class com.google.android.exoplayer2.** { *; } 33 | -dontwarn com.google.android.exoplayer2.** 34 | 35 | 36 | -dontwarn com.yanzhenjie.permission.** 37 | 38 | -keep class android.support.** { *; } 39 | 40 | -keep class com.bumptech.glide.** { *; } 41 | 42 | -keep class com.dueeeke.dkplayer.bean.** { *; } -------------------------------------------------------------------------------- /dkplayer-sample/src/main/assets/test.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xusigh/dueeeke-DKVideoPlayer/b6463577ccb0fbd881f0c2991f2276332d01d200/dkplayer-sample/src/main/assets/test.mp4 -------------------------------------------------------------------------------- /dkplayer-sample/src/main/ic_launcher-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xusigh/dueeeke-DKVideoPlayer/b6463577ccb0fbd881f0c2991f2276332d01d200/dkplayer-sample/src/main/ic_launcher-web.png -------------------------------------------------------------------------------- /dkplayer-sample/src/main/java/com/dueeeke/dkplayer/activity/extend/CacheActivity.java: -------------------------------------------------------------------------------- 1 | package com.dueeeke.dkplayer.activity.extend; 2 | 3 | import com.danikula.videocache.HttpProxyCacheServer; 4 | import com.dueeeke.dkplayer.R; 5 | import com.dueeeke.dkplayer.activity.BaseActivity; 6 | import com.dueeeke.dkplayer.util.DataUtil; 7 | import com.dueeeke.dkplayer.util.cache.ProxyVideoCacheManager; 8 | import com.dueeeke.videocontroller.StandardVideoController; 9 | import com.dueeeke.videoplayer.player.VideoView; 10 | 11 | public class CacheActivity extends BaseActivity { 12 | 13 | @Override 14 | protected int getLayoutResId() { 15 | return R.layout.activity_layout_common; 16 | } 17 | 18 | @Override 19 | protected int getTitleResId() { 20 | return R.string.str_cache; 21 | } 22 | 23 | @Override 24 | protected void initView() { 25 | super.initView(); 26 | mVideoView = findViewById(R.id.video_view); 27 | HttpProxyCacheServer cacheServer = ProxyVideoCacheManager.getProxy(this); 28 | String proxyUrl = cacheServer.getProxyUrl(DataUtil.SAMPLE_URL); 29 | mVideoView.setUrl(proxyUrl); 30 | StandardVideoController controller = new StandardVideoController(this); 31 | controller.addDefaultControlComponent(getString(R.string.str_cache), false); 32 | mVideoView.setVideoController(controller); 33 | mVideoView.start(); 34 | 35 | //删除url对应默认缓存文件 36 | // ProxyVideoCacheManager.clearDefaultCache(this, URL); 37 | //清除缓存文件中的所有缓存 38 | // ProxyVideoCacheManager.clearAllCache(this); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /dkplayer-sample/src/main/java/com/dueeeke/dkplayer/activity/extend/PadActivity.java: -------------------------------------------------------------------------------- 1 | package com.dueeeke.dkplayer.activity.extend; 2 | 3 | import android.view.View; 4 | import android.widget.Toast; 5 | 6 | import com.dueeeke.dkplayer.R; 7 | import com.dueeeke.dkplayer.activity.BaseActivity; 8 | import com.dueeeke.dkplayer.util.DataUtil; 9 | import com.dueeeke.videocontroller.StandardVideoController; 10 | 11 | public class PadActivity extends BaseActivity { 12 | 13 | private StandardVideoController mController; 14 | 15 | @Override 16 | protected int getLayoutResId() { 17 | return R.layout.activity_pad; 18 | } 19 | 20 | @Override 21 | protected void initView() { 22 | super.initView(); 23 | mVideoView = findViewById(R.id.video_view); 24 | 25 | mVideoView.setUrl(DataUtil.SAMPLE_URL); 26 | 27 | mController = new StandardVideoController(this); 28 | mController.addDefaultControlComponent("pad", false); 29 | 30 | mController.findViewById(R.id.fullscreen).setOnClickListener(new View.OnClickListener() { 31 | @Override 32 | public void onClick(View v) { 33 | if (mVideoView.isFullScreen()) { 34 | mVideoView.stopFullScreen(); 35 | } else { 36 | mVideoView.startFullScreen(); 37 | } 38 | } 39 | }); 40 | 41 | mController.findViewById(R.id.back).setOnClickListener(new View.OnClickListener() { 42 | @Override 43 | public void onClick(View v) { 44 | mVideoView.stopFullScreen(); 45 | } 46 | }); 47 | 48 | mVideoView.setVideoController(mController); 49 | 50 | mVideoView.start(); 51 | } 52 | 53 | 54 | @Override 55 | public void onBackPressed() { 56 | if (mController.isLocked()) { 57 | mController.show(); 58 | Toast.makeText(this, R.string.dkplayer_lock_tip, Toast.LENGTH_SHORT).show(); 59 | return; 60 | } 61 | if (mVideoView.isFullScreen()) { 62 | mVideoView.stopFullScreen(); 63 | return; 64 | } 65 | finish(); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /dkplayer-sample/src/main/java/com/dueeeke/dkplayer/activity/list/tiktok/OnViewPagerListener.java: -------------------------------------------------------------------------------- 1 | package com.dueeeke.dkplayer.activity.list.tiktok; 2 | 3 | /** 4 | * Created by 钉某人 5 | * github: https://github.com/DingMouRen 6 | * email: naildingmouren@gmail.com 7 | * 用于ViewPagerLayoutManager的监听 8 | */ 9 | 10 | @Deprecated 11 | public interface OnViewPagerListener { 12 | 13 | /*初始化完成*/ 14 | void onInitComplete(); 15 | 16 | /*释放的监听*/ 17 | void onPageRelease(boolean isNext, int position); 18 | 19 | /*选中的监听以及判断是否滑动到底部*/ 20 | void onPageSelected(int position, boolean isBottom); 21 | 22 | 23 | } 24 | -------------------------------------------------------------------------------- /dkplayer-sample/src/main/java/com/dueeeke/dkplayer/adapter/listener/OnItemChildClickListener.java: -------------------------------------------------------------------------------- 1 | package com.dueeeke.dkplayer.adapter.listener; 2 | 3 | public interface OnItemChildClickListener { 4 | void onItemChildClick(int position); 5 | } 6 | -------------------------------------------------------------------------------- /dkplayer-sample/src/main/java/com/dueeeke/dkplayer/adapter/listener/OnItemClickListener.java: -------------------------------------------------------------------------------- 1 | package com.dueeeke.dkplayer.adapter.listener; 2 | 3 | public interface OnItemClickListener { 4 | void onItemClick(int position); 5 | } -------------------------------------------------------------------------------- /dkplayer-sample/src/main/java/com/dueeeke/dkplayer/app/MyApplication.java: -------------------------------------------------------------------------------- 1 | package com.dueeeke.dkplayer.app; 2 | 3 | import android.app.Application; 4 | 5 | import com.dueeeke.videoplayer.BuildConfig; 6 | import com.dueeeke.videoplayer.exo.ExoMediaPlayerFactory; 7 | import com.dueeeke.videoplayer.player.VideoViewConfig; 8 | import com.dueeeke.videoplayer.player.VideoViewManager; 9 | 10 | /** 11 | * app 12 | * Created by Devlin_n on 2017/4/22. 13 | */ 14 | 15 | public class MyApplication extends Application { 16 | 17 | private static MyApplication instance; 18 | 19 | @Override 20 | public void onCreate() { 21 | super.onCreate(); 22 | instance = this; 23 | //播放器配置,注意:此为全局配置,按需开启 24 | VideoViewManager.setConfig(VideoViewConfig.newBuilder() 25 | .setLogEnabled(BuildConfig.DEBUG)//调试的时候请打开日志,方便排错 26 | // .setPlayerFactory(IjkPlayerFactory.create()) 27 | .setPlayerFactory(ExoMediaPlayerFactory.create()) 28 | // .setRenderViewFactory(SurfaceRenderViewFactory.create()) 29 | // .setEnableOrientation(true) 30 | // .setEnableAudioFocus(false) 31 | // .setScreenScaleType(VideoView.SCREEN_SCALE_MATCH_PARENT) 32 | // .setAdaptCutout(false) 33 | // .setPlayOnMobileNetwork(true) 34 | // .setProgressManager(new ProgressManagerImpl()) 35 | .build()); 36 | 37 | // if (BuildConfig.DEBUG) { 38 | // StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().detectAll().penaltyLog().build()); 39 | // StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder().detectAll().penaltyLog().build()); 40 | // } 41 | } 42 | 43 | public static MyApplication getInstance() { 44 | return instance; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /dkplayer-sample/src/main/java/com/dueeeke/dkplayer/bean/VideoBean.java: -------------------------------------------------------------------------------- 1 | package com.dueeeke.dkplayer.bean; 2 | 3 | /** 4 | * Created by Devlin_n on 2017/6/1. 5 | */ 6 | 7 | public class VideoBean { 8 | 9 | private String title; 10 | private String url; 11 | private String thumb; 12 | 13 | public String getTitle() { 14 | return title; 15 | } 16 | 17 | public void setTitle(String title) { 18 | this.title = title; 19 | } 20 | 21 | public String getUrl() { 22 | return url; 23 | } 24 | 25 | public void setUrl(String url) { 26 | this.url = url; 27 | } 28 | 29 | public String getThumb() { 30 | return thumb; 31 | } 32 | 33 | public void setThumb(String thumb) { 34 | this.thumb = thumb; 35 | } 36 | 37 | public VideoBean(String title, String thumb, String url) { 38 | this.title = title; 39 | this.url = url; 40 | this.thumb = thumb; 41 | 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /dkplayer-sample/src/main/java/com/dueeeke/dkplayer/bean/VideoModel.java: -------------------------------------------------------------------------------- 1 | package com.dueeeke.dkplayer.bean; 2 | 3 | import com.dueeeke.videoplayer.controller.BaseVideoController; 4 | 5 | /** 6 | * Created by Devlin_n on 2017/4/11. 7 | */ 8 | 9 | public class VideoModel { 10 | 11 | public String url; 12 | public String title; 13 | 14 | public VideoModel(String url, String title, BaseVideoController controller, boolean isCache) { 15 | this.url = url; 16 | this.title = title; 17 | this.controller = controller; 18 | this.isCache = isCache; 19 | } 20 | 21 | public BaseVideoController controller; 22 | public boolean isCache; 23 | } 24 | -------------------------------------------------------------------------------- /dkplayer-sample/src/main/java/com/dueeeke/dkplayer/fragment/list/RecyclerViewAutoPlayFragment.java: -------------------------------------------------------------------------------- 1 | package com.dueeeke.dkplayer.fragment.list; 2 | 3 | import android.graphics.Rect; 4 | import android.view.View; 5 | 6 | import androidx.annotation.NonNull; 7 | import androidx.recyclerview.widget.RecyclerView; 8 | 9 | import com.dueeeke.dkplayer.adapter.VideoRecyclerViewAdapter; 10 | import com.dueeeke.videoplayer.util.L; 11 | 12 | import static androidx.recyclerview.widget.RecyclerView.SCROLL_STATE_IDLE; 13 | 14 | /** 15 | * 滑动列表自动播放,仅包含自动播放的逻辑 16 | */ 17 | public class RecyclerViewAutoPlayFragment extends RecyclerViewFragment { 18 | 19 | @Override 20 | protected void initView() { 21 | super.initView(); 22 | mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() { 23 | 24 | @Override 25 | public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) { 26 | super.onScrollStateChanged(recyclerView, newState); 27 | if (newState == SCROLL_STATE_IDLE) { //滚动停止 28 | autoPlayVideo(recyclerView); 29 | } 30 | } 31 | 32 | private void autoPlayVideo(RecyclerView view) { 33 | if (view == null) return; 34 | //遍历RecyclerView子控件,如果mPlayerContainer完全可见就开始播放 35 | int count = view.getChildCount(); 36 | L.d("ChildCount:" + count); 37 | for (int i = 0; i < count; i++) { 38 | View itemView = view.getChildAt(i); 39 | if (itemView == null) continue; 40 | VideoRecyclerViewAdapter.VideoHolder holder = (VideoRecyclerViewAdapter.VideoHolder) itemView.getTag(); 41 | Rect rect = new Rect(); 42 | holder.mPlayerContainer.getLocalVisibleRect(rect); 43 | int height = holder.mPlayerContainer.getHeight(); 44 | if (rect.top == 0 && rect.bottom == height) { 45 | startPlay(holder.mPosition); 46 | break; 47 | } 48 | } 49 | } 50 | }); 51 | } 52 | 53 | @Override 54 | protected void initData() { 55 | super.initData(); 56 | 57 | mRecyclerView.post(() -> { 58 | //自动播放第一个 59 | startPlay(0); 60 | }); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /dkplayer-sample/src/main/java/com/dueeeke/dkplayer/fragment/list/RecyclerViewPortraitFragment.java: -------------------------------------------------------------------------------- 1 | package com.dueeeke.dkplayer.fragment.list; 2 | 3 | import com.dueeeke.dkplayer.util.Utils; 4 | import com.dueeeke.dkplayer.widget.controller.PortraitWhenFullScreenController; 5 | import com.dueeeke.videocontroller.component.CompleteView; 6 | import com.dueeeke.videocontroller.component.ErrorView; 7 | import com.dueeeke.videocontroller.component.GestureView; 8 | import com.dueeeke.videocontroller.component.TitleView; 9 | import com.dueeeke.videoplayer.player.VideoView; 10 | 11 | /** 12 | * 全屏后手动横屏,并不完美,仅做参考 13 | */ 14 | public class RecyclerViewPortraitFragment extends RecyclerViewAutoPlayFragment { 15 | 16 | @Override 17 | protected void initVideoView() { 18 | mVideoView = new VideoView(getActivity()); 19 | mVideoView.setOnStateChangeListener(new VideoView.SimpleOnStateChangeListener() { 20 | @Override 21 | public void onPlayStateChanged(int playState) { 22 | if (playState == VideoView.STATE_IDLE) { 23 | Utils.removeViewFormParent(mVideoView); 24 | mLastPos = mCurPos; 25 | mCurPos = -1; 26 | } 27 | } 28 | }); 29 | mController = new PortraitWhenFullScreenController(getActivity()); 30 | mErrorView = new ErrorView(getActivity()); 31 | mController.addControlComponent(mErrorView); 32 | mCompleteView = new CompleteView(getActivity()); 33 | mController.addControlComponent(mCompleteView); 34 | mTitleView = new TitleView(getActivity()); 35 | mController.addControlComponent(mTitleView); 36 | mController.addControlComponent(new GestureView(getActivity())); 37 | mController.setEnableOrientation(true); 38 | mVideoView.setVideoController(mController); 39 | } 40 | 41 | @Override 42 | public void onItemChildClick(int position) { 43 | mVideoView.startFullScreen(); 44 | super.onItemChildClick(position); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /dkplayer-sample/src/main/java/com/dueeeke/dkplayer/fragment/main/ListFragment.java: -------------------------------------------------------------------------------- 1 | package com.dueeeke.dkplayer.fragment.main; 2 | 3 | import androidx.viewpager.widget.ViewPager; 4 | 5 | import com.dueeeke.dkplayer.R; 6 | import com.dueeeke.dkplayer.adapter.ListPagerAdapter; 7 | import com.dueeeke.dkplayer.fragment.BaseFragment; 8 | import com.dueeeke.dkplayer.util.Tag; 9 | import com.google.android.material.tabs.TabLayout; 10 | 11 | import java.util.ArrayList; 12 | import java.util.List; 13 | 14 | /** 15 | * 注意:RecyclerView demo 我采用继承的方式实现, 16 | * ${@link com.dueeeke.dkplayer.fragment.list.RecyclerViewPortraitFragment} 我甚至使用了三重继承😂, 17 | * 实际开发中可以不需要这样。 18 | * 我这样做仅仅只为代码复用,方便维护 19 | */ 20 | public class ListFragment extends BaseFragment { 21 | 22 | @Override 23 | protected int getLayoutResId() { 24 | return R.layout.fragment_list; 25 | } 26 | 27 | @Override 28 | protected void initView() { 29 | super.initView(); 30 | 31 | ViewPager viewPager = findViewById(R.id.view_pager); 32 | 33 | List titles = new ArrayList<>(); 34 | titles.add(getString(R.string.str_list_view)); 35 | titles.add(getString(R.string.str_recycler_view)); 36 | titles.add(getString(R.string.str_auto_play_recycler_view)); 37 | titles.add(getString(R.string.str_tiktok)); 38 | titles.add(getString(R.string.str_seamless_play)); 39 | titles.add(getString(R.string.str_portrait_when_fullscreen)); 40 | 41 | viewPager.setAdapter(new ListPagerAdapter(getChildFragmentManager(), titles)); 42 | 43 | TabLayout tabLayout = findViewById(R.id.tab_layout); 44 | tabLayout.setupWithViewPager(viewPager); 45 | } 46 | 47 | @Override 48 | public void onDetach() { 49 | super.onDetach(); 50 | getVideoViewManager().releaseByTag(Tag.LIST); 51 | getVideoViewManager().releaseByTag(Tag.SEAMLESS); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /dkplayer-sample/src/main/java/com/dueeeke/dkplayer/fragment/main/PipFragment.java: -------------------------------------------------------------------------------- 1 | package com.dueeeke.dkplayer.fragment.main; 2 | 3 | import android.content.Intent; 4 | import android.os.Build; 5 | import android.view.View; 6 | import android.widget.Toast; 7 | 8 | import com.dueeeke.dkplayer.R; 9 | import com.dueeeke.dkplayer.activity.pip.AndroidOPiPActivity; 10 | import com.dueeeke.dkplayer.activity.pip.PIPActivity; 11 | import com.dueeeke.dkplayer.activity.pip.PIPListActivity; 12 | import com.dueeeke.dkplayer.activity.pip.TinyScreenActivity; 13 | import com.dueeeke.dkplayer.fragment.BaseFragment; 14 | 15 | public class PipFragment extends BaseFragment implements View.OnClickListener { 16 | 17 | @Override 18 | protected int getLayoutResId() { 19 | return R.layout.fragment_pip; 20 | } 21 | 22 | @Override 23 | protected void initView() { 24 | super.initView(); 25 | findViewById(R.id.btn_pip).setOnClickListener(this); 26 | findViewById(R.id.btn_pip_in_list).setOnClickListener(this); 27 | findViewById(R.id.btn_pip_android_o).setOnClickListener(this); 28 | findViewById(R.id.btn_tiny_screen).setOnClickListener(this); 29 | } 30 | 31 | @Override 32 | public void onClick(View v) { 33 | switch (v.getId()) { 34 | case R.id.btn_pip: 35 | startActivity(new Intent(getActivity(), PIPActivity.class)); 36 | break; 37 | case R.id.btn_pip_in_list: 38 | startActivity(new Intent(getActivity(), PIPListActivity.class)); 39 | break; 40 | case R.id.btn_pip_android_o: 41 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { 42 | startActivity(new Intent(getActivity(), AndroidOPiPActivity.class)); 43 | } else { 44 | Toast.makeText(getActivity(), "Android O required.", Toast.LENGTH_SHORT).show(); 45 | } 46 | break; 47 | case R.id.btn_tiny_screen: 48 | startActivity(new Intent(getActivity(), TinyScreenActivity.class)); 49 | break; 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /dkplayer-sample/src/main/java/com/dueeeke/dkplayer/util/IntentKeys.java: -------------------------------------------------------------------------------- 1 | package com.dueeeke.dkplayer.util; 2 | 3 | public class IntentKeys { 4 | 5 | public static final String URL = "url"; 6 | public static final String SEAMLESS_PLAY = "seamless_play"; 7 | public static final String TITLE = "title"; 8 | public static final String IS_LIVE = "isLive"; 9 | } 10 | -------------------------------------------------------------------------------- /dkplayer-sample/src/main/java/com/dueeeke/dkplayer/util/ProgressManagerImpl.java: -------------------------------------------------------------------------------- 1 | package com.dueeeke.dkplayer.util; 2 | 3 | import androidx.collection.LruCache; 4 | import android.text.TextUtils; 5 | 6 | import com.dueeeke.videoplayer.player.ProgressManager; 7 | 8 | public class ProgressManagerImpl extends ProgressManager { 9 | 10 | //保存100条记录 11 | private static LruCache mCache = new LruCache<>(100); 12 | 13 | @Override 14 | public void saveProgress(String url, long progress) { 15 | if (TextUtils.isEmpty(url)) return; 16 | if (progress == 0) { 17 | clearSavedProgressByUrl(url); 18 | return; 19 | } 20 | mCache.put(url.hashCode(), progress); 21 | } 22 | 23 | @Override 24 | public long getSavedProgress(String url) { 25 | if (TextUtils.isEmpty(url)) return 0; 26 | Long pro = mCache.get(url.hashCode()); 27 | if (pro == null) return 0; 28 | return pro; 29 | } 30 | 31 | public void clearAllSavedProgress() { 32 | mCache.evictAll(); 33 | } 34 | 35 | public void clearSavedProgressByUrl(String url) { 36 | mCache.remove(url.hashCode()); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /dkplayer-sample/src/main/java/com/dueeeke/dkplayer/util/Tag.java: -------------------------------------------------------------------------------- 1 | package com.dueeeke.dkplayer.util; 2 | 3 | /** 4 | * 播放器标签 5 | */ 6 | public final class Tag { 7 | //列表播放 8 | public static final String LIST = "list"; 9 | //无缝播放 10 | public static final String SEAMLESS = "seamless"; 11 | //画中画 12 | public static final String PIP = "pip"; 13 | } 14 | -------------------------------------------------------------------------------- /dkplayer-sample/src/main/java/com/dueeeke/dkplayer/util/Utils.java: -------------------------------------------------------------------------------- 1 | package com.dueeeke.dkplayer.util; 2 | 3 | import android.view.View; 4 | import android.view.ViewParent; 5 | import android.widget.FrameLayout; 6 | 7 | import com.dueeeke.videoplayer.player.VideoViewConfig; 8 | import com.dueeeke.videoplayer.player.VideoViewManager; 9 | 10 | import java.lang.reflect.Field; 11 | 12 | public final class Utils { 13 | 14 | private Utils() { 15 | } 16 | 17 | 18 | /** 19 | * 获取当前的播放核心 20 | */ 21 | public static Object getCurrentPlayerFactory() { 22 | VideoViewConfig config = VideoViewManager.getConfig(); 23 | Object playerFactory = null; 24 | try { 25 | Field mPlayerFactoryField = config.getClass().getDeclaredField("mPlayerFactory"); 26 | mPlayerFactoryField.setAccessible(true); 27 | playerFactory = mPlayerFactoryField.get(config); 28 | } catch (Exception e) { 29 | e.printStackTrace(); 30 | } 31 | return playerFactory; 32 | } 33 | 34 | /** 35 | * 将View从父控件中移除 36 | */ 37 | public static void removeViewFormParent(View v) { 38 | if (v == null) return; 39 | ViewParent parent = v.getParent(); 40 | if (parent instanceof FrameLayout) { 41 | ((FrameLayout) parent).removeView(v); 42 | } 43 | } 44 | 45 | 46 | } 47 | -------------------------------------------------------------------------------- /dkplayer-sample/src/main/java/com/dueeeke/dkplayer/util/cache/ProxyVideoCacheManager.java: -------------------------------------------------------------------------------- 1 | package com.dueeeke.dkplayer.util.cache; 2 | 3 | import android.content.Context; 4 | 5 | import com.danikula.videocache.HttpProxyCacheServer; 6 | import com.danikula.videocache.StorageUtils; 7 | 8 | import java.io.File; 9 | 10 | public class ProxyVideoCacheManager { 11 | 12 | private static HttpProxyCacheServer sharedProxy; 13 | 14 | private ProxyVideoCacheManager() { 15 | } 16 | 17 | public static HttpProxyCacheServer getProxy(Context context) { 18 | return sharedProxy == null ? (sharedProxy = newProxy(context)) : sharedProxy; 19 | } 20 | 21 | private static HttpProxyCacheServer newProxy(Context context) { 22 | return new HttpProxyCacheServer.Builder(context) 23 | .maxCacheSize(512 * 1024 * 1024) // 512MB for cache 24 | //缓存路径,不设置默认在sd_card/Android/data/[app_package_name]/cache中 25 | // .cacheDirectory() 26 | .build(); 27 | } 28 | 29 | 30 | /** 31 | * 删除所有缓存文件 32 | * @return 返回缓存是否删除成功 33 | */ 34 | public static boolean clearAllCache(Context context) { 35 | getProxy(context); 36 | return StorageUtils.deleteFiles(sharedProxy.getCacheRoot()); 37 | } 38 | 39 | /** 40 | * 删除url对应默认缓存文件 41 | * @return 返回缓存是否删除成功 42 | */ 43 | public static boolean clearDefaultCache(Context context, String url) { 44 | getProxy(context); 45 | File pathTmp = sharedProxy.getTempCacheFile(url); 46 | File path = sharedProxy.getCacheFile(url); 47 | return StorageUtils.deleteFile(pathTmp.getAbsolutePath()) && 48 | StorageUtils.deleteFile(path.getAbsolutePath()); 49 | 50 | } 51 | } -------------------------------------------------------------------------------- /dkplayer-sample/src/main/java/com/dueeeke/dkplayer/widget/CenteredImageSpan.java: -------------------------------------------------------------------------------- 1 | package com.dueeeke.dkplayer.widget; 2 | 3 | import android.graphics.Canvas; 4 | import android.graphics.Paint; 5 | import android.graphics.Rect; 6 | import android.graphics.drawable.Drawable; 7 | import android.text.style.ImageSpan; 8 | 9 | /** 10 | * 图文混排使图片文字基于中线对齐 11 | */ 12 | public class CenteredImageSpan extends ImageSpan { 13 | 14 | public CenteredImageSpan(final Drawable drawable) { 15 | super(drawable); 16 | } 17 | 18 | @Override 19 | public int getSize(Paint paint, CharSequence text, int start, int end, 20 | Paint.FontMetricsInt fm) { 21 | Drawable d = getDrawable(); 22 | Rect rect = d.getBounds(); 23 | if (fm != null) { 24 | Paint.FontMetricsInt fmPaint = paint.getFontMetricsInt(); 25 | int fontHeight = fmPaint.bottom - fmPaint.top; 26 | int drHeight = rect.bottom - rect.top; 27 | 28 | int top = drHeight / 2 - fontHeight / 4; 29 | int bottom = drHeight / 2 + fontHeight / 4; 30 | 31 | fm.ascent = -bottom; 32 | fm.top = -bottom; 33 | fm.bottom = top; 34 | fm.descent = top; 35 | } 36 | return rect.right; 37 | } 38 | 39 | @Override 40 | public void draw(Canvas canvas, CharSequence text, int start, int end, 41 | float x, int top, int y, int bottom, Paint paint) { 42 | Drawable b = getDrawable(); 43 | canvas.save(); 44 | int transY; 45 | transY = ((bottom - top) - b.getBounds().bottom) / 2 + top; 46 | canvas.translate(x, transY); 47 | b.draw(canvas); 48 | canvas.restore(); 49 | } 50 | } 51 | 52 | -------------------------------------------------------------------------------- /dkplayer-sample/src/main/java/com/dueeeke/dkplayer/widget/controller/FloatController.java: -------------------------------------------------------------------------------- 1 | package com.dueeeke.dkplayer.widget.controller; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | 6 | import androidx.annotation.NonNull; 7 | import androidx.annotation.Nullable; 8 | 9 | import com.dueeeke.dkplayer.widget.component.PipControlView; 10 | import com.dueeeke.videocontroller.component.CompleteView; 11 | import com.dueeeke.videocontroller.component.ErrorView; 12 | import com.dueeeke.videoplayer.controller.GestureVideoController; 13 | 14 | /** 15 | * 悬浮播放控制器 16 | * Created by dueeeke on 2017/6/1. 17 | */ 18 | public class FloatController extends GestureVideoController { 19 | 20 | public FloatController(@NonNull Context context) { 21 | super(context); 22 | } 23 | 24 | public FloatController(@NonNull Context context, @Nullable AttributeSet attrs) { 25 | super(context, attrs); 26 | } 27 | 28 | @Override 29 | protected int getLayoutId() { 30 | return 0; 31 | } 32 | 33 | @Override 34 | protected void initView() { 35 | super.initView(); 36 | addControlComponent(new CompleteView(getContext())); 37 | addControlComponent(new ErrorView(getContext())); 38 | addControlComponent(new PipControlView(getContext())); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /dkplayer-sample/src/main/java/com/dueeeke/dkplayer/widget/controller/TikTokController.java: -------------------------------------------------------------------------------- 1 | package com.dueeeke.dkplayer.widget.controller; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | 6 | import androidx.annotation.NonNull; 7 | import androidx.annotation.Nullable; 8 | 9 | import com.dueeeke.videoplayer.controller.BaseVideoController; 10 | 11 | /** 12 | * 抖音 13 | * Created by dueeeke on 2018/1/6. 14 | */ 15 | 16 | public class TikTokController extends BaseVideoController { 17 | 18 | public TikTokController(@NonNull Context context) { 19 | super(context); 20 | } 21 | 22 | public TikTokController(@NonNull Context context, @Nullable AttributeSet attrs) { 23 | super(context, attrs); 24 | } 25 | 26 | public TikTokController(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) { 27 | super(context, attrs, defStyleAttr); 28 | } 29 | 30 | @Override 31 | protected int getLayoutId() { 32 | return 0; 33 | } 34 | 35 | @Override 36 | public boolean showNetWarning() { 37 | //不显示移动网络播放警告 38 | return false; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /dkplayer-sample/src/main/java/com/dueeeke/dkplayer/widget/player/CustomExoMediaPlayer.java: -------------------------------------------------------------------------------- 1 | package com.dueeeke.dkplayer.widget.player; 2 | 3 | 4 | import android.content.Context; 5 | 6 | import com.dueeeke.videoplayer.exo.ExoMediaPlayer; 7 | import com.google.android.exoplayer2.source.MediaSource; 8 | 9 | /** 10 | * 自定义ExoMediaPlayer,目前扩展了诸如边播边存,以及可以直接设置Exo自己的MediaSource。 11 | */ 12 | public class CustomExoMediaPlayer extends ExoMediaPlayer { 13 | 14 | public CustomExoMediaPlayer(Context context) { 15 | super(context); 16 | } 17 | 18 | public void setDataSource(MediaSource dataSource) { 19 | mMediaSource = dataSource; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /dkplayer-sample/src/main/java/com/dueeeke/dkplayer/widget/player/CustomIjkMediaPlayer.java: -------------------------------------------------------------------------------- 1 | package com.dueeeke.dkplayer.widget.player; 2 | 3 | import android.content.Context; 4 | 5 | import com.dueeeke.videoplayer.ijk.IjkPlayer; 6 | 7 | import tv.danmaku.ijk.media.player.IjkMediaPlayer; 8 | 9 | public class CustomIjkMediaPlayer extends IjkPlayer { 10 | 11 | public CustomIjkMediaPlayer(Context context) { 12 | super(context); 13 | } 14 | 15 | /** 16 | * 设置IjkMediaPlayer.OPT_CATEGORY_PLAYER相关配置 17 | */ 18 | public void setPlayerOption(String name, String value) { 19 | mMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, name, value); 20 | } 21 | 22 | /** 23 | * 设置IjkMediaPlayer.OPT_CATEGORY_PLAYER相关配置 24 | */ 25 | public void setPlayerOption(String name, long value) { 26 | mMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, name, value); 27 | } 28 | 29 | /** 30 | * 设置IjkMediaPlayer.OPT_CATEGORY_FORMAT相关配置 31 | */ 32 | public void setFormatOption(String name, String value) { 33 | mMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_FORMAT, name, value); 34 | } 35 | 36 | /** 37 | * 设置IjkMediaPlayer.OPT_CATEGORY_FORMAT相关配置 38 | */ 39 | public void setFormatOption(String name, long value) { 40 | mMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_FORMAT, name, value); 41 | } 42 | 43 | /** 44 | * 设置IjkMediaPlayer.OPT_CATEGORY_CODEC相关配置 45 | */ 46 | public void setCodecOption(String name, String value) { 47 | mMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_CODEC, name, value); 48 | } 49 | 50 | /** 51 | * 设置IjkMediaPlayer.OPT_CATEGORY_CODEC相关配置 52 | */ 53 | public void setCodecOption(String name, long value) { 54 | mMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_CODEC, name, value); 55 | } 56 | 57 | /** 58 | * 设置IjkMediaPlayer.OPT_CATEGORY_SWS相关配置 59 | */ 60 | public void setSwsOption(String name, String value) { 61 | mMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_SWS, name, value); 62 | } 63 | 64 | /** 65 | * 设置IjkMediaPlayer.OPT_CATEGORY_SWS相关配置 66 | */ 67 | public void setSwsOption(String name, long value) { 68 | mMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_SWS, name, value); 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /dkplayer-sample/src/main/java/com/dueeeke/dkplayer/widget/render/SurfaceRenderViewFactory.java: -------------------------------------------------------------------------------- 1 | package com.dueeeke.dkplayer.widget.render; 2 | 3 | import android.content.Context; 4 | 5 | import com.dueeeke.videoplayer.render.IRenderView; 6 | import com.dueeeke.videoplayer.render.RenderViewFactory; 7 | import com.dueeeke.videoplayer.render.TextureRenderView; 8 | 9 | public class SurfaceRenderViewFactory extends RenderViewFactory { 10 | 11 | public static SurfaceRenderViewFactory create() { 12 | return new SurfaceRenderViewFactory(); 13 | } 14 | 15 | @Override 16 | public IRenderView createRenderView(Context context) { 17 | return new SurfaceRenderView(context); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /dkplayer-sample/src/main/res/anim/anim_alpha_in.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | -------------------------------------------------------------------------------- /dkplayer-sample/src/main/res/anim/anim_alpha_out.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | -------------------------------------------------------------------------------- /dkplayer-sample/src/main/res/anim/anim_float_window_enter.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 9 | 11 | -------------------------------------------------------------------------------- /dkplayer-sample/src/main/res/anim/anim_float_window_exit.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 9 | 11 | -------------------------------------------------------------------------------- /dkplayer-sample/src/main/res/anim/anim_slide_bottom_in.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | -------------------------------------------------------------------------------- /dkplayer-sample/src/main/res/anim/anim_slide_bottom_out.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | -------------------------------------------------------------------------------- /dkplayer-sample/src/main/res/anim/anim_slide_top_in.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | -------------------------------------------------------------------------------- /dkplayer-sample/src/main/res/anim/anim_slide_top_out.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | -------------------------------------------------------------------------------- /dkplayer-sample/src/main/res/drawable-hdpi/ic_tab_extension.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xusigh/dueeeke-DKVideoPlayer/b6463577ccb0fbd881f0c2991f2276332d01d200/dkplayer-sample/src/main/res/drawable-hdpi/ic_tab_extension.png -------------------------------------------------------------------------------- /dkplayer-sample/src/main/res/drawable-hdpi/ic_tab_functions.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xusigh/dueeeke-DKVideoPlayer/b6463577ccb0fbd881f0c2991f2276332d01d200/dkplayer-sample/src/main/res/drawable-hdpi/ic_tab_functions.png -------------------------------------------------------------------------------- /dkplayer-sample/src/main/res/drawable-hdpi/ic_tab_list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xusigh/dueeeke-DKVideoPlayer/b6463577ccb0fbd881f0c2991f2276332d01d200/dkplayer-sample/src/main/res/drawable-hdpi/ic_tab_list.png -------------------------------------------------------------------------------- /dkplayer-sample/src/main/res/drawable-hdpi/ic_tab_picture_in_picture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xusigh/dueeeke-DKVideoPlayer/b6463577ccb0fbd881f0c2991f2276332d01d200/dkplayer-sample/src/main/res/drawable-hdpi/ic_tab_picture_in_picture.png -------------------------------------------------------------------------------- /dkplayer-sample/src/main/res/drawable-mdpi/ic_tab_extension.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xusigh/dueeeke-DKVideoPlayer/b6463577ccb0fbd881f0c2991f2276332d01d200/dkplayer-sample/src/main/res/drawable-mdpi/ic_tab_extension.png -------------------------------------------------------------------------------- /dkplayer-sample/src/main/res/drawable-mdpi/ic_tab_functions.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xusigh/dueeeke-DKVideoPlayer/b6463577ccb0fbd881f0c2991f2276332d01d200/dkplayer-sample/src/main/res/drawable-mdpi/ic_tab_functions.png -------------------------------------------------------------------------------- /dkplayer-sample/src/main/res/drawable-mdpi/ic_tab_list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xusigh/dueeeke-DKVideoPlayer/b6463577ccb0fbd881f0c2991f2276332d01d200/dkplayer-sample/src/main/res/drawable-mdpi/ic_tab_list.png -------------------------------------------------------------------------------- /dkplayer-sample/src/main/res/drawable-mdpi/ic_tab_picture_in_picture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xusigh/dueeeke-DKVideoPlayer/b6463577ccb0fbd881f0c2991f2276332d01d200/dkplayer-sample/src/main/res/drawable-mdpi/ic_tab_picture_in_picture.png -------------------------------------------------------------------------------- /dkplayer-sample/src/main/res/drawable-xhdpi/ic_tab_extension.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xusigh/dueeeke-DKVideoPlayer/b6463577ccb0fbd881f0c2991f2276332d01d200/dkplayer-sample/src/main/res/drawable-xhdpi/ic_tab_extension.png -------------------------------------------------------------------------------- /dkplayer-sample/src/main/res/drawable-xhdpi/ic_tab_functions.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xusigh/dueeeke-DKVideoPlayer/b6463577ccb0fbd881f0c2991f2276332d01d200/dkplayer-sample/src/main/res/drawable-xhdpi/ic_tab_functions.png -------------------------------------------------------------------------------- /dkplayer-sample/src/main/res/drawable-xhdpi/ic_tab_list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xusigh/dueeeke-DKVideoPlayer/b6463577ccb0fbd881f0c2991f2276332d01d200/dkplayer-sample/src/main/res/drawable-xhdpi/ic_tab_list.png -------------------------------------------------------------------------------- /dkplayer-sample/src/main/res/drawable-xhdpi/ic_tab_picture_in_picture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xusigh/dueeeke-DKVideoPlayer/b6463577ccb0fbd881f0c2991f2276332d01d200/dkplayer-sample/src/main/res/drawable-xhdpi/ic_tab_picture_in_picture.png -------------------------------------------------------------------------------- /dkplayer-sample/src/main/res/drawable-xxhdpi/ic_tab_extension.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xusigh/dueeeke-DKVideoPlayer/b6463577ccb0fbd881f0c2991f2276332d01d200/dkplayer-sample/src/main/res/drawable-xxhdpi/ic_tab_extension.png -------------------------------------------------------------------------------- /dkplayer-sample/src/main/res/drawable-xxhdpi/ic_tab_functions.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xusigh/dueeeke-DKVideoPlayer/b6463577ccb0fbd881f0c2991f2276332d01d200/dkplayer-sample/src/main/res/drawable-xxhdpi/ic_tab_functions.png -------------------------------------------------------------------------------- /dkplayer-sample/src/main/res/drawable-xxhdpi/ic_tab_list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xusigh/dueeeke-DKVideoPlayer/b6463577ccb0fbd881f0c2991f2276332d01d200/dkplayer-sample/src/main/res/drawable-xxhdpi/ic_tab_list.png -------------------------------------------------------------------------------- /dkplayer-sample/src/main/res/drawable-xxhdpi/ic_tab_picture_in_picture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xusigh/dueeeke-DKVideoPlayer/b6463577ccb0fbd881f0c2991f2276332d01d200/dkplayer-sample/src/main/res/drawable-xxhdpi/ic_tab_picture_in_picture.png -------------------------------------------------------------------------------- /dkplayer-sample/src/main/res/drawable-xxxhdpi/ic_tab_extension.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xusigh/dueeeke-DKVideoPlayer/b6463577ccb0fbd881f0c2991f2276332d01d200/dkplayer-sample/src/main/res/drawable-xxxhdpi/ic_tab_extension.png -------------------------------------------------------------------------------- /dkplayer-sample/src/main/res/drawable-xxxhdpi/ic_tab_functions.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xusigh/dueeeke-DKVideoPlayer/b6463577ccb0fbd881f0c2991f2276332d01d200/dkplayer-sample/src/main/res/drawable-xxxhdpi/ic_tab_functions.png -------------------------------------------------------------------------------- /dkplayer-sample/src/main/res/drawable-xxxhdpi/ic_tab_list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xusigh/dueeeke-DKVideoPlayer/b6463577ccb0fbd881f0c2991f2276332d01d200/dkplayer-sample/src/main/res/drawable-xxxhdpi/ic_tab_list.png -------------------------------------------------------------------------------- /dkplayer-sample/src/main/res/drawable-xxxhdpi/ic_tab_picture_in_picture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xusigh/dueeeke-DKVideoPlayer/b6463577ccb0fbd881f0c2991f2276332d01d200/dkplayer-sample/src/main/res/drawable-xxxhdpi/ic_tab_picture_in_picture.png -------------------------------------------------------------------------------- /dkplayer-sample/src/main/res/drawable/selector_mute_icon.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /dkplayer-sample/src/main/res/drawable/shape_ad_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /dkplayer-sample/src/main/res/drawable/shape_float_window_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /dkplayer-sample/src/main/res/layout/activity_custom_exo_player.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 13 | 14 |