Skip to content

Commit 2cb284b

Browse files
committed
Update README.md
1 parent a95efed commit 2cb284b

File tree

1 file changed

+118
-0
lines changed

1 file changed

+118
-0
lines changed

README.md

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,119 @@
11
# ScalableVideoView
2+
3+
Android Texture VideoView having a variety of scale types like the scale types of ImageView.
4+
5+
# Release Note
6+
7+
[Release Note] (https://github.com/yqritc/Android-ScalableVideoView/releases)
8+
9+
# Gradle (coming soon)
10+
```
11+
repositories {
12+
jcenter()
13+
}
14+
15+
dependencies {
16+
compile 'com.yqritc:android-scalablevideoview:1.0.0'
17+
}
18+
```
19+
20+
# Support Scale Types
21+
22+
### Scale to fit
23+
- fitXY
24+
- fitStart
25+
- fitCenter
26+
- fitEnd
27+
28+
### No Scale
29+
- leftTop
30+
- leftCenter
31+
- leftBottom
32+
- centerTop
33+
- center
34+
- centerBottom
35+
- rightTop
36+
- rightCenter
37+
- rightBottom
38+
39+
### Crop
40+
- leftTopCrop
41+
- leftCenterCrop
42+
- leftBottomCrop
43+
- centerTopCrop
44+
- centerCrop
45+
- centerBottomCrop
46+
- rightTopCrop
47+
- rightCenterCrop
48+
- rightBottomCrop
49+
50+
### Scale Inside
51+
- startInside
52+
- centerInside
53+
- endInside
54+
55+
56+
# Usage
57+
58+
### Set scale type in layout file
59+
```
60+
<com.yqritc.scalablevideoview.ScalableVideoView
61+
android:id="@+id/video_view"
62+
android:layout_width="match_parent"
63+
android:layout_height="match_parent"
64+
android:layout_marginBottom="100dp"
65+
app:scalableType="fitCenter"/>
66+
```
67+
Please refere the following xml for the list of scalableType you can set.
68+
[attrs.xml](https://github.com/yqritc/Android-ScalableVideoView/blob/master/library/src/main/res/values/attrs.xml)
69+
70+
### Sample usage in source code
71+
```
72+
@Override
73+
protected void onCreate(Bundle savedInstanceState) {
74+
super.onCreate(savedInstanceState);
75+
setContentView(R.layout.activity_main);
76+
77+
mVideoView = (ScalableVideoView) findViewById(R.id.video_view);
78+
try {
79+
mVideoView.setRawData(R.raw.landscape_sample);
80+
} catch (IOException ioe) {
81+
//handle error
82+
}
83+
}
84+
85+
@Override
86+
public void onClick(View v) {
87+
switch (v.getId()) {
88+
case R.id.btn_start:
89+
mVideoView.start();
90+
break;
91+
case R.id.btn_update_scale:
92+
mVideoView.setScalableType(ScalableType.CENTER_TOP_CROP);
93+
mVideoView.invalidate();
94+
break;
95+
default:
96+
break;
97+
}
98+
}
99+
```
100+
[ScalableVideoView](https://github.com/yqritc/Android-ScalableVideoView/blob/master/library/src/main/java/com/yqritc/scalablevideoview/ScalableVideoView.java) is extending TextureView to play video by using MediaPlayer.
101+
Basic functionalities are defined in this class to play and scale video.
102+
If you need to control more, extend this class and define your custom video view.
103+
104+
105+
# License
106+
```
107+
Copyright 2015 yqritc
108+
109+
Licensed under the Apache License, Version 2.0 (the "License");
110+
you may not use this file except in compliance with the License.
111+
You may obtain a copy of the License at
112+
113+
http://www.apache.org/licenses/LICENSE-2.0
114+
115+
Unless required by applicable law or agreed to in writing, software
116+
distributed under the License is distributed on an "AS IS" BASIS,
117+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
118+
See the License for the specific language governing permissions and
119+
limitations under the License.

0 commit comments

Comments
 (0)