From 0aa8f39cac825d6917871a56c674ba71b5012a11 Mon Sep 17 00:00:00 2001 From: song <764469385@qq.com> Date: Wed, 29 Mar 2017 14:56:51 +0800 Subject: [PATCH] frist --- .gitignore | 47 +- ISSUE_TEMPLATE.zh-CN.md | 13 + LICENSE | 372 +++++---- PULL_REQUEST_TEMPLATE.zh-CN.md | 15 + README.md | 70 +- app/.gitignore | 1 + app/build.gradle | 44 + app/proguard-rules.pro | 17 + app/src/main/AndroidManifest.xml | 36 + app/src/main/assets/tv.txt | 63 ++ .../main/java/org/song/demo/MainActivity.java | 158 ++++ app/src/main/res/layout/activity_main.xml | 90 +++ app/src/main/res/mipmap-hdpi/ic_launcher.png | Bin 0 -> 3418 bytes app/src/main/res/mipmap-mdpi/ic_launcher.png | Bin 0 -> 2206 bytes app/src/main/res/mipmap-xhdpi/ic_launcher.png | Bin 0 -> 4842 bytes app/src/main/res/mipmap-xxhdpi/cover.jpg | Bin 0 -> 11049 bytes .../main/res/mipmap-xxhdpi/ic_launcher.png | Bin 0 -> 7718 bytes .../main/res/mipmap-xxxhdpi/ic_launcher.png | Bin 0 -> 10486 bytes app/src/main/res/values-w820dp/dimens.xml | 6 + app/src/main/res/values/colors.xml | 6 + app/src/main/res/values/dimens.xml | 5 + app/src/main/res/values/strings.xml | 3 + app/src/main/res/values/styles.xml | 11 + build.gradle | 24 + gradle.properties | 17 + gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 53636 bytes gradle/wrapper/gradle-wrapper.properties | 6 + gradlew | 160 ++++ gradlew.bat | 90 +++ qsvideoplayer/.gitignore | 1 + qsvideoplayer/build.gradle | 56 ++ qsvideoplayer/libs/exo-2.0.4.jar | Bin 0 -> 973025 bytes qsvideoplayer/proguard-rules.pro | 17 + qsvideoplayer/src/main/AndroidManifest.xml | 14 + .../org/song/videoplayer/BaseVideoView.java | 749 ++++++++++++++++++ .../org/song/videoplayer/ConfigManage.java | 73 ++ .../song/videoplayer/HandleTouchEvent.java | 135 ++++ .../org/song/videoplayer/IVideoPlayer.java | 54 ++ .../org/song/videoplayer/PlayListener.java | 23 + .../org/song/videoplayer/QSVideoView.java | 442 +++++++++++ .../main/java/org/song/videoplayer/Util.java | 96 +++ .../song/videoplayer/media/AndroidMedia.java | 196 +++++ .../org/song/videoplayer/media/BaseMedia.java | 27 + .../org/song/videoplayer/media/ExoMedia.java | 283 +++++++ .../videoplayer/media/IMediaCallback.java | 24 + .../song/videoplayer/media/IMediaControl.java | 63 ++ .../song/videoplayer/media/IjkBaseMedia.java | 204 +++++ .../song/videoplayer/media/IjkExoMedia.java | 46 ++ .../org/song/videoplayer/media/IjkMedia.java | 62 ++ .../videoplayer/rederview/IRenderView.java | 50 ++ .../rederview/SufaceRenderView.java | 203 +++++ .../rederview/TextureRenderView.java | 208 +++++ .../src/main/res/drawable-xhdpi/jc_back.png | Bin 0 -> 495 bytes .../drawable-xhdpi/jc_back_tiny_normal.png | Bin 0 -> 531 bytes .../drawable-xhdpi/jc_back_tiny_pressed.png | Bin 0 -> 486 bytes .../res/drawable-xhdpi/jc_backward_icon.png | Bin 0 -> 1392 bytes .../drawable-xhdpi/jc_brightness_video.png | Bin 0 -> 1058 bytes .../main/res/drawable-xhdpi/jc_enlarge.png | Bin 0 -> 252 bytes .../res/drawable-xhdpi/jc_error_normal.png | Bin 0 -> 5691 bytes .../res/drawable-xhdpi/jc_error_pressed.png | Bin 0 -> 5646 bytes .../res/drawable-xhdpi/jc_forward_icon.png | Bin 0 -> 1381 bytes .../main/res/drawable-xhdpi/jc_loading_bg.png | Bin 0 -> 4044 bytes .../res/drawable-xhdpi/jc_pause_normal.png | Bin 0 -> 1599 bytes .../res/drawable-xhdpi/jc_pause_pressed.png | Bin 0 -> 1497 bytes .../res/drawable-xhdpi/jc_play_normal.png | Bin 0 -> 2295 bytes .../res/drawable-xhdpi/jc_play_pressed.png | Bin 0 -> 2148 bytes .../src/main/res/drawable-xhdpi/jc_shrink.png | Bin 0 -> 181 bytes .../res/drawable-xhdpi/jc_volume_icon.png | Bin 0 -> 922 bytes .../main/res/drawable/bottom_backgroud.xml | 8 + .../drawable/jc_click_back_tiny_selector.xml | 6 + .../res/drawable/jc_click_error_selector.xml | 5 + .../res/drawable/jc_click_pause_selector.xml | 6 + .../res/drawable/jc_click_play_selector.xml | 5 + .../main/res/drawable/jc_dialog_progress.xml | 17 + .../res/drawable/jc_dialog_progress_bg.xml | 9 + .../src/main/res/drawable/jc_loading.xml | 7 + .../src/main/res/drawable/jc_progress.xml | 28 + .../main/res/drawable/jc_seek_progress.xml | 28 + .../src/main/res/drawable/jc_seek_thumb.xml | 5 + .../res/drawable/jc_seek_thumb_normal.xml | 8 + .../res/drawable/jc_seek_thumb_pressed.xml | 8 + .../res/drawable/jc_volume_progress_bg.xml | 19 + .../src/main/res/drawable/top_backgroud.xml | 8 + .../main/res/layout/jc_dialog_brightness.xml | 43 + .../main/res/layout/jc_dialog_progress.xml | 64 ++ .../src/main/res/layout/jc_dialog_volume.xml | 44 + .../src/main/res/layout/video_view.xml | 147 ++++ .../src/main/res/values-pt/strings.xml | 7 + .../src/main/res/values-tr/strings.xml | 7 + .../src/main/res/values-zh/strings.xml | 7 + qsvideoplayer/src/main/res/values/colors.xml | 4 + qsvideoplayer/src/main/res/values/dimens.xml | 1 + qsvideoplayer/src/main/res/values/ids.xml | 18 + qsvideoplayer/src/main/res/values/strings.xml | 7 + qsvideoplayer/src/main/res/values/styles.xml | 26 + settings.gradle | 1 + 96 files changed, 4591 insertions(+), 232 deletions(-) create mode 100644 ISSUE_TEMPLATE.zh-CN.md create mode 100644 PULL_REQUEST_TEMPLATE.zh-CN.md create mode 100644 app/.gitignore create mode 100644 app/build.gradle create mode 100644 app/proguard-rules.pro create mode 100644 app/src/main/AndroidManifest.xml create mode 100644 app/src/main/assets/tv.txt create mode 100644 app/src/main/java/org/song/demo/MainActivity.java create mode 100644 app/src/main/res/layout/activity_main.xml create mode 100644 app/src/main/res/mipmap-hdpi/ic_launcher.png create mode 100644 app/src/main/res/mipmap-mdpi/ic_launcher.png create mode 100644 app/src/main/res/mipmap-xhdpi/ic_launcher.png create mode 100644 app/src/main/res/mipmap-xxhdpi/cover.jpg create mode 100644 app/src/main/res/mipmap-xxhdpi/ic_launcher.png create mode 100644 app/src/main/res/mipmap-xxxhdpi/ic_launcher.png create mode 100644 app/src/main/res/values-w820dp/dimens.xml create mode 100644 app/src/main/res/values/colors.xml create mode 100644 app/src/main/res/values/dimens.xml create mode 100644 app/src/main/res/values/strings.xml create mode 100644 app/src/main/res/values/styles.xml create mode 100644 build.gradle create mode 100644 gradle.properties create mode 100644 gradle/wrapper/gradle-wrapper.jar create mode 100644 gradle/wrapper/gradle-wrapper.properties create mode 100644 gradlew create mode 100644 gradlew.bat create mode 100644 qsvideoplayer/.gitignore create mode 100644 qsvideoplayer/build.gradle create mode 100644 qsvideoplayer/libs/exo-2.0.4.jar create mode 100644 qsvideoplayer/proguard-rules.pro create mode 100644 qsvideoplayer/src/main/AndroidManifest.xml create mode 100644 qsvideoplayer/src/main/java/org/song/videoplayer/BaseVideoView.java create mode 100644 qsvideoplayer/src/main/java/org/song/videoplayer/ConfigManage.java create mode 100644 qsvideoplayer/src/main/java/org/song/videoplayer/HandleTouchEvent.java create mode 100644 qsvideoplayer/src/main/java/org/song/videoplayer/IVideoPlayer.java create mode 100644 qsvideoplayer/src/main/java/org/song/videoplayer/PlayListener.java create mode 100644 qsvideoplayer/src/main/java/org/song/videoplayer/QSVideoView.java create mode 100644 qsvideoplayer/src/main/java/org/song/videoplayer/Util.java create mode 100644 qsvideoplayer/src/main/java/org/song/videoplayer/media/AndroidMedia.java create mode 100644 qsvideoplayer/src/main/java/org/song/videoplayer/media/BaseMedia.java create mode 100644 qsvideoplayer/src/main/java/org/song/videoplayer/media/ExoMedia.java create mode 100644 qsvideoplayer/src/main/java/org/song/videoplayer/media/IMediaCallback.java create mode 100644 qsvideoplayer/src/main/java/org/song/videoplayer/media/IMediaControl.java create mode 100644 qsvideoplayer/src/main/java/org/song/videoplayer/media/IjkBaseMedia.java create mode 100644 qsvideoplayer/src/main/java/org/song/videoplayer/media/IjkExoMedia.java create mode 100644 qsvideoplayer/src/main/java/org/song/videoplayer/media/IjkMedia.java create mode 100644 qsvideoplayer/src/main/java/org/song/videoplayer/rederview/IRenderView.java create mode 100644 qsvideoplayer/src/main/java/org/song/videoplayer/rederview/SufaceRenderView.java create mode 100644 qsvideoplayer/src/main/java/org/song/videoplayer/rederview/TextureRenderView.java create mode 100644 qsvideoplayer/src/main/res/drawable-xhdpi/jc_back.png create mode 100644 qsvideoplayer/src/main/res/drawable-xhdpi/jc_back_tiny_normal.png create mode 100644 qsvideoplayer/src/main/res/drawable-xhdpi/jc_back_tiny_pressed.png create mode 100644 qsvideoplayer/src/main/res/drawable-xhdpi/jc_backward_icon.png create mode 100644 qsvideoplayer/src/main/res/drawable-xhdpi/jc_brightness_video.png create mode 100644 qsvideoplayer/src/main/res/drawable-xhdpi/jc_enlarge.png create mode 100644 qsvideoplayer/src/main/res/drawable-xhdpi/jc_error_normal.png create mode 100644 qsvideoplayer/src/main/res/drawable-xhdpi/jc_error_pressed.png create mode 100644 qsvideoplayer/src/main/res/drawable-xhdpi/jc_forward_icon.png create mode 100644 qsvideoplayer/src/main/res/drawable-xhdpi/jc_loading_bg.png create mode 100644 qsvideoplayer/src/main/res/drawable-xhdpi/jc_pause_normal.png create mode 100644 qsvideoplayer/src/main/res/drawable-xhdpi/jc_pause_pressed.png create mode 100644 qsvideoplayer/src/main/res/drawable-xhdpi/jc_play_normal.png create mode 100644 qsvideoplayer/src/main/res/drawable-xhdpi/jc_play_pressed.png create mode 100644 qsvideoplayer/src/main/res/drawable-xhdpi/jc_shrink.png create mode 100644 qsvideoplayer/src/main/res/drawable-xhdpi/jc_volume_icon.png create mode 100644 qsvideoplayer/src/main/res/drawable/bottom_backgroud.xml create mode 100644 qsvideoplayer/src/main/res/drawable/jc_click_back_tiny_selector.xml create mode 100644 qsvideoplayer/src/main/res/drawable/jc_click_error_selector.xml create mode 100644 qsvideoplayer/src/main/res/drawable/jc_click_pause_selector.xml create mode 100644 qsvideoplayer/src/main/res/drawable/jc_click_play_selector.xml create mode 100644 qsvideoplayer/src/main/res/drawable/jc_dialog_progress.xml create mode 100644 qsvideoplayer/src/main/res/drawable/jc_dialog_progress_bg.xml create mode 100644 qsvideoplayer/src/main/res/drawable/jc_loading.xml create mode 100644 qsvideoplayer/src/main/res/drawable/jc_progress.xml create mode 100644 qsvideoplayer/src/main/res/drawable/jc_seek_progress.xml create mode 100644 qsvideoplayer/src/main/res/drawable/jc_seek_thumb.xml create mode 100644 qsvideoplayer/src/main/res/drawable/jc_seek_thumb_normal.xml create mode 100644 qsvideoplayer/src/main/res/drawable/jc_seek_thumb_pressed.xml create mode 100644 qsvideoplayer/src/main/res/drawable/jc_volume_progress_bg.xml create mode 100644 qsvideoplayer/src/main/res/drawable/top_backgroud.xml create mode 100644 qsvideoplayer/src/main/res/layout/jc_dialog_brightness.xml create mode 100644 qsvideoplayer/src/main/res/layout/jc_dialog_progress.xml create mode 100644 qsvideoplayer/src/main/res/layout/jc_dialog_volume.xml create mode 100644 qsvideoplayer/src/main/res/layout/video_view.xml create mode 100644 qsvideoplayer/src/main/res/values-pt/strings.xml create mode 100644 qsvideoplayer/src/main/res/values-tr/strings.xml create mode 100644 qsvideoplayer/src/main/res/values-zh/strings.xml create mode 100644 qsvideoplayer/src/main/res/values/colors.xml create mode 100644 qsvideoplayer/src/main/res/values/dimens.xml create mode 100644 qsvideoplayer/src/main/res/values/ids.xml create mode 100644 qsvideoplayer/src/main/res/values/strings.xml create mode 100644 qsvideoplayer/src/main/res/values/styles.xml create mode 100644 settings.gradle diff --git a/.gitignore b/.gitignore index f6b286c..4bec01d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,40 +1,9 @@ -# Built application files -*.apk -*.ap_ - -# Files for the ART/Dalvik VM -*.dex - -# Java class files -*.class - -# Generated files -bin/ -gen/ -out/ - -# Gradle files -.gradle/ -build/ - -# Local configuration file (sdk path, etc) -local.properties - -# Proguard folder generated by Eclipse -proguard/ - -# Log Files -*.log - -# Android Studio Navigation editor temp files -.navigation/ - -# Android Studio captures folder -captures/ - -# Intellij *.iml -.idea/workspace.xml - -# Keystore files -*.jks +.gradle +/local.properties +/.idea/workspace.xml +/.idea +.DS_Store +/build +/captures +.externalNativeBuild diff --git a/ISSUE_TEMPLATE.zh-CN.md b/ISSUE_TEMPLATE.zh-CN.md new file mode 100644 index 0000000..1a52d83 --- /dev/null +++ b/ISSUE_TEMPLATE.zh-CN.md @@ -0,0 +1,13 @@ +## 该问题是怎么引起的? + + + +## 重现步骤 + + + +## 报错信息 + + + + diff --git a/LICENSE b/LICENSE index 8dada3e..4621858 100644 --- a/LICENSE +++ b/LICENSE @@ -1,201 +1,191 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright {yyyy} {name of copyright owner} +Apache License +Version 2.0, January 2004 +http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + +"License" shall mean the terms and conditions for use, reproduction, and +distribution as defined by Sections 1 through 9 of this document. + +"Licensor" shall mean the copyright owner or entity authorized by the copyright +owner that is granting the License. + +"Legal Entity" shall mean the union of the acting entity and all other entities +that control, are controlled by, or are under common control with that entity. +For the purposes of this definition, "control" means (i) the power, direct or +indirect, to cause the direction or management of such entity, whether by +contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the +outstanding shares, or (iii) beneficial ownership of such entity. + +"You" (or "Your") shall mean an individual or Legal Entity exercising +permissions granted by this License. + +"Source" form shall mean the preferred form for making modifications, including +but not limited to software source code, documentation source, and configuration +files. + +"Object" form shall mean any form resulting from mechanical transformation or +translation of a Source form, including but not limited to compiled object code, +generated documentation, and conversions to other media types. + +"Work" shall mean the work of authorship, whether in Source or Object form, made +available under the License, as indicated by a copyright notice that is included +in or attached to the work (an example is provided in the Appendix below). + +"Derivative Works" shall mean any work, whether in Source or Object form, that +is based on (or derived from) the Work and for which the editorial revisions, +annotations, elaborations, or other modifications represent, as a whole, an +original work of authorship. For the purposes of this License, Derivative Works +shall not include works that remain separable from, or merely link (or bind by +name) to the interfaces of, the Work and Derivative Works thereof. + +"Contribution" shall mean any work of authorship, including the original version +of the Work and any modifications or additions to that Work or Derivative Works +thereof, that is intentionally submitted to Licensor for inclusion in the Work +by the copyright owner or by an individual or Legal Entity authorized to submit +on behalf of the copyright owner. For the purposes of this definition, +"submitted" means any form of electronic, verbal, or written communication sent +to the Licensor or its representatives, including but not limited to +communication on electronic mailing lists, source code control systems, and +issue tracking systems that are managed by, or on behalf of, the Licensor for +the purpose of discussing and improving the Work, but excluding communication +that is conspicuously marked or otherwise designated in writing by the copyright +owner as "Not a Contribution." + +"Contributor" shall mean Licensor and any individual or Legal Entity on behalf +of whom a Contribution has been received by Licensor and subsequently +incorporated within the Work. + +2. Grant of Copyright License. + +Subject to the terms and conditions of this License, each Contributor hereby +grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, +irrevocable copyright license to reproduce, prepare Derivative Works of, +publicly display, publicly perform, sublicense, and distribute the Work and such +Derivative Works in Source or Object form. + +3. Grant of Patent License. + +Subject to the terms and conditions of this License, each Contributor hereby +grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, +irrevocable (except as stated in this section) patent license to make, have +made, use, offer to sell, sell, import, and otherwise transfer the Work, where +such license applies only to those patent claims licensable by such Contributor +that are necessarily infringed by their Contribution(s) alone or by combination +of their Contribution(s) with the Work to which such Contribution(s) was +submitted. If You institute patent litigation against any entity (including a +cross-claim or counterclaim in a lawsuit) alleging that the Work or a +Contribution incorporated within the Work constitutes direct or contributory +patent infringement, then any patent licenses granted to You under this License +for that Work shall terminate as of the date such litigation is filed. + +4. Redistribution. + +You may reproduce and distribute copies of the Work or Derivative Works thereof +in any medium, with or without modifications, and in Source or Object form, +provided that You meet the following conditions: + +You must give any other recipients of the Work or Derivative Works a copy of +this License; and +You must cause any modified files to carry prominent notices stating that You +changed the files; and +You must retain, in the Source form of any Derivative Works that You distribute, +all copyright, patent, trademark, and attribution notices from the Source form +of the Work, excluding those notices that do not pertain to any part of the +Derivative Works; and +If the Work includes a "NOTICE" text file as part of its distribution, then any +Derivative Works that You distribute must include a readable copy of the +attribution notices contained within such NOTICE file, excluding those notices +that do not pertain to any part of the Derivative Works, in at least one of the +following places: within a NOTICE text file distributed as part of the +Derivative Works; within the Source form or documentation, if provided along +with the Derivative Works; or, within a display generated by the Derivative +Works, if and wherever such third-party notices normally appear. The contents of +the NOTICE file are for informational purposes only and do not modify the +License. You may add Your own attribution notices within Derivative Works that +You distribute, alongside or as an addendum to the NOTICE text from the Work, +provided that such additional attribution notices cannot be construed as +modifying the License. +You may add Your own copyright statement to Your modifications and may provide +additional or different license terms and conditions for use, reproduction, or +distribution of Your modifications, or for any such Derivative Works as a whole, +provided Your use, reproduction, and distribution of the Work otherwise complies +with the conditions stated in this License. + +5. Submission of Contributions. + +Unless You explicitly state otherwise, any Contribution intentionally submitted +for inclusion in the Work by You to the Licensor shall be under the terms and +conditions of this License, without any additional terms or conditions. +Notwithstanding the above, nothing herein shall supersede or modify the terms of +any separate license agreement you may have executed with Licensor regarding +such Contributions. + +6. Trademarks. + +This License does not grant permission to use the trade names, trademarks, +service marks, or product names of the Licensor, except as required for +reasonable and customary use in describing the origin of the Work and +reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. + +Unless required by applicable law or agreed to in writing, Licensor provides the +Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, +including, without limitation, any warranties or conditions of TITLE, +NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are +solely responsible for determining the appropriateness of using or +redistributing the Work and assume any risks associated with Your exercise of +permissions under this License. + +8. Limitation of Liability. + +In no event and under no legal theory, whether in tort (including negligence), +contract, or otherwise, unless required by applicable law (such as deliberate +and grossly negligent acts) or agreed to in writing, shall any Contributor be +liable to You for damages, including any direct, indirect, special, incidental, +or consequential damages of any character arising as a result of this License or +out of the use or inability to use the Work (including but not limited to +damages for loss of goodwill, work stoppage, computer failure or malfunction, or +any and all other commercial damages or losses), even if such Contributor has +been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. + +While redistributing the Work or Derivative Works thereof, You may choose to +offer, and charge a fee for, acceptance of support, warranty, indemnity, or +other liability obligations and/or rights consistent with this License. However, +in accepting such obligations, You may act only on Your own behalf and on Your +sole responsibility, not on behalf of any other Contributor, and only if You +agree to indemnify, defend, and hold each Contributor harmless for any liability +incurred by, or claims asserted against, such Contributor by reason of your +accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work + +To apply the Apache License to your work, attach the following boilerplate +notice, with the fields enclosed by brackets "{}" replaced with your own +identifying information. (Don't include the brackets!) The text should be +enclosed in the appropriate comment syntax for the file format. We also +recommend that a file or class name and description of purpose be included on +the same "printed page" as the copyright notice for easier identification within +third-party archives. + + Copyright 2017 蔡小路 Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and - limitations under the License. + limitations under the License. \ No newline at end of file diff --git a/PULL_REQUEST_TEMPLATE.zh-CN.md b/PULL_REQUEST_TEMPLATE.zh-CN.md new file mode 100644 index 0000000..636c20f --- /dev/null +++ b/PULL_REQUEST_TEMPLATE.zh-CN.md @@ -0,0 +1,15 @@ +## 该Pull Request关联的Issue + + +## 修改描述 + + + +## 测试用例 + + + +## 修复效果的截屏 + + + diff --git a/README.md b/README.md index 8d02846..3d1fd69 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,68 @@ -# QSVideoPlayer -安卓视频播放器AndroidVideoplayer,ui参考jc播放器,架构重新设计,支持多种解码 +#QSVideoPlayer + * UI设计基于jc播放器,可快速自定义ui打造自己的播放器,不用写一行播放逻辑 + * 可扩展设计,解码模块目前提供了 AndroidMedia(系统自带)、ijkMedia(基于ffmepg)+ijkExoMedia(基于exo)、ExoMedia(2.0.4)解码器 + * 根据系统版本选择SurfaceView和TextureView,支持api9+ + * 支持本地视频,在线视频,m3u8直播等... + +根据需求自行选择需要的解码器,不需要的解码器在build.gradle注释掉/删掉jar,关联错误的类删掉即可,不会影响其他 +1.一般简单播放视频AndroidMedia足够(体积最小,无依赖) +2.有点需求可选择AndroidMedia+ExoMedia(1MB) +3.需求高的可选AndroidMedia+(ijkMedia+ijkExoMedia)(打完包6MB+) +目前测试解码效果ijkMedia最快最好,AndroidMedia个别视频有半途中断BUG,exo无明显缺陷 + +#使用说明 +下载项目 添加qsvideoplayre文件夹为自己的项目依赖即可 +diy播放器: +可直接修改QSVideoView改造自己的播放器 或 继承BaseVideoView参考QSVideoView +只需子类提供layout布局以及设置各个状态的ui即可完成自己的播放器,播放逻辑一行不用写 +``` +QSVideoView qsVideoView = (QSVideoView) findViewById(R.id.xxx); +qsVideoView.setUp(url, "这是一一一一一一一一一个标题"); +qsVideoView.play();// +``` + +#其他API + +``` +qsVideoView.stop();//暂停 +qsVideoView.seekTo(100000);//跳进度 +qsVideoView.release();//销毁 + +qsVideoView.getCoverImageView().setImageResource(R.mipmap.cover);//封面 + +//设置监听 +qsVideoView.setPlayListener(new PlayListener() { + @Override + public void onStatus(int status) {//播放器的ui状态 + if (status == IVideoPlayer.STATE_AUTO_COMPLETE) + qsVideoView.quitWindowFullscreen();//播放完成退出全屏 + } + + @Override//全屏/普通... + public void onMode(int mode) { + + } + + @Override//播放事件 初始化完成/缓冲/出错/... + public void onEvent(int what, Integer... extra) { + + } + + }); + +qsVideoView.enterFullMode=1;//进入全屏的模式 0默认是横屏 1是竖屏,随传感器自动切换横屏 + + +``` +#返回键退出全屏 +``` + @Override + public void onBackPressed() { + if (qsVideoView.onBackPressed()) + return; + super.onBackPressed(); + } +``` + +![输入图片说明](http://git.oschina.net/uploads/images/2017/0301/151443_9778d0d4_530535.jpeg "在这里输入图片标题") +![输入图片说明](http://git.oschina.net/uploads/images/2017/0224/180438_84c8332c_530535.jpeg "在这里输入图片标题") \ No newline at end of file diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/app/build.gradle b/app/build.gradle new file mode 100644 index 0000000..0f6af62 --- /dev/null +++ b/app/build.gradle @@ -0,0 +1,44 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 24 + buildToolsVersion "25.0.2" + defaultConfig { + applicationId "org.song.demo" + minSdkVersion 15 + targetSdkVersion 24 + versionCode 1 + versionName "1.0" + testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + } + sourceSets { + main() { + manifest.srcFile 'src/main/AndroidManifest.xml' + java.srcDirs = ['src/main/java'] + resources.srcDirs = ['src/main/resources'] + res.srcDirs = ['src/main/res'] + assets.srcDirs = ['src/main/assets'] + jniLibs.srcDirs = ['libs'] + jni.srcDirs = ['src/main/jni'] + + } + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + compile fileTree(dir: 'libs', include: ['*.jar']) + androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { + exclude group: 'com.android.support', module: 'support-annotations' + }) + compile 'com.android.support:appcompat-v7:24.2.1' + testCompile 'junit:junit:4.12' + + compile project(':qsvideoplayer') + +} diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 0000000..6037025 --- /dev/null +++ b/app/proguard-rules.pro @@ -0,0 +1,17 @@ +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in C:\Develop\Android SDK/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the proguardFiles +# directive in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..4d3a710 --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/assets/tv.txt b/app/src/main/assets/tv.txt new file mode 100644 index 0000000..767bea8 --- /dev/null +++ b/app/src/main/assets/tv.txt @@ -0,0 +1,63 @@ +CCTV1ۺ,http://58.135.196.138:8090/live/db3bd108e3364bf3888ccaf8377af077/index.m3u8 +CCTV2ƾ,http://58.135.196.138:8090/live/e31fa63612644555a545781ea32e66d4/index.m3u8 +CCTV3,http://58.135.196.138:8090/live/A68CE6833D654a9e932A657689463088/index.m3u8 +CCTV4Ĺ(),http://58.135.196.138:8090/live/56383AB184D54ac8B20478B6A43906DC/index.m3u8 +cctv5,http://58.135.196.138:8090/live/6b9e3889ec6e2ab1a8c7bd0845e5368a/index.m3u8 +CCTV6Ӱ,http://58.135.196.138:8090/live/6132e9cb136050bd94822db31d1401af/index.m3u8 +CCTV7ũҵ,http://58.135.196.138:8090/live/a9a97bed07eca008a1c88c9d7c74965d/index.m3u8 +CCTV8Ӿ,http://58.135.196.138:8090/live/6e38d69416f160bad4657788d6c06c01/index.m3u8 +CCTV9¼,http://58.135.196.138:8090/live/557a950d2cfcf2ee1aad5a260893c2b8/index.m3u8 +CCTV10ƽ,http://58.135.196.138:8090/live/a0effe8f31af0011b750e817c1b6e8c7/index.m3u8 +CCTV11Ϸ,http://58.135.196.138:8090/live/2D5B4B7AB5A14d79A0D9A1D37540E2BF/index.m3u8 +CCTV12뷨,http://58.135.196.138:8090/live/3720126fbea745f74c1c89df9797caac/index.m3u8 +CCTV13,http://58.135.196.138:8090/live/5e02ac2a0829f7ab10d6543fdd211d8e/index.m3u8 +CCTV14ٶ,http://58.135.196.138:8090/live/4A5DF0BA0C994081B02F8215491C4E48/index.m3u8 +CCTV15,http://58.135.196.138:8090/live/ADBD55B50F2D47bb970DCCBAF458E6C8/index.m3u8 +֮,http://58.135.196.138:8090/live/1AB9A2A4F4CE48b397D72A067906D763/index.m3u8 +,http://58.135.196.138:8090/live/D6C05AA9AFEF4ac58A6ED0FFF27EE85A/index.m3u8 +һ糡,http://58.135.196.138:8090/live/13BCA1A2EFDB4db3B5DF6A8D343C3E39/index.m3u8 +ɾ糡,http://58.135.196.138:8090/live/65A216E9B6FC4905AF6756E2AEFC3ED3/index.m3u8 +ƾ糡,http://58.135.196.138:8090/live/8D574FF6D0B04a0eA8B51D55B7C8E6DD/index.m3u8 +,http://58.135.196.138:8090/live/789E9CE292A040d2A459CF55D2FB362E/789E9CE292A040d2A459CF55D2FB362E.m3u8 +Ѷ,http://58.135.196.138:8090/live/369024B4C9BF4b0f909187FC58B9951C/369024B4C9BF4b0f909187FC58B9951C.m3u8 +,http://58.135.196.138:8090/live/F56C438F495049168C447030C175F7DB/F56C438F495049168C447030C175F7DB.m3u8 +ƽ,http://58.135.196.138:8090/live/1E8AF3D32194426dAC087FF20B098BCC/1E8AF3D32194426dAC087FF20B098BCC.m3u8 +Ӱ,http://58.135.196.138:8090/live/8a6870a0febf6283b27210aab721beb4/8a6870a0febf6283b27210aab721beb4.m3u8 +ƾ,http://58.135.196.138:8090/live/8C213826A5E049849097FE77230B0616/8C213826A5E049849097FE77230B0616.m3u8 +,http://58.135.196.138:8090/live/c6e9431fbe2634418def86d4b193d80d/c6e9431fbe2634418def86d4b193d80d.m3u8 +,http://58.135.196.138:8090/live/dd728b0bef32c98060a0d4f757b6dbaf/dd728b0bef32c98060a0d4f757b6dbaf.m3u8 +,http://58.135.196.138:8090/live/87446EA70C0C42119656A11938ACB2DD/87446EA70C0C42119656A11938ACB2DD.m3u8 +,http://58.135.196.138:8090/live/C42481BFB2FD456480A098436834DFF0/C42481BFB2FD456480A098436834DFF0.m3u8 +ٶ,http://58.135.196.138:8090/live/543E9B8D048648e399E66EA338EF761C/543E9B8D048648e399E66EA338EF761C.m3u8 +DOXTV,http://58.135.196.138:8090/live/7FDF7FBEC2B8474dA349102809CB8F97/7FDF7FBEC2B8474dA349102809CB8F97.m3u863 +Ƶ,http://58.135.196.138:8090/live/022ED5AEC04546d99958328E2E6BB614/022ED5AEC04546d99958328E2E6BB614.m3u8 +,http://58.135.196.138:8090/live/A3A45E102C5F41afBD78A5E27FF0578F/A3A45E102C5F41afBD78A5E27FF0578F.m3u8 +Ƹ,http://58.135.196.138:8090/live/2615D9C21AB248678ED9CF172E463539/2615D9C21AB248678ED9CF172E463539.m3u8 +ƾ,http://58.135.196.138:8090/live/295A4BAF84504aba8B1ED913A9790E08/295A4BAF84504aba8B1ED913A9790E08.m3u8 +㳡,http://58.135.196.138:8090/live/E1F31105D6094bb6ADB5E698CB6EE4D8/E1F31105D6094bb6ADB5E698CB6EE4D8.m3u8 +Ƶ,http://58.135.196.138:8090/live/6E6AAB7CE02545e0868A71B4A8DA2559/6E6AAB7CE02545e0868A71B4A8DA2559.m3u8 +,http://58.135.196.138:8090/live/4818B652431344a8882ED935471711B5/4818B652431344a8882ED935471711B5.m3u8 +߶,http://58.135.196.138:8090/live/ED54356140BD4282AA0C6FE656CC6583/ED54356140BD4282AA0C6FE656CC6583.m3u8 +Ц糡,http://58.135.196.138:8090/live/B081DB925E434fa8A8A2812860B86785/B081DB925E434fa8A8A2812860B86785.m3u8 +,http://58.135.196.138:8090/live/B3EDABA59F6240889F4C5162AF4655D3/B3EDABA59F6240889F4C5162AF4655D3.m3u8 +,http://58.135.196.138:8090/live/333BAD8D3C2E4bfeA648053B7286A0BF/333BAD8D3C2E4bfeA648053B7286A0BF.m3u8 +,http://58.135.196.138:8090/live/77C9E60036F64711B8C5F5111BF5A7F1/77C9E60036F64711B8C5F5111BF5A7F1.m3u8 +ͥ,http://58.135.196.138:8090/live/D70719FBFE2242c6BA2B6235C834D896/D70719FBFE2242c6BA2B6235C834D896.m3u8 +ӥͨ,http://58.135.196.138:8090/live/345A6019C2734ec7BE05BD4C6837EFD3/345A6019C2734ec7BE05BD4C6837EFD3.m3u8 +,http://58.135.196.138:8090/live/5B33459CF0314e3e831351B3ED17F844/5B33459CF0314e3e831351B3ED17F844.m3u8 +,http://58.135.196.138:8090/live/AA4E088E6AB54779A3A4ED856016317E/AA4E088E6AB54779A3A4ED856016317E.m3u8 +ֳ,http://58.135.196.138:8090/live/95589A5033F948749F9ABD897E2C0032/95589A5033F948749F9ABD897E2C0032.m3u8 +ŷ,http://58.135.196.138:8090/live/980D3B2CF76042269F81A12B635ED9E9/980D3B2CF76042269F81A12B635ED9E9.m3u8 +ȫʵ,http://58.135.196.138:8090/live/94C1846FCB3E48278D2B6BA49164EC33/94C1846FCB3E48278D2B6BA49164EC33.m3u8 +ʱ,http://58.135.196.138:8090/live/379B386B5A214f8fA2B9F4DF1946BF6D/379B386B5A214f8fA2B9F4DF1946BF6D.m3u8 +ʱ,http://58.135.196.138:8090/live/373331B772D1418eAB2D7EEA0C7B3691/373331B772D1418eAB2D7EEA0C7B3691.m3u8 +ʱʳ,http://58.135.196.138:8090/live/07A1BF033E7940898A01053F79EF3595/07A1BF033E7940898A01053F79EF3595.m3u8 +ղ,http://58.135.196.138:8090/live/91ADF5DB36DE4c0f8E56FC3386836EA3/91ADF5DB36DE4c0f8E56FC3386836EA3.m3u8 +ĺ,http://58.135.196.138:8090/live/6E1087643B3D445fBCECAF3B54544767/6E1087643B3D445fBCECAF3B54544767.m3u8 +ȷ¼,http://58.135.196.138:8090/live/394BAD414F284fbf9EA8F08106741A63/394BAD414F284fbf9EA8F08106741A63.m3u8 +¶,http://58.135.196.138:8090/live/3CDBE7F96BC1456cAAD86C571D5B1C43/3CDBE7F96BC1456cAAD86C571D5B1C43.m3u8 +,http://58.135.196.138:8090/live/883091E42C394ec3996932F152B95FD3/883091E42C394ec3996932F152B95FD3.m3u8 +̳,http://58.135.196.138:8090/live/62E9275D131549b080F9ABBDB5E48F4E/62E9275D131549b080F9ABBDB5E48F4E.m3u8 +ű,http://58.135.196.138:8090/live/FF453B3E5B4F446e978A7624254E3CD2/FF453B3E5B4F446e978A7624254E3CD2.m3u8 +Ϸ,http://58.135.196.138:8090/live/82769FB7307D460193359CA465D1C159/82769FB7307D460193359CA465D1C159.m3u8 +Ӿ糡,http://58.135.196.138:8090/live/369B8B9031894010B5BA822A1637FEF1/369B8B9031894010B5BA822A1637FEF1.m3u8 \ No newline at end of file diff --git a/app/src/main/java/org/song/demo/MainActivity.java b/app/src/main/java/org/song/demo/MainActivity.java new file mode 100644 index 0000000..addd396 --- /dev/null +++ b/app/src/main/java/org/song/demo/MainActivity.java @@ -0,0 +1,158 @@ +package org.song.demo; + +import android.os.Bundle; +import android.os.Handler; +import android.support.v7.app.AppCompatActivity; +import android.view.View; +import android.view.WindowManager; + +import org.song.videoplayer.IVideoPlayer; +import org.song.videoplayer.PlayListener; +import org.song.videoplayer.QSVideoView; + +public class MainActivity extends AppCompatActivity { + + QSVideoView qsVideoView; + + String mp4 = "http://sz-kpie-videos.oss-cn-shenzhen.aliyuncs.com/videos/20161110/11.mp4"; + + String m3u8 = "http://live.hkstv.hk.lxdns.com/live/hks/playlist.m3u8"; + + String url; + int media; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); + setContentView(R.layout.activity_main); + qsVideoView = (QSVideoView) findViewById(R.id.qs); + qsVideoView.getCoverImageView().setImageResource(R.mipmap.cover); + qsVideoView.setPlayListener(new PlayListener() { + @Override + public void onStatus(int status) {//播放状态 + if (status == IVideoPlayer.STATE_AUTO_COMPLETE) + qsVideoView.quitWindowFullscreen();//播放完成退出全屏 + } + + @Override//全屏/普通 + public void onMode(int mode) { + + } + + @Override + public void onEvent(int what, Integer... extra) { + + } + + }); + play(mp4, 0); + } + + + private void play(String url, int media) { + qsVideoView.release(); + qsVideoView.setiMediaControl(media); + qsVideoView.setUp(url, "这是一一一一一一一一一个标题"); + //qsVideoView.seekTo(12300); + qsVideoView.play(); + this.url = url; + this.media = media; + + //qsVideoView.enterFullMode =1; + } + + + public void 系统硬解(View v) { + play(url, 0); + setTitle("系统硬解"); + + } + + public void ijk_ffmepg解码(View v) { + play(url, 1); + setTitle("ijk_ffmepg解码"); + + } + + public void exo解码(View v) { + play(url, 2); + setTitle("exo解码"); + + } + + public void ijk_exo解码(View v) { + play(url, 3); + setTitle("ijk_exo解码"); + + } + + public void 网络视频(View v) { + play(mp4, media); + + } + + public void m3u8直播(View v) { + play(m3u8, media); + } + + public void 销毁(View v) { + qsVideoView.release(); + } + + + @Override + public void onBackPressed() { + if (qsVideoView.onBackPressed()) + return; + super.onBackPressed(); + } + + @Override + public void onResume() { + super.onResume(); + if (flag) + qsVideoView.play(); + handler.removeCallbacks(runnable); + if (position > 0) { + qsVideoView.seekTo(position); + position = 0; + } + + } + + boolean flag;//记录退出时播放状态 回来的时候继续播放 + int position;//记录销毁时的进度 回来继续盖进度播放 + + @Override + public void onPause() { + super.onPause();//暂停 + flag = qsVideoView.isPlaying(); + qsVideoView.pause(); + } + + + @Override + public void onStop() { + super.onStop();//不马上销毁 延时10秒 + handler.postDelayed(runnable, 1000 * 10); + } + + @Override + public void onDestroy() { + super.onDestroy();//销毁 + qsVideoView.release(); + } + + + Handler handler = new Handler(); + Runnable runnable = new Runnable() { + @Override + public void run() { + if (qsVideoView.getCurrentState() != IVideoPlayer.STATE_AUTO_COMPLETE) + position = qsVideoView.getPosition(); + qsVideoView.release(); + } + }; + +} diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..21d05bb --- /dev/null +++ b/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,90 @@ + + + + + + + + + +