Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
ShenBen committed Oct 30, 2021
2 parents fa7772f + b5aa41f commit fde315a
Showing 1 changed file with 37 additions and 3 deletions.
40 changes: 37 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# WebRTCExtension
Android端WebRTC一些扩展方法:

>1、获取音频输出数据
>2、支持自定义是否启用H264、VP8、VP9编码
>3、待补充...
>1、获取音频输出数据
>2、支持自定义是否启用H264、VP8、VP9编码
>3、自定义SurfaceViewRenderer,支持画面角度旋转,支持设置垂直镜像;
## 引入
### 将JitPack存储库添加到您的项目中(项目根目录下build.gradle文件)
Expand Down Expand Up @@ -104,4 +104,38 @@ DefaultVideoEncoderFactory encoderFactory = DefaultVideoEncoderFactoryExtKt.crea
}
});
```


>自定义SurfaceViewRenderer,支持画面角度旋转,支持设置垂直镜像;
>使用方法与**org.webrtc.SurfaceViewRenderer**一致,将**org.webrtc.SurfaceViewRenderer**替换成**com.shencoder.webrtcextension.CustomSurfaceViewRenderer**即可。
布局中使用
```xml
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">

<com.shencoder.webrtcextension.CustomSurfaceViewRenderer
android:id="@+id/viewRenderer"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>
```

代码中使用
```java
CustomSurfaceViewRenderer viewRenderer = findViewById(R.id.viewRenderer);
//是否垂直镜像
viewRenderer.setMirrorVertically(false);
//设置旋转角度:0°、90°、180°、270°
viewRenderer.setRotationAngle(RotationAngle.ANGLE_90);
```
# [License](https://github.com/shenbengit/WebRTCExtension/blob/master/LICENSE)

0 comments on commit fde315a

Please sign in to comment.