Skip to content

Commit e5f0efd

Browse files
author
KingYin
committed
Merge remote-tracking branch 'origin/master'
2 parents 0824c27 + bbc726a commit e5f0efd

File tree

1 file changed

+112
-10
lines changed

1 file changed

+112
-10
lines changed

README.md

Lines changed: 112 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,120 @@
11
# WSLiveDemo
22
直播SDK,推流,录制视频,滤镜。
33

4+
博客教程:http://blog.csdn.net/King1425/article/details/79392158
45

5-
1.Add it in your root build.gradle at the end of repositories:
6+
概述:
7+
---
8+
**现在把我们项目中的直播SDK开源出来,我们是境外直播平台,百万用户,经过半年迭代,SDK已经相当稳定,大家可以放心使用。https://github.com/WangShuo1143368701/WSLiveDemo**
9+
这个sdk是我根据这个[librestreaming](https://github.com/lakeinchina/librestreaming)修修改改出来的,由于改了太多的代码,用法已经不一样了。
610

7-
allprojects {
8-
repositories {
9-
...
10-
maven { url 'https://jitpack.io' }
11-
}
12-
}
11+
之前写过一篇[ffmpeg实战教程(十一)手把手教你实现直播功能,不依赖第三方SDK](http://blog.csdn.net/king1425/article/details/72560673)
12+
是用ffmpeg实现的推流,但是在实际移动端直播项目中,推流是不适合用ffmpeg的。
13+
14+
特性:
15+
--
16+
支持视频录制和推流,推流录制视频可以同时进行<br/>
17+
支持设置关键帧间隔gop<br/>
18+
支持动态设置码率,帧率<br/>
19+
支持分开设置预览分辨率,编码的分辨率<br/>
20+
支持gpu滤镜,并可以通过opengles绘制图像纹理来自定义滤镜。<br/>
21+
支持设fbo滤镜组。<br/>
22+
支持前后摄像头快速切换,不会打断推流。<br/>
23+
支持后台推流,后台录制视频<br/>
24+
美颜滤镜可动态调节磨皮,美白,红润。<br/>
25+
兼容GPUImage,一行代码不用修改就可以直接使用GPUImage的滤镜。可参考demo。<br/>
26+
27+
关于美颜:
28+
----
29+
美颜滤镜可动态调节磨皮,美白,红润。你可以调出一个你喜欢的美颜滤镜。
30+
31+
关于性能:
32+
-----
33+
采用相机回调纹理texture,OpenGL渲染后直接把textureID传给编码器的方案,中间没有数据格式转换,没有glReadPixel()函数耗时问题。所以性能较其它方案要好的多。缺点是必须是Android4.3以上。
34+
35+
关于使用:
36+
-----
37+
38+
1.所有常用API都在StreamLiveCameraView类中
39+
40+
```
41+
<me.lake.librestreaming.ws.StreamLiveCameraView
42+
android:id="@+id/stream_previewView"
43+
android:layout_width="match_parent"
44+
android:layout_height="match_parent"/>
45+
```
46+
47+
2.初始化推流配置, StreamAVOption类里面有多种参数可配置,如不配置则使用默认值
48+
49+
```
50+
/**
51+
* 设置推流参数
52+
*/
53+
public void initLiveConfig() {
54+
mLiveCameraView = (StreamLiveCameraView) findViewById(R.id.stream_previewView);
55+
56+
//参数配置 start
57+
streamAVOption = new StreamAVOption();
58+
streamAVOption.streamUrl = rtmpUrl;
59+
//参数配置 end
60+
61+
mLiveCameraView.init(this, streamAVOption);
62+
mLiveCameraView.addStreamStateListener(resConnectionListener);
63+
//设置滤镜组
64+
LinkedList<BaseHardVideoFilter> files = new LinkedList<>();
65+
files.add(new GPUImageCompatibleFilter(new GPUImageBeautyFilter()));
66+
files.add(new GPUImageCompatibleFilter(new GPUImageAddBlendFilter()));
67+
mLiveCameraView.setHardVideoFilter(new HardVideoGroupFilter(files));
68+
}
69+
```
70+
3.开始推流录制 具体参考demo:
1371

14-
2. Add the dependency
72+
```
73+
case R.id.btn_startStreaming://开始推流
74+
if(!liveCameraView.isStreaming()){
75+
liveCameraView.startStreaming(rtmpUrl);
76+
}
77+
break;
78+
case R.id.btn_stopStreaming://停止推流
79+
if(liveCameraView.isStreaming()){
80+
liveCameraView.stopStreaming();
81+
}
82+
break;
83+
case R.id.btn_startRecord://开始录制
84+
if(!liveCameraView.isRecord()){
85+
liveCameraView.startRecord();
86+
}
87+
break;
88+
case R.id.btn_stopRecord://停止录制
89+
if(liveCameraView.isRecord()){
90+
liveCameraView.stopRecord();
91+
}
92+
```
1593

16-
dependencies {
17-
compile 'com.github.WangShuo1143368701:WSLiveDemo:v1.0'
94+
关于集成:
95+
-----
96+
方法1.https://github.com/WangShuo1143368701/WSLiveDemo下载后,copy出libWSLive库到你的项目中即可。
97+
98+
方法2.
99+
100+
```
101+
//Add it in your root build.gradle at the end of repositories:
102+
103+
allprojects {
104+
repositories {
105+
...
106+
maven { url 'https://jitpack.io' }
18107
}
108+
}
109+
110+
//Add the dependency
111+
112+
dependencies { compile 'com.github.WangShuo1143368701:WSLiveDemo:v1.0' }
113+
114+
```
115+
116+
117+
118+
119+
120+

0 commit comments

Comments
 (0)