Skip to content

Commit 2af6e5d

Browse files
committed
Fix bug, update sdk.
1 parent 46c201d commit 2af6e5d

File tree

63 files changed

+3600
-519
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+3600
-519
lines changed

Demo/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ android {
99
minSdkVersion rootProject.ext.minSdkVersion
1010
targetSdkVersion rootProject.ext.targetSdkVersion
1111
versionCode 24
12-
versionName "9.3.1169"
12+
versionName "9.4.0.1218"
1313

1414
multiDexEnabled true
1515
ndk {

Demo/app/src/main/java/com/tencent/liteav/demo/DemoApplication.java

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66

77
import androidx.multidex.MultiDexApplication;
88

9-
import com.tencent.rtmp.TXLiveBase;
10-
import com.tencent.rtmp.TXLiveBaseListener;
11-
129
import java.lang.reflect.Constructor;
1310
import java.lang.reflect.Field;
1411
import java.lang.reflect.Method;
@@ -19,10 +16,6 @@ public class DemoApplication extends MultiDexApplication {
1916
// private RefWatcher mRefWatcher;
2017
private static DemoApplication instance;
2118

22-
// 如何获取License? 请参考官网指引 https://cloud.tencent.com/document/product/454/34750
23-
String licenceUrl = "请替换成您的licenseUrl";
24-
String licenseKey = "请替换成您的licenseKey";
25-
2619
private Context mAppContext;
2720
@Override
2821
public void onCreate() {
@@ -32,19 +25,6 @@ public void onCreate() {
3225
mAppContext = this.getApplicationContext();
3326
instance = this;
3427

35-
36-
TXLiveBase.getInstance().setLicence(instance, licenceUrl, licenseKey);
37-
TXLiveBase.setListener(new TXLiveBaseListener() {
38-
@Override
39-
public void onUpdateNetworkTime(int errCode, String errMsg) {
40-
if (errCode != 0) {
41-
TXLiveBase.updateNetworkTime();
42-
}
43-
}
44-
});
45-
TXLiveBase.updateNetworkTime();
46-
47-
// 短视频licence设置
4828
StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder();
4929
StrictMode.setVmPolicy(builder.build());
5030
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {

Demo/app/src/main/java/com/tencent/liteav/demo/MainActivity.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import androidx.recyclerview.widget.RecyclerView;
1919

2020
import com.tencent.liteav.demo.common.widget.expandableadapter.BaseExpandableRecyclerViewAdapter;
21+
import com.tencent.liteav.demo.player.demo.FeedActivity;
2122
import com.tencent.liteav.demo.player.demo.SuperPlayerActivity;
2223
import com.tencent.liteav.demo.player.demo.shortvideo.view.ShortVideoActivity;
2324
import com.tencent.rtmp.TXLiveBase;
@@ -50,10 +51,11 @@ protected void onCreate(Bundle savedInstanceState) {
5051
return;
5152
}
5253

54+
TXCSDKService.init(getApplicationContext());
5355
setContentView(R.layout.activity_main);
5456

5557
mTvVersion = (TextView) findViewById(R.id.main_tv_version);
56-
mTvVersion.setText(getString(R.string.app_tv_super_player_version, TXLiveBase.getSDKVersionStr()+"(9.3.1169)"));
58+
mTvVersion.setText(getString(R.string.app_tv_super_player_version, TXLiveBase.getSDKVersionStr()+"(9.4.0.1218)"));
5759

5860
mMainTitle = (TextView) findViewById(R.id.main_title);
5961
mMainTitle.setOnLongClickListener(new View.OnLongClickListener() {
@@ -139,6 +141,7 @@ private List<GroupBean> initGroupData() {
139141
List<ChildBean> playerChildList = new ArrayList<>();
140142
playerChildList.add(new ChildBean(getString(R.string.app_item_super_player), R.drawable.play, 3, SuperPlayerActivity.class));
141143
playerChildList.add(new ChildBean(getString(R.string.app_item_shortvideo_player), R.drawable.play, 3, ShortVideoActivity.class));
144+
playerChildList.add(new ChildBean(getString(R.string.app_feed_player), R.drawable.play, 3, FeedActivity.class));
142145
if (playerChildList.size() != 0) {
143146
GroupBean playerGroupBean = new GroupBean(getString(R.string.app_item_player), R.drawable.composite, playerChildList);
144147
groupList.add(playerGroupBean);
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package com.tencent.liteav.demo;
2+
3+
import android.content.Context;
4+
5+
import com.tencent.rtmp.TXLiveBase;
6+
import com.tencent.rtmp.TXLiveBaseListener;
7+
8+
public class TXCSDKService {
9+
private static final String TAG = "TXCSDKService";
10+
// 如何获取License? 请参考官网指引 https://cloud.tencent.com/document/product/454/34750
11+
private static final String licenceUrl =
12+
"请替换成您的licenseUrl";
13+
private static final String licenseKey = "请替换成您的licenseKey";
14+
15+
private TXCSDKService() {
16+
}
17+
18+
/**
19+
* 初始化腾讯云相关sdk。
20+
* SDK 初始化过程中可能会读取手机型号等敏感信息,需要在用户同意隐私政策后,才能获取。
21+
*
22+
* @param appContext The application context.
23+
*/
24+
public static void init(Context appContext) {
25+
TXLiveBase.getInstance().setLicence(appContext, licenceUrl, licenseKey);
26+
TXLiveBase.setListener(new TXLiveBaseListener() {
27+
@Override
28+
public void onUpdateNetworkTime(int errCode, String errMsg) {
29+
if (errCode != 0) {
30+
TXLiveBase.updateNetworkTime();
31+
}
32+
}
33+
});
34+
TXLiveBase.updateNetworkTime();
35+
36+
// 短视频licence设置
37+
}
38+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<shape xmlns:android="http://schemas.android.com/apk/res/android"
2+
android:shape="rectangle">
3+
<!-- rectangle表示为矩形 -->
4+
5+
<!-- 填充的颜色 -->
6+
<solid android:color="@color/main_item_unselected_color" />
7+
8+
<!-- 边框的颜色和粗细 -->
9+
<stroke
10+
android:width="1dp"
11+
android:color="@color/white"
12+
/>
13+
14+
<!-- android:radius 圆角的半径 -->
15+
<corners
16+
android:radius="2dp"
17+
/>
18+
19+
</shape>

Demo/app/src/main/res/values-en/strings.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242

4343
<string name="app_item_super_player">Superplayer</string>
4444
<string name="app_item_shortvideo_player">Short Video Player</string>
45+
<string name="app_feed_player">Feed stream play</string>
4546
<string name="app_item_player">Player</string>
4647

4748
<string name="app_item_video_recording">Shooting</string>
@@ -105,4 +106,11 @@
105106
<string name="item_live_pusher_screen_v1">Screen Share V1</string>
106107
<string name="item_live_player_v1">Pull V1</string>
107108
<string name="item_link_mic_v1">Co-anchoring (Old)</string>
109+
110+
<string name="setting_download_title">Downloading</string>
111+
<string name="setting_download_description">%s downloading</string>
112+
<string name="setting_download_failed">Download failed</string>
113+
<string name="setting_update_dialog_title">Upgrade note</string>
114+
<string name="setting_update_dialog_content">New version detected: %s, Please upgrade!</string>
115+
<string name="setting_update_dialog_confirm">Upgrade</string>
108116
</resources>

Demo/app/src/main/res/values-zh/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
<string name="app_item_super_player">超级播放器</string>
4646
<string name="app_item_player">播放器</string>
4747
<string name="app_item_shortvideo_player">短视频播放</string>
48+
<string name="app_feed_player">Feed流播放</string>
4849

4950
<string name="app_item_video_recording">视频录制</string>
5051
<string name="app_item_effects_editor">特效编辑</string>

Demo/app/src/main/res/values/colors.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
<color name="colorGray8">#181818</color>
3636
<!--green-->
3737
<color name="colorGreen">#0accac</color>
38+
<color name="colorGreen2">#85ce57</color>
3839

3940

4041
<!--蒙版-->

Demo/app/src/main/res/values/strings.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,19 @@
112112
<string name="app_debug_switch_close">DEBUG开关已关闭</string>
113113
<string name="app_vod_player">点播播放器</string>
114114
<string name="app_rtc_player">超低延时播放</string>
115+
<string name="app_feed_player">Feed流播放</string>
115116

116117
<string name="app_item_other_tools">其他工具</string>
117118
<string name="item_live_pusher_v1">直播推流 V1</string>
118119
<string name="item_live_pusher_video_v1">视频分享 V1</string>
119120
<string name="item_live_pusher_screen_v1">屏幕分享 V1</string>
120121
<string name="item_live_player_v1">直播拉流 V1</string>
121122
<string name="item_link_mic_v1">连麦演示 V1</string>
123+
124+
<string name="setting_download_title">下载中</string>
125+
<string name="setting_download_description">%s 下载中</string>
126+
<string name="setting_download_failed">下载失败</string>
127+
<string name="setting_update_dialog_title">升级提示</string>
128+
<string name="setting_update_dialog_content">检测到当前Android 腾讯云视立方有新版本: %s, 请升级后使用!</string>
129+
<string name="setting_update_dialog_confirm">开始升级</string>
122130
</resources>

Demo/common/src/main/java/com/tencent/liteav/demo/common/UserModelManager.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,8 @@ public static UserModelManager getInstance() {
3030
}
3131

3232
public synchronized UserModel getUserModel() {
33-
if (mUserModel == null) {
34-
loadUserModel();
35-
}
33+
// 保证每次都能获取到最新的UserModel
34+
loadUserModel();
3635
return mUserModel == null ? new UserModel() : mUserModel;
3736
}
3837

0 commit comments

Comments
 (0)