Commit b18dc714 authored by yangshihao's avatar yangshihao
Browse files

LIVE-31494【Android】升级云课堂SDK到0.15.2

parent 1e0936b8
package com.easefun.polyvsdk.cloudclass;
import com.easefun.polyv.cloudclass.config.PolyvLiveSDKClient;
import com.easefun.polyv.cloudclassdemo.PolyvCloudClassApp;
import com.easefun.polyv.foundationsdk.utils.PolyvAppUtils;
import com.polyv.rn.PolyvCloudClassRNPackage;
......@@ -45,7 +46,7 @@ public class MainApplication extends PolyvCloudClassApp implements ReactApplicat
@Override
public void onCreate() {
PolyvAppUtils.init(this);
PolyvLiveSDKClient.getInstance().initContext(this);
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
}
......
......@@ -10,8 +10,10 @@ import com.easefun.polyv.businesssdk.model.chat.PolyvChatDomain;
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.PolyvLiveSDKClient;
import com.easefun.polyv.cloudclass.config.PolyvVClassGlobalConfig;
import com.easefun.polyv.cloudclass.model.PolyvLiveClassDetailVO;
import com.easefun.polyv.cloudclass.model.PolyvLiveStatusVO;
import com.easefun.polyv.cloudclass.net.PolyvApiManager;
import com.easefun.polyv.cloudclassdemo.watch.PolyvCloudClassHomeActivity;
......@@ -32,6 +34,7 @@ import com.facebook.react.bridge.WritableMap;
import java.io.IOException;
import io.reactivex.disposables.Disposable;
import io.reactivex.functions.Consumer;
import retrofit2.adapter.rxjava2.HttpException;
import static com.polyv.rn.PolyvErrorCode.channleLoadFailed;
......@@ -44,7 +47,10 @@ import static com.polyv.rn.PolyvErrorCode.channleLoadFailed;
public class PolyvCloudClassRNModule extends ReactContextBaseJavaModule {
private static final String TAG = "PolyvRNCloudClassLoginModule";
private ProgressDialog progress;
private Disposable getTokenDisposable, verifyDispose;
private Disposable getTokenDisposable, verifyDispose, liveDetailDisposable;
//是否是参与者
private boolean isParticipant = false;
public PolyvCloudClassRNModule(ReactApplicationContext reactContext) {
super(reactContext);
......@@ -250,9 +256,23 @@ public class PolyvCloudClassRNModule extends ReactContextBaseJavaModule {
String[] dataArr = data.split(",");
boolean isAlone = "alone".equals(dataArr[1]);//是否有ppt
sendSuccessMessage(promise);
startActivityForLive(userId, channelId, isAlone);
progress.dismiss();
requestLiveDetail(channelId, promise, new Consumer<String>() {
@Override
public void accept(String rtcType) throws Exception {
progress.dismiss();
if (isParticipant) {
if ("urtc".equals(rtcType) || TextUtils.isEmpty(rtcType)) {
ToastUtils.showShort("暂不支持该频道观看");
return;
}
}
sendSuccessMessage(promise);
startActivityForLive(userId, channelId, isAlone, rtcType);
progress.dismiss();
}
});
}
@Override
......@@ -269,20 +289,43 @@ public class PolyvCloudClassRNModule extends ReactContextBaseJavaModule {
});
}
private void requestLiveDetail(String channelId,Promise promise, final Consumer<String> onSuccess) {
if (liveDetailDisposable != null) {
liveDetailDisposable.dispose();
}
liveDetailDisposable = PolyvResponseExcutor.excuteUndefinData(PolyvChatApiRequestHelper.getInstance()
.requestLiveClassDetailApi(channelId), new PolyvrResponseCallback<PolyvLiveClassDetailVO>() {
@Override
public void onSuccess(PolyvLiveClassDetailVO polyvLiveClassDetailVO) {
try {
onSuccess.accept(polyvLiveClassDetailVO.getData().getRtcType());
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void onError(Throwable e) {
super.onError(e);
errorStatus(e, promise);
}
});
}
private String getTrim(String playbackUserId) {
return playbackUserId.trim();
}
// <editor-fold defaultstate="collapsed" desc="startActivity">
private void startActivityForLive(String userId, String channelId, boolean isAlone) {
PolyvCloudClassHomeActivity.startActivityForLive(getCurrentActivity(),
getTrim(channelId), userId, isAlone);
private void startActivityForLive(String userId, String channelId, boolean isAlone, String rtcType) {
PolyvCloudClassHomeActivity.startActivityForLiveWithParticipant(getCurrentActivity(),
getTrim(channelId), userId, isAlone, isParticipant, rtcType);
}
private void startActivityForPlayback(String playbackVideoId,String playbackChannelId,String playbackUserId, boolean isNormalLivePlayBack) {
progress.dismiss();
PolyvCloudClassHomeActivity.startActivityForPlayBack(getCurrentActivity(),
getTrim(playbackVideoId), getTrim(playbackChannelId), getTrim(playbackUserId), isNormalLivePlayBack);
getTrim(playbackVideoId), getTrim(playbackChannelId), getTrim(playbackUserId), isNormalLivePlayBack,0);
}
// </editor-fold>
}
......@@ -14,10 +14,10 @@ import com.easefun.polyv.foundationsdk.log.PolyvCommonLog;
public class PolyvInitManager {
public static void init(String vodKey, String decodeKey, String decodeIv, Context context){
// Normal app init code...
PolyvCommonLog.setDebug(true);
PolyvLiveSDKClient liveSDKClient = PolyvLiveSDKClient.getInstance();
liveSDKClient.initContext(null);
liveSDKClient.enableHttpDns(false);
PolyvVodSDKClient client = PolyvVodSDKClient.getInstance();
//使用SDK加密串来配置
......
......@@ -36,9 +36,9 @@ allprojects {
}
ext {
supportLibVersion = "27.1.1"
compileSdkVersion = 27
minSdkVersion = 16
targetSdkVersion = 27
versionCode = 80
versionName = "0.8.0"
compileSdkVersion = 29
minSdkVersion = 21
targetSdkVersion = 29
versionCode = 152
versionName = "0.15.2"
}
......@@ -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.8.0'
api 'com.easefun.polyv:polyvSDKCloudClass:0.15.2'
//glide
api ('jp.wasabeef:glide-transformations:3.3.0'){
// exclude group:'com.github.bumptech.glide',module:'glide'
......
......@@ -96,6 +96,11 @@ public abstract class PolyvCommonMediacontroller<T extends PolyvCommonVideoView>
*/
public abstract void changePPTVideoLocation();
/**
* @return ppt是否显示在副屏
*/
public boolean isShowPPTSubView(){return showPPTSubView;}
@Override
public void setMediaPlayer(T player) {
......
......@@ -9,7 +9,6 @@ import android.view.View;
import android.view.ViewGroup;
import android.view.animation.LinearInterpolator;
import com.easefun.polyv.thirdpart.blankj.utilcode.util.ScreenUtils;
import com.easefun.polyv.businesssdk.api.auxiliary.PolyvAuxiliaryVideoview;
import com.easefun.polyv.businesssdk.api.common.player.PolyvBaseVideoView;
import com.easefun.polyv.businesssdk.api.common.player.microplayer.PolyvCommonVideoView;
......@@ -24,8 +23,8 @@ import com.easefun.polyv.commonui.widget.PolyvTouchContainerView;
import com.easefun.polyv.foundationsdk.config.PolyvPlayOption;
import com.easefun.polyv.foundationsdk.log.PolyvCommonLog;
import com.easefun.polyv.foundationsdk.permission.PolyvPermissionManager;
import com.easefun.polyv.foundationsdk.utils.PolyvControlUtils;
import com.easefun.polyv.foundationsdk.utils.PolyvScreenUtils;
import com.easefun.polyv.thirdpart.blankj.utilcode.util.ScreenUtils;
/**
* @author df
......@@ -49,7 +48,7 @@ public abstract class PolyvCommonVideoHelper<T extends IPolyvVideoItem<P, Q>, P
protected PolyvAuxiliaryVideoview subVideoview;
protected Q controller;
protected View loadingView, noStreamView, audioModeView,screenShotView;
protected static int videoViewVolume;
// protected static int videoViewVolume;
protected static final Handler S_HANDLER;
protected PolyvPermissionManager permissionManager;
......@@ -148,7 +147,7 @@ public abstract class PolyvCommonVideoHelper<T extends IPolyvVideoItem<P, Q>, P
//true:ppt在主屏,false:ppt在副屏
public void changeView(boolean changeToVideoView) {
if(pptContianer == null || pptView == null){
if (pptContianer == null || pptView == null || videoView == null) {
return;
}
PolyvCommonLog.d(TAG,"show ppt sub:"+changeToVideoView);
......@@ -262,14 +261,14 @@ public abstract class PolyvCommonVideoHelper<T extends IPolyvVideoItem<P, Q>, P
}
public void initVolume(){
this.videoViewVolume = videoView.getVolume();
// this.videoViewVolume = videoView.getVolume();
}
public void restartPlay() {
if (playOption == null) {
return;
}
openVideoViewSound();
// openVideoViewSound();
startPlay(playOption);
}
......@@ -281,8 +280,9 @@ public abstract class PolyvCommonVideoHelper<T extends IPolyvVideoItem<P, Q>, P
}
protected void openVideoViewSound() {
if(videoView != null && videoViewVolume >0){
videoView.setVolume(videoViewVolume);
if(videoView != null/* && videoViewVolume >0*/ && videoView.getIjkMediaPlayer() != null){
// videoView.setVolume(videoViewVolume);
videoView.getIjkMediaPlayer().setVolume(1, 1);
}
}
......@@ -314,9 +314,9 @@ public abstract class PolyvCommonVideoHelper<T extends IPolyvVideoItem<P, Q>, P
public void destory() {
PolyvCommonLog.d(TAG, "destroy helper video");
if(videoViewVolume >0){
PolyvControlUtils.setVolume(context, videoViewVolume);
}
// if(videoViewVolume >0){
// PolyvControlUtils.setVolume(context, videoViewVolume);
// }
videoView.destroy();
controller.destroy();
......
package com.easefun.polyv.commonui.adapter.viewholder;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.support.annotation.IdRes;
import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.PopupWindow;
import android.widget.ProgressBar;
import com.easefun.polyv.thirdpart.blankj.utilcode.util.ConvertUtils;
......@@ -19,10 +25,13 @@ import com.easefun.polyv.commonui.adapter.itemview.IPolyvCustomMessageBaseItemVi
import com.easefun.polyv.commonui.utils.imageloader.IPolyvProgressListener;
import com.easefun.polyv.commonui.utils.imageloader.PolyvImageLoader;
import com.easefun.polyv.foundationsdk.log.PolyvCommonLog;
import com.easefun.polyv.thirdpart.blankj.utilcode.util.ToastUtils;
import java.util.ArrayList;
import java.util.List;
import static com.easefun.polyv.foundationsdk.utils.PolyvScreenUtils.dip2px;
/**
* @author df
* @create 2019/1/16
......@@ -205,5 +214,55 @@ public abstract class ClickableViewHolder<M, Q extends PolyvBaseRecyclerViewAdap
}
}
}
protected void processItemLongClick(View anchor,boolean isLeft,String copyContent){
createPopupWindow(context,anchor,isLeft,copyContent);
}
/**
* 复制内容到剪切板
*
* @param copyStr
* @return
*/
private boolean copy(String copyStr) {
try {
//获取剪贴板管理器
ClipboardManager cm = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
// 创建普通字符型ClipData
ClipData mClipData = ClipData.newPlainText("Label", copyStr);
// 将ClipData内容放到系统剪贴板里。
cm.setPrimaryClip(mClipData);
ToastUtils.showLong("复制成功");
return true;
} catch (Exception e) {
return false;
}
}
public PopupWindow createPopupWindow(Context context, View anchor, boolean isLeft, final String copyContent) {
// 自定义的布局View
final PopupWindow popupWindow = new PopupWindow();
View view = LayoutInflater.from(context)
.inflate(R.layout.polyv_popup_item_active, null, false);
view.findViewById(R.id.long_press_copy).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
copy(copyContent);
popupWindow.dismiss();
}
});
popupWindow.setContentView(view);
popupWindow.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
popupWindow.setWidth(dip2px(context, 96));
popupWindow.setBackgroundDrawable(new ColorDrawable()); // 需要设置一个背景setOutsideTouchable(true)才会生效
popupWindow.setFocusable(true); // 防止点击事件穿透
popupWindow.setOutsideTouchable(true); // 设置点击外部时取消
int[] location = new int[2];
anchor.getLocationOnScreen(location);
popupWindow.showAtLocation(anchor, Gravity.TOP | Gravity.START,
location[0]+ (isLeft?anchor.getMeasuredWidth()/2:-anchor.getMeasuredWidth()/2), (int) (location[1]-anchor.getHeight()*0.7));
return popupWindow;
}
// </editor-fold>
}
......@@ -49,6 +49,21 @@ public class PolyvBaseActivity extends AppCompatActivity implements PolyvPermiss
.setCancelable(false)
.show();
}
public static boolean showReloginTip(final Activity activity, String channelId, String... message) {
new AlertDialog.Builder(activity)
.setTitle("温馨提示")
.setMessage(message != null && message.length > 0 ? message[0] : "您未被授权观看本直播!")
.setPositiveButton("确定", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
activity.finish();
}
})
.setCancelable(false)
.show();
return true;
}
// </editor-fold>
// <editor-fold defaultstate="collapsed" desc="处理异常启动时的相关方法">
......
package com.easefun.polyv.commonui.player;
import tv.danmaku.ijk.media.player.IMediaPlayer;
import com.easefun.polyv.businesssdk.api.common.player.IPolyvBaseVideoView;
/**
* 视频信息类型
*/
public class PolyvMediaInfoType {
public static final int MEDIA_INFO_UNKNOWN = IMediaPlayer.MEDIA_INFO_UNKNOWN;
public static final int MEDIA_INFO_STARTED_AS_NEXT = IMediaPlayer.MEDIA_INFO_STARTED_AS_NEXT;
public static final int MEDIA_INFO_VIDEO_RENDERING_START = IMediaPlayer.MEDIA_INFO_VIDEO_RENDERING_START;
public static final int MEDIA_INFO_VIDEO_TRACK_LAGGING = IMediaPlayer.MEDIA_INFO_VIDEO_TRACK_LAGGING;
public static final int MEDIA_INFO_UNKNOWN = IPolyvBaseVideoView.MEDIA_INFO_UNKNOWN;
public static final int MEDIA_INFO_STARTED_AS_NEXT = IPolyvBaseVideoView.MEDIA_INFO_STARTED_AS_NEXT;
public static final int MEDIA_INFO_VIDEO_RENDERING_START = IPolyvBaseVideoView.MEDIA_INFO_VIDEO_RENDERING_START;
public static final int MEDIA_INFO_VIDEO_TRACK_LAGGING = IPolyvBaseVideoView.MEDIA_INFO_VIDEO_TRACK_LAGGING;
/**
* 缓冲开始
*/
public static final int MEDIA_INFO_BUFFERING_START = IMediaPlayer.MEDIA_INFO_BUFFERING_START;
public static final int MEDIA_INFO_BUFFERING_START = IPolyvBaseVideoView.MEDIA_INFO_BUFFERING_START;
/**
* 缓冲结束
*/
public static final int MEDIA_INFO_BUFFERING_END = IMediaPlayer.MEDIA_INFO_BUFFERING_END;
public static final int MEDIA_INFO_NETWORK_BANDWIDTH = IMediaPlayer.MEDIA_INFO_NETWORK_BANDWIDTH;
public static final int MEDIA_INFO_BAD_INTERLEAVING = IMediaPlayer.MEDIA_INFO_BAD_INTERLEAVING;
public static final int MEDIA_INFO_NOT_SEEKABLE = IMediaPlayer.MEDIA_INFO_NOT_SEEKABLE;
public static final int MEDIA_INFO_METADATA_UPDATE = IMediaPlayer.MEDIA_INFO_METADATA_UPDATE;
public static final int MEDIA_INFO_TIMED_TEXT_ERROR = IMediaPlayer.MEDIA_INFO_TIMED_TEXT_ERROR;
public static final int MEDIA_INFO_UNSUPPORTED_SUBTITLE = IMediaPlayer.MEDIA_INFO_UNSUPPORTED_SUBTITLE;
public static final int MEDIA_INFO_SUBTITLE_TIMED_OUT = IMediaPlayer.MEDIA_INFO_SUBTITLE_TIMED_OUT;
public static final int MEDIA_INFO_BUFFERING_END = IPolyvBaseVideoView.MEDIA_INFO_BUFFERING_END;
public static final int MEDIA_INFO_NETWORK_BANDWIDTH = IPolyvBaseVideoView.MEDIA_INFO_NETWORK_BANDWIDTH;
public static final int MEDIA_INFO_BAD_INTERLEAVING = IPolyvBaseVideoView.MEDIA_INFO_BAD_INTERLEAVING;
public static final int MEDIA_INFO_NOT_SEEKABLE = IPolyvBaseVideoView.MEDIA_INFO_NOT_SEEKABLE;
public static final int MEDIA_INFO_METADATA_UPDATE = IPolyvBaseVideoView.MEDIA_INFO_METADATA_UPDATE;
public static final int MEDIA_INFO_TIMED_TEXT_ERROR = IPolyvBaseVideoView.MEDIA_INFO_TIMED_TEXT_ERROR;
public static final int MEDIA_INFO_UNSUPPORTED_SUBTITLE = IPolyvBaseVideoView.MEDIA_INFO_UNSUPPORTED_SUBTITLE;
public static final int MEDIA_INFO_SUBTITLE_TIMED_OUT = IPolyvBaseVideoView.MEDIA_INFO_SUBTITLE_TIMED_OUT;
public static final int MEDIA_INFO_VIDEO_ROTATION_CHANGED = IMediaPlayer.MEDIA_INFO_VIDEO_ROTATION_CHANGED;
public static final int MEDIA_INFO_AUDIO_RENDERING_START = IMediaPlayer.MEDIA_INFO_AUDIO_RENDERING_START;
public static final int MEDIA_INFO_VIDEO_ROTATION_CHANGED = IPolyvBaseVideoView.MEDIA_INFO_VIDEO_ROTATION_CHANGED;
public static final int MEDIA_INFO_AUDIO_RENDERING_START = IPolyvBaseVideoView.MEDIA_INFO_AUDIO_RENDERING_START;
}
......@@ -15,7 +15,6 @@ import com.easefun.polyv.commonui.player.widget.PolyvVodVideoItem;
import com.easefun.polyv.foundationsdk.log.PolyvCommonLog;
import com.github.lzyzsd.jsbridge.CallBackFunction;
import tv.danmaku.ijk.media.player.IjkMediaPlayer;
public class PolyvVodVideoHelper extends PolyvCommonVideoHelper<PolyvVodVideoItem,
PolyvVodVideoView,PolyvVodMediaController>{
......@@ -64,6 +63,15 @@ public class PolyvVodVideoHelper extends PolyvCommonVideoHelper<PolyvVodVideoIte
public void pptPrepare() {
pptView.setLoadingViewVisible(View.INVISIBLE);
}
@Override
public void pptPositionChange(boolean isVideoInMain) {
if(!controller.isShowPPTSubView() && isVideoInMain) {
controller.changePPTVideoLocation();
} else if(controller.isShowPPTSubView() && !isVideoInMain){
controller.changePPTVideoLocation();
}
}
});
}
}
......@@ -138,7 +146,6 @@ public class PolyvVodVideoHelper extends PolyvCommonVideoHelper<PolyvVodVideoIte
videoView.enterBackground();
else
videoView.pause();
IjkMediaPlayer.native_profileEnd();
}
}
......@@ -8,7 +8,6 @@ import android.widget.FrameLayout;
import android.widget.ImageView;
import com.easefun.polyv.businesssdk.api.common.ppt.IPolyvPPTView;
import com.easefun.polyv.businesssdk.api.common.ppt.PolyvPPTVodProcessor;
import com.easefun.polyv.businesssdk.api.common.ppt.PolyvPPTWebView;
import com.easefun.polyv.businesssdk.model.ppt.PolyvPPTAuthentic;
import com.easefun.polyv.businesssdk.web.IPolyvWebMessageProcessor;
......@@ -16,15 +15,11 @@ import com.easefun.polyv.cloudclass.model.PolyvSocketMessageVO;
import com.easefun.polyv.commonui.R;
import com.easefun.polyv.foundationsdk.log.PolyvCommonLog;
import com.easefun.polyv.foundationsdk.rx.PolyvRxBus;
import com.easefun.polyv.foundationsdk.rx.PolyvRxTimer;
import com.easefun.polyv.foundationsdk.utils.PolyvGsonUtil;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.disposables.Disposable;
import io.reactivex.functions.Consumer;
import static com.easefun.polyv.businesssdk.api.common.ppt.PolyvCloudClassPPTProcessor.AUTHORIZATION_PPT_PAINT;
import static com.easefun.polyv.businesssdk.api.common.ppt.PolyvCloudClassPPTProcessor.PPT_PAINT_STATUS;
import static com.easefun.polyv.cloudclass.PolyvSocketEvent.ONSLICECONTROL;
import static com.easefun.polyv.cloudclass.PolyvSocketEvent.ONSLICEDRAW;
import static com.easefun.polyv.cloudclass.PolyvSocketEvent.ONSLICEID;
......@@ -43,7 +38,7 @@ public class PolyvPPTView extends FrameLayout implements IPolyvPPTView {
protected PolyvPPTWebView polyvPPTWebView;
protected ImageView pptLoadingView;
private Disposable socketDispose;
private CompositeDisposable delayDisposes = new CompositeDisposable();
// private CompositeDisposable delayDisposes = new CompositeDisposable();
public PolyvPPTView(Context context) {
this(context, null);
......@@ -104,13 +99,20 @@ public class PolyvPPTView extends FrameLayout implements IPolyvPPTView {
ONSLICEOPEN.equals(event) || ONSLICEID.equals(event)) {
PolyvCommonLog.d(TAG, "receive ppt message:"+event);
hideLoading();
delayDisposes.add(PolyvRxTimer.delay(delayTime, new Consumer<Long>() {
@Override
public void accept(Long aLong) throws Exception {
PolyvCommonLog.d(TAG, "receive ppt message: delay"+delayTime);
sendWebMessage(polyvSocketMessageVO.getMessage());
}
}));
// delayDisposes.add(PolyvRxTimer.delay(delayTime, new Consumer<Long>() {
// @Override
// public void accept(Long aLong) throws Exception {
PolyvCommonLog.d(TAG, "receive ppt message: delay"+polyvSocketMessageVO.getMessage());
String message = polyvSocketMessageVO.getMessage();
if(delayTime >0){
int lastPos = message.lastIndexOf("}");
message = message.substring(0,lastPos)+",\"delayTime\":"+delayTime+"}";
}
PolyvCommonLog.d(TAG, "receive ppt message: delay"+message);
sendWebMessage(message);
// }
// }));
}
}
......@@ -157,10 +159,10 @@ public class PolyvPPTView extends FrameLayout implements IPolyvPPTView {
socketDispose = null;
}
if (delayDisposes != null) {
delayDisposes.dispose();
delayDisposes = null;
}
// if (delayDisposes != null) {
// delayDisposes.dispose();
// delayDisposes = null;
// }
}
@Override
......
......@@ -21,8 +21,6 @@ import com.easefun.polyv.commonui.R;
import java.util.Locale;
import tv.danmaku.ijk.media.player.IjkMediaPlayer;
public class PolyvLoadingLayout extends FrameLayout {
private ProgressBar loadingProgress;
private TextView loadingSpeed;
......@@ -35,15 +33,15 @@ public class PolyvLoadingLayout extends FrameLayout {
if (msg.what == 1) {
if (videoView instanceof PolyvCloudClassVideoView ||
(videoView instanceof PolyvPlaybackVideoView && ((PolyvPlaybackVideoView) videoView).getPlayType() == PolyvPlayType.ONLINE_PLAY)) {
IjkMediaPlayer mp = videoView.getIjkMediaPlayer();
if (mp != null) {
long tcpSpeed = mp.getTcpSpeed();
long tcpSpeed = videoView.getTcpSpeed();
if (tcpSpeed >= 0) {
loadingSpeed.setVisibility(View.VISIBLE);
loadingSpeed.setText(formatedSpeed(tcpSpeed, 1000));
handler.sendEmptyMessageDelayed(1, 500);
}