Commit bddc79c8 authored by yangshihao's avatar yangshihao
Browse files

LIVE-31494【Android】升级云课堂SDK到0.16.1,同步插件版本到0.2.4

parent 8d0916df
......@@ -11,6 +11,7 @@ import com.easefun.polyv.businesssdk.model.video.PolyvPlayBackVO;
import com.easefun.polyv.businesssdk.service.PolyvLoginManager;
import com.easefun.polyv.businesssdk.vodplayer.PolyvVodSDKClient;
import com.easefun.polyv.cloudclass.chat.PolyvChatApiRequestHelper;
import com.easefun.polyv.cloudclass.config.PolyvLiveChannelType;
import com.easefun.polyv.cloudclass.config.PolyvLiveSDKClient;
import com.easefun.polyv.cloudclass.config.PolyvVClassGlobalConfig;
import com.easefun.polyv.cloudclass.model.PolyvLiveClassDetailVO;
......@@ -210,8 +211,18 @@ public class PolyvCloudClassRNModule extends ReactContextBaseJavaModule {
@Override
public void onSuccess(PolyvPlayBackVO playBack) {
sendSuccessMessage(promise);
boolean isLivePlayBack = playBack.getLiveType() == 0;
startActivityForPlayback(vid,channelId,userId, isLivePlayBack);
switch (playBack.getLiveType()) {
case 0:
startActivityForPlayback(vid,channelId,userId, true);
break;
case 1:
startActivityForPlayback(vid,channelId,userId, false);
break;
default:
ToastUtils.showShort("只支持云课堂类型频道或普通直播类型频道");
break;
}
}
@Override
......@@ -252,10 +263,21 @@ public class PolyvCloudClassRNModule extends ReactContextBaseJavaModule {
, new PolyvrResponseCallback<PolyvLiveStatusVO>() {
@Override
public void onSuccess(PolyvLiveStatusVO statusVO) {
String data = statusVO.getData();
String[] dataArr = data.split(",");
boolean isAlone = "alone".equals(dataArr[1]);//是否有ppt
PolyvLiveChannelType channelType = null;
try {
channelType = PolyvLiveChannelType.mapFromServerString(statusVO.getChannelType());
} catch (PolyvLiveChannelType.UnknownChannelTypeException e) {
progress.dismiss();
ToastUtils.showShort("未知的频道类型");
e.printStackTrace();
return;
}
if (channelType != PolyvLiveChannelType.CLOUD_CLASS && channelType != PolyvLiveChannelType.NORMAL) {
progress.dismiss();
ToastUtils.showShort("只支持云课堂类型频道或普通直播类型频道");
return;
}
final boolean isAlone = channelType == PolyvLiveChannelType.NORMAL;//是否有ppt
requestLiveDetail(channelId, promise, new Consumer<String>() {
@Override
......
......@@ -39,6 +39,6 @@ ext {
compileSdkVersion = 29
minSdkVersion = 21
targetSdkVersion = 29
versionCode = 152
versionName = "0.15.2"
versionCode = 161
versionName = "0.16.1"
}
......@@ -33,7 +33,7 @@ dependencies {
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
api 'com.android.support:design:27.1.1'
api 'com.easefun.polyv:polyvSDKCloudClass:0.15.2'
api 'com.easefun.polyv:polyvSDKCloudClass:0.16.1'
//glide
api ('jp.wasabeef:glide-transformations:3.3.0'){
// exclude group:'com.github.bumptech.glide',module:'glide'
......
......@@ -59,15 +59,35 @@ public class PolyvPPTView extends FrameLayout implements IPolyvPPTView {
View.inflate(context, R.layout.polyv_ppt_webview_layout, this);
polyvPPTWebView = findViewById(R.id.polyv_ppt_web);
pptLoadingView = findViewById(R.id.polyv_ppt_default_icon);
initialPPTViewStyle();
setDefaultTextZoom();
loadWeb();
}
/**
* 设置PPT加载时的默认样式,应在{@link PolyvPPTWebView#loadWeb()}前调用
*/
private void initialPPTViewStyle() {
// 设置ppt加载时中间占位图图片地址
polyvPPTWebView.setPptBackgroundImg("https://player.polyv.net/resp/ppt-h5/latest/images/ppt-back-dark.png");
// 设置占位图图片宽度,应带单位px或者以百分号表示
polyvPPTWebView.setPptBackgroundImgWidth("12%");
// 设置ppt加载时背景图片颜色,不能使用#FFFFFF或者0xFFFFFF表示
polyvPPTWebView.setPptBackgroundColor("rgb(57,56,66)");
}
@Override
public void addWebProcessor(IPolyvWebMessageProcessor processor) {
processor.bindWebView(polyvPPTWebView);
polyvPPTWebView.registerProcessor(processor);
}
private void setDefaultTextZoom() {
// 用户设置了手机显示的字体大小后,如字体过大可能导致PPT文字显示不全
// 这里强制设置字体为标准的缩放大小
polyvPPTWebView.getSettings().setTextZoom(100);
}
private void loadWeb() {
polyvPPTWebView.loadWeb();//"file:///android_asset/startForMobile.html"
registerSocketMessage();
......
......@@ -14,6 +14,7 @@ import android.text.TextUtils;
import android.util.Log;
import com.easefun.polyv.foundationsdk.log.PolyvCommonLog;
import com.easefun.polyv.foundationsdk.utils.PolyvFormatUtils;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
......@@ -148,7 +149,7 @@ public class PolyvUriPathHelper {
else if (isDownloadsDocument(uri)) {
final String id = DocumentsContract.getDocumentId(uri);
final Uri contentUri = ContentUris.withAppendedId(Uri.parse("content://downloads/public_downloads"),
Long.valueOf(id));
PolyvFormatUtils.parseLong(id));
return getDataColumn(context, contentUri, null, null);
}
// MediaProvider
......
......@@ -29,6 +29,8 @@ public class PolyvTouchContainerView extends FrameLayout {
private int originLeft,portraitLeft = 0;
private int originTop,portraitTop = 0;
private boolean isSetPortraitParam = false;
//键盘弹起前得位置
private int beforeSoftLeft = 0;
private int beforeSoftTop = 0;
......@@ -127,12 +129,14 @@ public class PolyvTouchContainerView extends FrameLayout {
return;
}
PolyvCommonLog.d(TAG,"left ;"+layoutParams.leftMargin+" width :"+getMeasuredWidth()+" width :"+ScreenUtils.getScreenWidth());
portraitLeft = layoutParams.leftMargin;
portraitTop = layoutParams.topMargin;
Log.d(TAG, "resetFloatViewLand: portraitLeft :" + portraitLeft + " portraitTop :"
+ portraitTop+ " width :" + getMeasuredWidth());
if (!isSetPortraitParam) {
portraitLeft = layoutParams.leftMargin;
portraitTop = layoutParams.topMargin;
isSetPortraitParam = true;
Log.d(TAG, "resetFloatViewLand: portraitLeft :" + portraitLeft + " portraitTop :"
+ portraitTop+ " width :" + getMeasuredWidth());
}
layoutParams.leftMargin = 0;
layoutParams.topMargin = 0;
setLayoutParams(layoutParams);
......
......@@ -10,6 +10,8 @@ import android.graphics.Paint;
import android.graphics.PointF;
import android.util.Log;
import com.easefun.polyv.foundationsdk.utils.PolyvFormatUtils;
import java.lang.ref.WeakReference;
import java.util.Random;
......@@ -56,7 +58,7 @@ public class BadgeAnimator extends ValueAnimator {
for (int i = 0; i < mFragments.length; i++) {
for (int j = 0; j < mFragments[i].length; j++) {
BitmapFragment bf = mFragments[i][j];
float value = Float.parseFloat(getAnimatedValue().toString());
float value = PolyvFormatUtils.parseFloat(getAnimatedValue().toString());
bf.updata(value, canvas);
}
}
......
......@@ -17,14 +17,14 @@
android:id="@+id/plv_v_top_transparent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@id/plv_v_point_reward_top" />
android:layout_above="@+id/plv_v_point_reward_top" />
<!-- top-->
<View
android:id="@+id/plv_v_point_reward_top"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_above="@id/plv_v_point_reward_middle"
android:layout_above="@+id/plv_v_point_reward_middle"
android:background="#CF3F4E" />
<ImageView
......@@ -57,7 +57,7 @@
android:id="@+id/plv_v_point_reward_middle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@id/plv_v_point_reward_bottom"
android:layout_above="@+id/plv_v_point_reward_bottom"
android:background="@drawable/plv_gradient_point_reward_bg"
android:orientation="vertical">
......
......@@ -21,7 +21,7 @@
android:layout_centerVertical="true"
android:layout_marginLeft="6dp"
android:layout_marginRight="6dp"
android:layout_toLeftOf="@id/right_layout"
android:layout_toLeftOf="@+id/right_layout"
android:layout_toRightOf="@id/plv_iv_show_point_reward"
android:background="@drawable/polyv_et_chat_corner"
android:hint="在这里可以跟老师互动哦"
......
......@@ -59,7 +59,7 @@
android:id="@+id/sb_playprogress"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toStartOf="@id/pb_ppt_video_switch"
android:layout_toStartOf="@+id/pb_ppt_video_switch"
android:layout_toEndOf="@id/tv_totaltime"
android:paddingStart="5dp"
android:paddingEnd="5dp"
......
......@@ -299,6 +299,9 @@ public class PolyvReceiveMessageHolder extends ClickableViewHolder<Object, Polyv
//设置不同用户类型的字体颜色
int fontColor;
if (userType==null) {
userType="";
}
switch (userType) {
case USERTYPE_TEACHER:
fontColor = PolyvChatUIConfig.FontColor.color_teacher;
......
......@@ -56,7 +56,7 @@ public class PolyvLiveInfoFragment extends Fragment {
TextView tv_status;
//状态变量
private int viewerCount = 0;
private long viewerCount = 0;
//直播属性
private int channelId;
......@@ -248,7 +248,7 @@ public class PolyvLiveInfoFragment extends Fragment {
// </editor-fold>
// <editor-fold defaultstate="collapsed" desc="刷新View">
private void refreshViewerTv(int viewerCount) {
private void refreshViewerTv(long viewerCount) {
String viewerCountText;
if (viewerCount > 10000) {
viewerCountText = String.format(Locale.CHINA, "%.1f", (double) viewerCount / 10000) + "w";
......
......@@ -17,6 +17,7 @@ import com.easefun.polyv.cloudclassdemo.R;
import com.easefun.polyv.cloudclassdemo.watch.linkMic.widget.PolyvLinkMicListView;
import com.easefun.polyv.foundationsdk.log.PolyvCommonLog;
import com.easefun.polyv.foundationsdk.rx.PolyvRxTimer;
import com.easefun.polyv.foundationsdk.utils.PolyvFormatUtils;
import com.easefun.polyv.linkmic.PolyvLinkMicWrapper;
import com.plv.rtc.PLVARTCConstants;
......@@ -145,7 +146,7 @@ public class PolyvLinkMicAdapter extends RecyclerView.Adapter<PolyvLinkMicAdapte
PolyvCommonLog.d(TAG, "cameraOpen:" + cameraOpen);
surfaceView.setVisibility(cameraOpen ? View.VISIBLE : View.INVISIBLE);
}
long longUid = Long.valueOf(uid);
long longUid = PolyvFormatUtils.parseLong(uid);
if (uid == myUid) {
PolyvLinkMicWrapper.getInstance().setupLocalVideo(surfaceView,
PLVARTCConstants.RENDER_MODE_HIDDEN, (int) longUid);
......
......@@ -21,6 +21,7 @@ import com.easefun.polyv.cloudclass.chat.event.PolyvSendCupEvent;
import com.easefun.polyv.cloudclassdemo.R;
import com.easefun.polyv.foundationsdk.log.PolyvCommonLog;
import com.easefun.polyv.foundationsdk.utils.PolyvAppUtils;
import com.easefun.polyv.foundationsdk.utils.PolyvFormatUtils;
import com.easefun.polyv.foundationsdk.utils.PolyvScreenUtils;
import com.easefun.polyv.linkmic.PolyvLinkMicWrapper;
import com.easefun.polyv.thirdpart.blankj.utilcode.util.ScreenUtils;
......@@ -256,7 +257,7 @@ public class PolyvLinkMicDataBinder extends IPolyvDataBinder{
}
}
long longUid = Long.valueOf(uid);
long longUid = PolyvFormatUtils.parseLong(uid);
if (uid.equals(myUid)) {
PolyvLinkMicWrapper.getInstance().setupLocalVideo(surfaceView,
PLVARTCConstants.RENDER_MODE_FIT, (int) longUid);
......
......@@ -21,6 +21,7 @@ import com.easefun.polyv.commonui.utils.imageloader.PolyvImageLoader;
import com.easefun.polyv.foundationsdk.log.PolyvCommonLog;
import com.easefun.polyv.foundationsdk.rx.PolyvRxTimer;
import com.easefun.polyv.foundationsdk.utils.PolyvAppUtils;
import com.easefun.polyv.foundationsdk.utils.PolyvFormatUtils;
import com.easefun.polyv.foundationsdk.utils.PolyvScreenUtils;
import com.easefun.polyv.linkmic.PolyvLinkMicWrapper;
import com.plv.rtc.PLVARTCAudioVolumeInfo;
......@@ -207,7 +208,7 @@ public class PolyvNormalLiveLinkMicDataBinder extends IPolyvDataBinder {
holder.soundRoundView.setVisibility(View.VISIBLE);
PolyvCommonLog.d(TAG, "cameraOpen:" + cameraOpen);
}
long longUid = Long.valueOf(uid);
long longUid = PolyvFormatUtils.parseLong(uid);
if (uid.equals(myUid)) {
PolyvLinkMicWrapper.getInstance().setupLocalVideo(surfaceView,
PLVARTCConstants.RENDER_MODE_FIT, (int) longUid);
......
......@@ -461,6 +461,10 @@ public class PolyvCloudClassMediaController extends PolyvCommonMediacontroller<P
if (!showPPT) {//如果不显示ppt 不触发此功能
return;
}
changePPTVideoLocationUncheckPPT();
}
public void changePPTVideoLocationUncheckPPT() {
if (polyvCloudClassPlayerHelper != null) {
if (!polyvCloudClassPlayerHelper.changePPTViewToVideoView(showPPTSubView)) {
return;
......
......@@ -56,6 +56,7 @@ import com.easefun.polyv.foundationsdk.permission.PolyvPermissionManager;
import com.easefun.polyv.foundationsdk.rx.PolyvRxBus;
import com.easefun.polyv.foundationsdk.rx.PolyvRxTimer;
import com.easefun.polyv.foundationsdk.utils.PolyvAppUtils;
import com.easefun.polyv.foundationsdk.utils.PolyvFormatUtils;
import com.easefun.polyv.foundationsdk.utils.PolyvGsonUtil;
import com.easefun.polyv.foundationsdk.utils.PolyvScreenUtils;
import com.easefun.polyv.linkmic.PolyvLinkMicAGEventHandler;
......@@ -67,6 +68,8 @@ import com.easefun.polyv.thirdpart.blankj.utilcode.util.LogUtils;
import com.easefun.polyv.thirdpart.blankj.utilcode.util.ScreenUtils;
import com.easefun.polyv.thirdpart.blankj.utilcode.util.ToastUtils;
import com.easefun.polyv.thirdpart.blankj.utilcode.util.Utils;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.plv.rtc.PLVARTCAudioVolumeInfo;
import com.plv.rtc.PLVARTCConstants;
......@@ -89,7 +92,6 @@ import static com.easefun.polyv.businesssdk.api.common.ppt.PolyvCloudClassPPTPro
import static com.easefun.polyv.businesssdk.api.common.ppt.PolyvCloudClassPPTProcessor.CHAT_LOGIN;
import static com.easefun.polyv.businesssdk.api.common.ppt.PolyvCloudClassPPTProcessor.ERASE_STATUS;
import static com.easefun.polyv.businesssdk.api.common.ppt.PolyvCloudClassPPTProcessor.PPT_PAINT_STATUS;
import static com.easefun.polyv.businesssdk.api.common.ppt.PolyvCloudClassPPTProcessor.SETSEIDATA;
import static com.easefun.polyv.businesssdk.model.ppt.PolyvPPTAuthentic.PermissionType.VOICE;
import static com.easefun.polyv.businesssdk.sp.PolyvPreConstant.LINK_MIC_TOKEN;
import static com.easefun.polyv.cloudclass.PolyvSocketEvent.ONSLICECONTROL;
......@@ -897,6 +899,30 @@ public class PolyvCloudClassVideoHelper extends PolyvCommonVideoHelper<PolyvClou
public void onDestroy() {
}
});
// 进入直播间时 主副屏跟随讲师端显示
PolyvChatManager.getInstance().addNewMessageListener(new PolyvNewMessageListener() {
@Override
public void onNewMessage(String message, String event) {
if (ONSLICEID.equals(event)) {
PolyvChatManager.getInstance().removeNewMessageListener(this);
JsonObject jsonObject = new JsonParser().parse(message).getAsJsonObject();
// pptAndVideoPosition 0表示讲师端目前ppt在主屏 1表示讲师端目前播放器在主屏
int pptAndVideoPosition = jsonObject.get("pptAndVedioPosition").getAsInt();
// 跟随讲师端主副屏位置
boolean needToChangePptVideoPosition = pptAndVideoPosition == 0 ^ pptShowMainScreen();
if (needToChangePptVideoPosition) {
controller.changePPTVideoLocationUncheckPPT();
}
}
}
@Override
public void onDestroy() {
}
});
}
private void processLeaveMessage(String userId) {
......@@ -1317,7 +1343,7 @@ public class PolyvCloudClassVideoHelper extends PolyvCommonVideoHelper<PolyvClou
try {
if (show) {
PolyvLinkMicWrapper.getInstance().setupRemoteVideo(surfaceView,
PLVARTCConstants.RENDER_MODE_FIT, Integer.valueOf(teacherId));
PLVARTCConstants.RENDER_MODE_FIT, PolyvFormatUtils.parseInt(teacherId));
}
} catch (Exception e) {
PolyvCommonLog.exception(e);
......@@ -1521,7 +1547,7 @@ public class PolyvCloudClassVideoHelper extends PolyvCommonVideoHelper<PolyvClou
private void joinLinkByParticipant() {
initSupportRTC();
if(!TextUtils.isEmpty(PolyvVClassGlobalConfig.viewerId)){
PolyvLinkMicWrapper.getInstance().getEngineConfig().mUid = Integer.valueOf(PolyvVClassGlobalConfig.viewerId);
PolyvLinkMicWrapper.getInstance().getEngineConfig().mUid = PolyvFormatUtils.parseInt(PolyvVClassGlobalConfig.viewerId);
}
createLinkMicLayout(linkMicLayout, true);
......
......@@ -50,6 +50,7 @@ import com.easefun.polyv.commonui.utils.imageloader.PolyvImageLoader;
import com.easefun.polyv.foundationsdk.log.PolyvCommonLog;
import com.easefun.polyv.foundationsdk.rx.PolyvRxBus;
import com.easefun.polyv.foundationsdk.utils.PolyvControlUtils;
import com.easefun.polyv.foundationsdk.utils.PolyvFormatUtils;
import com.easefun.polyv.foundationsdk.utils.PolyvGsonUtil;
import com.easefun.polyv.foundationsdk.utils.PolyvScreenUtils;
import com.easefun.polyv.linkmic.PolyvLinkMicWrapper;
......@@ -511,7 +512,7 @@ public class PolyvCloudClassVideoItem extends FrameLayout
polyvCloudClassVideoView.setOnSEIRefreshListener(new IPolyvVideoViewListenerEvent.OnSEIRefreshListener() {
@Override
public void onSEIRefresh(int seiType, byte[] seiData) {
long ts = Long.valueOf(new String(seiData));
long ts = PolyvFormatUtils.parseLong(new String(seiData));
PolyvCommonLog.d(TAG, "sei ts :" + ts);
if (polyvPPTItem != null) {
polyvPPTItem.getPPTView().sendWebMessage(SETSEIDATA, "{\"time\":" + ts + "}");
......
......@@ -19,7 +19,7 @@
</com.easefun.polyv.cloudclassdemo.watch.linkMic.widget.PolyvLinkMicBottomView>
<com.easefun.polyv.cloudclassdemo.watch.linkMic.widget.PolyvNormalLinkMicView
android:layout_toRightOf="@id/link_mic_fixed_position"
android:layout_toRightOf="@+id/link_mic_fixed_position"
android:id="@+id/link_mic_layout_parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
......
......@@ -37,7 +37,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignTop="@id/plv_v_point_reward_effect_bg_1"
android:layout_alignRight="@id/plv_iv_point_reward_effect_1"
android:layout_alignRight="@+id/plv_iv_point_reward_effect_1"
android:layout_marginLeft="13dp"
android:layout_marginTop="7dp"
android:layout_marginRight="56dp"
......@@ -130,7 +130,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@id/plv_v_point_reward_effect_bg_2"
android:layout_alignRight="@id/plv_iv_point_reward_effect_2"
android:layout_alignRight="@+id/plv_iv_point_reward_effect_2"
android:layout_marginLeft="13dp"
android:layout_marginTop="7dp"
android:layout_marginRight="56dp"
......
......@@ -54,7 +54,7 @@
android:layout_alignParentBottom="true"
android:layout_gravity="center_vertical"
android:layout_marginRight="10dp"
android:layout_toLeftOf="@id/video_screen_switch_port"
android:layout_toLeftOf="@+id/video_screen_switch_port"
android:src="@drawable/polyv_ppt_sub_selector" />
<ImageView
......
......@@ -84,6 +84,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:singleLine="true"
android:drawableLeft="@drawable/polyv_icon_praise"
android:drawablePadding="6dp"
android:text="12"
......@@ -100,6 +101,7 @@
android:id="@+id/tv_viewer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:drawableLeft="@drawable/polyv_icon_viewer"
android:drawablePadding="6dp"
android:text="12"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment