TextureViewVideoScaler

所属分类:内容生成
开发工具:Java
文件大小:89KB
下载次数:0
上传日期:2017-04-17 22:52:07
上 传 者sh-1993
说明:  [Android]非常轻量级的助手类,用于在纹理视图中调整视频大小,以适应中心或裁剪中心
([Android] Very lightweight helper class to resize the video in texture view to fit center or crop center)

文件列表:
.travis.yml (266, 2017-04-18)
LICENSE (11357, 2017-04-18)
app (0, 2017-04-18)
app\build.gradle (657, 2017-04-18)
app\proguard-rules.pro (930, 2017-04-18)
app\src (0, 2017-04-18)
app\src\main (0, 2017-04-18)
app\src\main\AndroidManifest.xml (807, 2017-04-18)
app\src\main\java (0, 2017-04-18)
app\src\main\java\com (0, 2017-04-18)
app\src\main\java\com\akexorcist (0, 2017-04-18)
app\src\main\java\com\akexorcist\textureviewvideoscaler (0, 2017-04-18)
app\src\main\java\com\akexorcist\textureviewvideoscaler\example (0, 2017-04-18)
app\src\main\java\com\akexorcist\textureviewvideoscaler\example\MainActivity.java (4329, 2017-04-18)
app\src\main\res (0, 2017-04-18)
app\src\main\res\layout (0, 2017-04-18)
app\src\main\res\layout\activity_main.xml (1330, 2017-04-18)
app\src\main\res\mipmap-hdpi (0, 2017-04-18)
app\src\main\res\mipmap-hdpi\ic_launcher.png (3418, 2017-04-18)
app\src\main\res\mipmap-hdpi\ic_launcher_round.png (4208, 2017-04-18)
app\src\main\res\mipmap-mdpi (0, 2017-04-18)
app\src\main\res\mipmap-mdpi\ic_launcher.png (2206, 2017-04-18)
app\src\main\res\mipmap-mdpi\ic_launcher_round.png (2555, 2017-04-18)
app\src\main\res\mipmap-xhdpi (0, 2017-04-18)
app\src\main\res\mipmap-xhdpi\ic_launcher.png (4842, 2017-04-18)
app\src\main\res\mipmap-xhdpi\ic_launcher_round.png (6114, 2017-04-18)
app\src\main\res\mipmap-xxhdpi (0, 2017-04-18)
app\src\main\res\mipmap-xxhdpi\ic_launcher.png (7718, 2017-04-18)
app\src\main\res\mipmap-xxhdpi\ic_launcher_round.png (10056, 2017-04-18)
app\src\main\res\mipmap-xxxhdpi (0, 2017-04-18)
app\src\main\res\mipmap-xxxhdpi\ic_launcher.png (10486, 2017-04-18)
app\src\main\res\mipmap-xxxhdpi\ic_launcher_round.png (14696, 2017-04-18)
app\src\main\res\values (0, 2017-04-18)
app\src\main\res\values\colors.xml (253, 2017-04-18)
app\src\main\res\values\strings.xml (201, 2017-04-18)
app\src\main\res\values\styles.xml (383, 2017-04-18)
build.gradle (654, 2017-04-18)
... ...

# TextureViewVideoScaler Very lightweight helper class to resize the video in texture view to fit center or crop center Because TextureView doesn't support with video scaling like the ExoPlayer library and many develop still use TextureView to display the video. This library already provided the code for video scaling, so you don't need to write that boilerplate code anymore. Just use this library Installation =============================== Maven ``` com.akexorcist textureviewvideoscaler 0.9.9 ``` Gradle ``` compile 'com.akexorcist:textureviewvideoscaler:0.9.9' ``` Usage =============================== When you want to do the video scaling in your TextureView, just call the ```getVideoScaleMatrix(...)``` method ```java float viewWidth = ...TextureView's width... float viewHeight = ...TextureView's height... float videoWidth = ...Video's width... float videoHeight = ...Video's height... //int scaleType = VideoScaler.FILL; //int scaleType = VideoScaler.CROP_CENTER; int scaleType = VideoScaler.FIT_CENTER; Matrix matrix = VideoScaler.getVideoScaleMatrix(viewWidth, viewHeight, videoWidth, videoHeight, scaleType); textureView.setTransform(matrix); ``` This static method will result the result as Matrix class that you can set directly to TextureView (or customize something in Matrix class before use it) Licence =========================== Copyright 2017 Akexorcist Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with the License. You may obtain a copy of the License in the LICENSE file, or at: http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

近期下载者

相关文件


收藏者