修复连麦用户端默认用小流导致画面模糊的问题
This commit is contained in:
parent
eaafcdd444
commit
7226d54277
@ -157,7 +157,7 @@ public class LiveExoPlayerManager {
|
||||
mainView.setPlayer(player1);
|
||||
status = MODEL_PLAY1;
|
||||
isSwitchUrl = false;
|
||||
if(getNextPlayer().isPlaying()){
|
||||
if (getNextPlayer().isPlaying()) {
|
||||
getNextPlayer().stop();
|
||||
}
|
||||
if (listener != null) {
|
||||
@ -186,9 +186,7 @@ public class LiveExoPlayerManager {
|
||||
public void onPlayerError(@NonNull PlaybackException error) {
|
||||
Player.Listener.super.onPlayerError(error);
|
||||
error.printStackTrace();
|
||||
String url=LiveExoPlayerManager.this.url;
|
||||
LiveExoPlayerManager.this.url=null;
|
||||
startUrl(url);
|
||||
replay();
|
||||
}
|
||||
});
|
||||
|
||||
@ -227,7 +225,7 @@ public class LiveExoPlayerManager {
|
||||
//ToastUtil.show(String.format(Locale.CHINA, "从加载到播放 = %.3f,最大耗时 = %.3f", tmp, log_buffer_max_time));
|
||||
log_buffer_time = -1;
|
||||
status = MODEL_PLAY2;
|
||||
if(getNextPlayer().isPlaying()){
|
||||
if (getNextPlayer().isPlaying()) {
|
||||
getNextPlayer().stop();
|
||||
}
|
||||
isSwitchUrl = false;
|
||||
@ -251,13 +249,12 @@ public class LiveExoPlayerManager {
|
||||
Player.Listener.super.onIsLoadingChanged(isLoading);
|
||||
Log.i(TAG, "onIsLoadingChanged: 2 " + isLoading);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerError(@NonNull PlaybackException error) {
|
||||
Player.Listener.super.onPlayerError(error);
|
||||
error.printStackTrace();
|
||||
String url=LiveExoPlayerManager.this.url;
|
||||
LiveExoPlayerManager.this.url=null;
|
||||
startUrl(url);
|
||||
replay();
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -268,7 +265,7 @@ public class LiveExoPlayerManager {
|
||||
* @param url 地址
|
||||
*/
|
||||
public void startUrl(String url) {
|
||||
if (url!=null&&url.equals(this.url)) return;
|
||||
if (url != null && url.equals(this.url)) return;
|
||||
Log.i(TAG, "startUrl: " + url + " > " + mainView.getResizeMode());
|
||||
this.url = url;
|
||||
isSwitchUrl = true;
|
||||
@ -289,7 +286,7 @@ public class LiveExoPlayerManager {
|
||||
* @param url 地址
|
||||
*/
|
||||
public void switchUrl(String url) {
|
||||
if (url!=null&&url.equals(this.url)) return;
|
||||
if (url != null && url.equals(this.url)) return;
|
||||
Log.i(TAG, "switchUrl: " + url + " src : " + this.url);
|
||||
this.url = url;
|
||||
playBufferIndex = 0;
|
||||
@ -338,9 +335,10 @@ public class LiveExoPlayerManager {
|
||||
public void play() {
|
||||
getNowPlayer().play();
|
||||
}
|
||||
public void replay(){
|
||||
String tmp=url;
|
||||
url=null;
|
||||
|
||||
public void replay() {
|
||||
String tmp = url;
|
||||
url = null;
|
||||
startUrl(tmp);
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,9 @@ import cn.rongcloud.rtc.base.RCRTCMediaType;
|
||||
import cn.rongcloud.rtc.base.RCRTCParamsType;
|
||||
import cn.rongcloud.rtc.base.RCRTCRemoteVideoFrame;
|
||||
import cn.rongcloud.rtc.base.RCRTCRoomType;
|
||||
import cn.rongcloud.rtc.base.RCRTCStreamType;
|
||||
import cn.rongcloud.rtc.base.RTCErrorCode;
|
||||
import cn.rongcloud.rtc.center.stream.RCRTCAudioInputStreamImpl;
|
||||
|
||||
public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
||||
|
||||
@ -342,7 +344,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
||||
public void switchStreamPk(boolean isPk) {
|
||||
super.switchStreamPk(isPk);
|
||||
Log.i(TAG, "switchStreamPk: isPk1" + isPk + " tmp = " + !tmpPk + " isPk2 = " + this.isPk);
|
||||
if(this.isPk&&tmpPk)return;
|
||||
if (this.isPk && tmpPk) return;
|
||||
if (isPk && !tmpPk || this.isPk) {
|
||||
mPlayer.setViewResizeMode(false);
|
||||
String url;
|
||||
@ -1031,6 +1033,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
||||
if (userinputStreamList1.size() == 0) {
|
||||
//如果远端用户发布的是视频流,创建显示视图RCRTCVideoView,并添加到布局中显示
|
||||
RCRTCVideoView remoteView = new RCRTCVideoView(contexts);
|
||||
((RCRTCVideoInputStream) stream).setStreamType(RCRTCStreamType.NORMAL);
|
||||
((RCRTCVideoInputStream) stream).setVideoView(remoteView);
|
||||
((RCRTCVideoInputStream) stream).setVideoFrameListener(new IRCRTCVideoInputFrameListener() {
|
||||
@Override
|
||||
@ -1040,7 +1043,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
||||
"timestampNs:" + videoFrame.getTimestampNs() + "\n" +
|
||||
"分辨率:" + videoFrame.getBuffer().getHeight() + "x" + videoFrame.getBuffer().getWidth() + "\n" +
|
||||
"当前时间:" + new SimpleDateFormat("HH:mm:ss", Locale.CHINA).format(new Date()) + "\n";
|
||||
System.out.println("debugText = " + debugText);
|
||||
Log.d("ry", "onFrame: " + debugText);
|
||||
new Handler(Looper.getMainLooper()).post(() -> {
|
||||
debugView.setText(debugText);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user