关播页面
This commit is contained in:
parent
c440b58981
commit
5570d29f32
@ -2,6 +2,7 @@ package com.yunbao.common.views.weight;
|
|||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.Handler;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@ -13,11 +14,14 @@ import com.lzf.easyfloat.enums.ShowPattern;
|
|||||||
import com.lzf.easyfloat.interfaces.FloatCallbacks;
|
import com.lzf.easyfloat.interfaces.FloatCallbacks;
|
||||||
import com.lzf.easyfloat.interfaces.OnInvokeView;
|
import com.lzf.easyfloat.interfaces.OnInvokeView;
|
||||||
import com.tencent.live2.V2TXLivePlayer;
|
import com.tencent.live2.V2TXLivePlayer;
|
||||||
|
import com.tencent.live2.V2TXLivePlayerObserver;
|
||||||
import com.tencent.live2.impl.V2TXLivePlayerImpl;
|
import com.tencent.live2.impl.V2TXLivePlayerImpl;
|
||||||
import com.tencent.rtmp.ui.TXCloudVideoView;
|
import com.tencent.rtmp.ui.TXCloudVideoView;
|
||||||
import com.yunbao.common.R;
|
import com.yunbao.common.R;
|
||||||
import com.yunbao.common.bean.LiveBean;
|
import com.yunbao.common.bean.LiveBean;
|
||||||
import com.yunbao.common.dialog.HintDialog;
|
import com.yunbao.common.dialog.HintDialog;
|
||||||
|
import com.yunbao.common.http.HttpCallback;
|
||||||
|
import com.yunbao.common.http.HttpClient;
|
||||||
import com.yunbao.common.manager.IMLoginManager;
|
import com.yunbao.common.manager.IMLoginManager;
|
||||||
import com.yunbao.common.utils.RouteUtil;
|
import com.yunbao.common.utils.RouteUtil;
|
||||||
import com.yunbao.common.views.floatingview.APPEasyFloat;
|
import com.yunbao.common.views.floatingview.APPEasyFloat;
|
||||||
@ -66,6 +70,20 @@ public class LiveFloatView implements Function1<FloatCallbacks.Builder, Unit> {
|
|||||||
mPlayer = new V2TXLivePlayerImpl(mContext);
|
mPlayer = new V2TXLivePlayerImpl(mContext);
|
||||||
mPlayer.setRenderView(videoView);
|
mPlayer.setRenderView(videoView);
|
||||||
mPlayer.startPlay(url);
|
mPlayer.startPlay(url);
|
||||||
|
mPlayer.setObserver(new V2TXLivePlayerObserver() {
|
||||||
|
@Override
|
||||||
|
public void onWarning(V2TXLivePlayer player, int code, String msg, Bundle extraInfo) {
|
||||||
|
super.onWarning(player, code, msg, extraInfo);
|
||||||
|
Log.e(TAG, msg + "==============" + code);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(V2TXLivePlayer player, int code, String msg, Bundle extraInfo) {
|
||||||
|
super.onError(player, code, msg, extraInfo);
|
||||||
|
Log.e(TAG, msg + "==============" + code);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
ViewClicksAntiShake.clicksAntiShake(magnetView.findViewById(R.id.btn_close), new ViewClicksAntiShake.ViewClicksCallBack() {
|
ViewClicksAntiShake.clicksAntiShake(magnetView.findViewById(R.id.btn_close), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||||
@Override
|
@Override
|
||||||
public void onViewClicks() {
|
public void onViewClicks() {
|
||||||
@ -81,14 +99,10 @@ public class LiveFloatView implements Function1<FloatCallbacks.Builder, Unit> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
ViewClicksAntiShake.clicksAntiShake(videoView, () -> {
|
ViewClicksAntiShake.clicksAntiShake(videoView, () -> {
|
||||||
if (mPlayer != null && mPlayer.isPlaying() == 1) {
|
mPlayer.stopPlay();
|
||||||
mPlayer.stopPlay();
|
APPEasyFloat.getInstance().dismiss(mContext);
|
||||||
APPEasyFloat.getInstance().dismiss(mContext);
|
new Handler().post(liveCheck);
|
||||||
} else if (mPlayer != null) {
|
|
||||||
mPlayer.stopPlay();
|
|
||||||
APPEasyFloat.getInstance().dismiss(mContext);
|
|
||||||
RouteUtil.forwardLiveAudienceActivity(mLiveBean, mLiveType, mLiveSDK, mLiveTypeVal);
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -168,6 +182,7 @@ public class LiveFloatView implements Function1<FloatCallbacks.Builder, Unit> {
|
|||||||
mPlayer = new V2TXLivePlayerImpl(mContext);
|
mPlayer = new V2TXLivePlayerImpl(mContext);
|
||||||
mPlayer.setRenderView(videoView);
|
mPlayer.setRenderView(videoView);
|
||||||
mPlayer.startPlay(url);
|
mPlayer.startPlay(url);
|
||||||
|
|
||||||
ViewClicksAntiShake.clicksAntiShake(view.findViewById(R.id.btn_close), new ViewClicksAntiShake.ViewClicksCallBack() {
|
ViewClicksAntiShake.clicksAntiShake(view.findViewById(R.id.btn_close), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||||
@Override
|
@Override
|
||||||
public void onViewClicks() {
|
public void onViewClicks() {
|
||||||
@ -183,13 +198,10 @@ public class LiveFloatView implements Function1<FloatCallbacks.Builder, Unit> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
ViewClicksAntiShake.clicksAntiShake(videoView, () -> {
|
ViewClicksAntiShake.clicksAntiShake(videoView, () -> {
|
||||||
if (mPlayer != null && mPlayer.isPlaying() == 1) {
|
|
||||||
mPlayer.stopPlay();
|
mPlayer.stopPlay();
|
||||||
EasyFloat.dismiss("LiveFloatView", true);
|
new Handler().post(liveCheck);
|
||||||
} else if (mPlayer != null) {
|
|
||||||
mPlayer.stopPlay();
|
|
||||||
RouteUtil.forwardLiveAudienceActivity(mLiveBean, mLiveType, mLiveSDK, mLiveTypeVal);
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -207,4 +219,30 @@ public class LiveFloatView implements Function1<FloatCallbacks.Builder, Unit> {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Runnable liveCheck = new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
HttpClient.getInstance().get("Live.checkLive", "")
|
||||||
|
.params("liveuid", mLiveBean.getUid())
|
||||||
|
.params("stream", mLiveBean.getStream())
|
||||||
|
.execute(new HttpCallback() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(int code, String msg, String[] info) {
|
||||||
|
if (code == 0) {
|
||||||
|
|
||||||
|
RouteUtil.forwardLiveAudienceActivity(mLiveBean, mLiveType, mLiveSDK, mLiveTypeVal);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
//判断是否有直播悬浮窗,有直接关闭
|
||||||
|
if (EasyFloat.isShow("LiveFloatView")) {
|
||||||
|
EasyFloat.dismiss("LiveFloatView", true);
|
||||||
|
} else {
|
||||||
|
APPEasyFloat.getInstance().dismiss(mContext);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user