Skip to content

Commit

Permalink
Fix bug, update sdk.
Browse files Browse the repository at this point in the history
  • Loading branch information
garyxgwang committed Dec 7, 2021
1 parent 46c201d commit 2af6e5d
Show file tree
Hide file tree
Showing 63 changed files with 3,600 additions and 519 deletions.
2 changes: 1 addition & 1 deletion Demo/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 24
versionName "9.3.1169"
versionName "9.4.0.1218"

multiDexEnabled true
ndk {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@

import androidx.multidex.MultiDexApplication;

import com.tencent.rtmp.TXLiveBase;
import com.tencent.rtmp.TXLiveBaseListener;

import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
Expand All @@ -19,10 +16,6 @@ public class DemoApplication extends MultiDexApplication {
// private RefWatcher mRefWatcher;
private static DemoApplication instance;

// 如何获取License? 请参考官网指引 https://cloud.tencent.com/document/product/454/34750
String licenceUrl = "请替换成您的licenseUrl";
String licenseKey = "请替换成您的licenseKey";

private Context mAppContext;
@Override
public void onCreate() {
Expand All @@ -32,19 +25,6 @@ public void onCreate() {
mAppContext = this.getApplicationContext();
instance = this;


TXLiveBase.getInstance().setLicence(instance, licenceUrl, licenseKey);
TXLiveBase.setListener(new TXLiveBaseListener() {
@Override
public void onUpdateNetworkTime(int errCode, String errMsg) {
if (errCode != 0) {
TXLiveBase.updateNetworkTime();
}
}
});
TXLiveBase.updateNetworkTime();

// 短视频licence设置
StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder();
StrictMode.setVmPolicy(builder.build());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import androidx.recyclerview.widget.RecyclerView;

import com.tencent.liteav.demo.common.widget.expandableadapter.BaseExpandableRecyclerViewAdapter;
import com.tencent.liteav.demo.player.demo.FeedActivity;
import com.tencent.liteav.demo.player.demo.SuperPlayerActivity;
import com.tencent.liteav.demo.player.demo.shortvideo.view.ShortVideoActivity;
import com.tencent.rtmp.TXLiveBase;
Expand Down Expand Up @@ -50,10 +51,11 @@ protected void onCreate(Bundle savedInstanceState) {
return;
}

TXCSDKService.init(getApplicationContext());
setContentView(R.layout.activity_main);

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

mMainTitle = (TextView) findViewById(R.id.main_title);
mMainTitle.setOnLongClickListener(new View.OnLongClickListener() {
Expand Down Expand Up @@ -139,6 +141,7 @@ private List<GroupBean> initGroupData() {
List<ChildBean> playerChildList = new ArrayList<>();
playerChildList.add(new ChildBean(getString(R.string.app_item_super_player), R.drawable.play, 3, SuperPlayerActivity.class));
playerChildList.add(new ChildBean(getString(R.string.app_item_shortvideo_player), R.drawable.play, 3, ShortVideoActivity.class));
playerChildList.add(new ChildBean(getString(R.string.app_feed_player), R.drawable.play, 3, FeedActivity.class));
if (playerChildList.size() != 0) {
GroupBean playerGroupBean = new GroupBean(getString(R.string.app_item_player), R.drawable.composite, playerChildList);
groupList.add(playerGroupBean);
Expand Down
38 changes: 38 additions & 0 deletions Demo/app/src/main/java/com/tencent/liteav/demo/TXCSDKService.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package com.tencent.liteav.demo;

import android.content.Context;

import com.tencent.rtmp.TXLiveBase;
import com.tencent.rtmp.TXLiveBaseListener;

public class TXCSDKService {
private static final String TAG = "TXCSDKService";
// 如何获取License? 请参考官网指引 https://cloud.tencent.com/document/product/454/34750
private static final String licenceUrl =
"请替换成您的licenseUrl";
private static final String licenseKey = "请替换成您的licenseKey";

private TXCSDKService() {
}

/**
* 初始化腾讯云相关sdk。
* SDK 初始化过程中可能会读取手机型号等敏感信息,需要在用户同意隐私政策后,才能获取。
*
* @param appContext The application context.
*/
public static void init(Context appContext) {
TXLiveBase.getInstance().setLicence(appContext, licenceUrl, licenseKey);
TXLiveBase.setListener(new TXLiveBaseListener() {
@Override
public void onUpdateNetworkTime(int errCode, String errMsg) {
if (errCode != 0) {
TXLiveBase.updateNetworkTime();
}
}
});
TXLiveBase.updateNetworkTime();

// 短视频licence设置
}
}
19 changes: 19 additions & 0 deletions Demo/app/src/main/res/drawable/app_update_dialog_background.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!-- rectangle表示为矩形 -->

<!-- 填充的颜色 -->
<solid android:color="@color/main_item_unselected_color" />

<!-- 边框的颜色和粗细 -->
<stroke
android:width="1dp"
android:color="@color/white"
/>

<!-- android:radius 圆角的半径 -->
<corners
android:radius="2dp"
/>

</shape>
8 changes: 8 additions & 0 deletions Demo/app/src/main/res/values-en/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@

<string name="app_item_super_player">Superplayer</string>
<string name="app_item_shortvideo_player">Short Video Player</string>
<string name="app_feed_player">Feed stream play</string>
<string name="app_item_player">Player</string>

<string name="app_item_video_recording">Shooting</string>
Expand Down Expand Up @@ -105,4 +106,11 @@
<string name="item_live_pusher_screen_v1">Screen Share V1</string>
<string name="item_live_player_v1">Pull V1</string>
<string name="item_link_mic_v1">Co-anchoring (Old)</string>

<string name="setting_download_title">Downloading</string>
<string name="setting_download_description">%s downloading</string>
<string name="setting_download_failed">Download failed</string>
<string name="setting_update_dialog_title">Upgrade note</string>
<string name="setting_update_dialog_content">New version detected: %s, Please upgrade!</string>
<string name="setting_update_dialog_confirm">Upgrade</string>
</resources>
1 change: 1 addition & 0 deletions Demo/app/src/main/res/values-zh/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
<string name="app_item_super_player">超级播放器</string>
<string name="app_item_player">播放器</string>
<string name="app_item_shortvideo_player">短视频播放</string>
<string name="app_feed_player">Feed流播放</string>

<string name="app_item_video_recording">视频录制</string>
<string name="app_item_effects_editor">特效编辑</string>
Expand Down
1 change: 1 addition & 0 deletions Demo/app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
<color name="colorGray8">#181818</color>
<!--green-->
<color name="colorGreen">#0accac</color>
<color name="colorGreen2">#85ce57</color>


<!--蒙版-->
Expand Down
8 changes: 8 additions & 0 deletions Demo/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,19 @@
<string name="app_debug_switch_close">DEBUG开关已关闭</string>
<string name="app_vod_player">点播播放器</string>
<string name="app_rtc_player">超低延时播放</string>
<string name="app_feed_player">Feed流播放</string>

<string name="app_item_other_tools">其他工具</string>
<string name="item_live_pusher_v1">直播推流 V1</string>
<string name="item_live_pusher_video_v1">视频分享 V1</string>
<string name="item_live_pusher_screen_v1">屏幕分享 V1</string>
<string name="item_live_player_v1">直播拉流 V1</string>
<string name="item_link_mic_v1">连麦演示 V1</string>

<string name="setting_download_title">下载中</string>
<string name="setting_download_description">%s 下载中</string>
<string name="setting_download_failed">下载失败</string>
<string name="setting_update_dialog_title">升级提示</string>
<string name="setting_update_dialog_content">检测到当前Android 腾讯云视立方有新版本: %s, 请升级后使用!</string>
<string name="setting_update_dialog_confirm">开始升级</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@ public static UserModelManager getInstance() {
}

public synchronized UserModel getUserModel() {
if (mUserModel == null) {
loadUserModel();
}
// 保证每次都能获取到最新的UserModel
loadUserModel();
return mUserModel == null ? new UserModel() : mUserModel;
}

Expand Down
6 changes: 5 additions & 1 deletion Demo/superplayerdemo/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,14 @@ dependencies {
compile 'me.dm7.barcodescanner:zxing:1.8.4'
compile 'com.squareup.okhttp3:okhttp:3.11.0'
compile 'androidx.multidex:multidex:2.0.0'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.github.bumptech.glide:glide:4.12.0'
compile 'androidx.cardview:cardview:1.0.0'
compile 'com.google.code.gson:gson:2.3.1'
compile('com.blankj:utilcode:1.25.9', {
exclude group: 'com.google.code.gson', module: 'gson'
})

implementation 'com.scwang.smart:refresh-layout-kernel:2.0.3' //核心必须依赖
implementation 'com.scwang.smart:refresh-header-classics:2.0.3' //经典刷新头
implementation 'com.scwang.smart:refresh-footer-classics:2.0.3' //经典加载
}
6 changes: 6 additions & 0 deletions Demo/superplayerdemo/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@
android:screenOrientation="portrait" />

<activity android:name=".demo.VodPlayerActivity"/>
<activity android:name=".demo.FeedActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:launchMode="singleTask"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden"
/>

<receiver android:name=".expand.webdata.reveiver.WebDataReceiver">
<intent-filter>
Expand Down
Loading

0 comments on commit 2af6e5d

Please sign in to comment.