Skip to content

Commit

Permalink
增加旋转播放画面的demo (2017-04-13)
Browse files Browse the repository at this point in the history
  • Loading branch information
CarGuo committed Apr 13, 2017
1 parent a07fbff commit 23ddac3
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ private void init() {
//videoPlayer.setUp(url, true, new File(FileUtils.getPath()), "");

//借用了jjdxm_ijkplayer的URL
String source1 = "http://111.198.24.133:83/yyy_login_server/pic/YB059284/97778276040859/1.mp4";
String source1 = "http://9890.vod.myqcloud.com/9890_4e292f9a3dd011e6b4078980237cc3d3.f20.mp4";
String name = "普通";
SwitchVideoModel switchVideoModel = new SwitchVideoModel(name, source1);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ public class SampleVideo extends StandardGSYVideoPlayer {

private TextView mSwitchSize;

private TextView mChangeRotate;

private List<SwitchVideoModel> mUrlList = new ArrayList<>();

//记住切换数据源类型
Expand Down Expand Up @@ -70,6 +72,7 @@ protected void init(Context context) {
private void initView() {
mMoreScale = (TextView) findViewById(R.id.moreScale);
mSwitchSize = (TextView) findViewById(R.id.switchSize);
mChangeRotate = (TextView) findViewById(R.id.change_rotate);

//切换清晰度
mMoreScale.setOnClickListener(new OnClickListener() {
Expand Down Expand Up @@ -105,6 +108,18 @@ public void onClick(View v) {
}
});

mChangeRotate.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if((mTextureView.getRotation() - mRotate) == 270) {
mTextureView.setRotation(mRotate);
} else {
mTextureView.setRotation(mTextureView.getRotation() + 90);
}

}
});

}

/**
Expand Down
11 changes: 11 additions & 0 deletions app/src/main/res/layout/sample_video.xml
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,17 @@
android:textColor="@android:color/white"
android:textSize="18sp" />

<TextView
android:id="@+id/change_rotate"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center"
android:minEms="5"
android:paddingLeft="10dp"
android:text="旋转画面"
android:textColor="@android:color/white"
android:textSize="13sp" />

<TextView
android:id="@+id/moreScale"
android:layout_width="wrap_content"
Expand Down

0 comments on commit 23ddac3

Please sign in to comment.