[Change]
1、升级ZeGo直播SDK
2、修复直播拉流播放状态,
/**
* 连接失败,播放失败,都走这里,可以展示播失败信息
*
* @param errorMsg
*/
void onError(String errorMsg);
/**
* 拉流成功且处于播放中
*/
void onPlaying();
/**
* 拉流重试中,还没成功,可以做Loading
*/
void onPlaRequesting();
This commit is contained in:
@@ -19,6 +19,22 @@ public interface ITrafficCarLiveCallBack {
|
||||
|
||||
void onDisConnect();
|
||||
|
||||
/**
|
||||
* 连接失败,播放失败,都走这里,可以展示播失败信息
|
||||
*
|
||||
* @param errorMsg
|
||||
*/
|
||||
void onError(String errorMsg);
|
||||
|
||||
/**
|
||||
* 拉流成功且处于播放中
|
||||
*/
|
||||
void onPlaying();
|
||||
|
||||
/**
|
||||
* 拉流重试中,还没成功,可以做Loading
|
||||
*/
|
||||
void onPlaRequesting();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
package com.mogo.cloud.trafficlive.core;
|
||||
|
||||
import static com.mogo.cloud.live.constant.LiveConstant.LIVE_TYPE_CLOSE;
|
||||
import static com.mogo.cloud.live.constant.LiveConstant.LIVE_TYPE_OPEN;
|
||||
import static com.mogo.cloud.trafficlive.constant.TrafficLiveConstant.TAG;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.SurfaceView;
|
||||
@@ -7,7 +11,7 @@ import android.view.TextureView;
|
||||
|
||||
import com.mogo.cloud.live.listener.ILiveMultiRoomStatusListener;
|
||||
import com.mogo.cloud.live.listener.ILiveProgressListener;
|
||||
import com.mogo.cloud.live.listener.IMediaPlayerStateListener;
|
||||
import com.mogo.cloud.live.listener.ILivePullStateListener;
|
||||
import com.mogo.cloud.live.listener.IRequestLiveListener;
|
||||
import com.mogo.cloud.live.manager.MoGoLiveManager;
|
||||
import com.mogo.cloud.live.manager.MoGoLivePushConfig;
|
||||
@@ -16,10 +20,6 @@ import com.mogo.cloud.passport.MoGoAiCloudClient;
|
||||
import com.mogo.cloud.trafficlive.api.ITrafficCarLiveCallBack;
|
||||
import com.mogo.cloud.trafficlive.api.ITrafficIntersectionLiveCallBack;
|
||||
|
||||
import static com.mogo.cloud.live.constant.LiveConstant.LIVE_TYPE_CLOSE;
|
||||
import static com.mogo.cloud.live.constant.LiveConstant.LIVE_TYPE_OPEN;
|
||||
import static com.mogo.cloud.trafficlive.constant.TrafficLiveConstant.TAG;
|
||||
|
||||
public class TrafficLiveCurrentManager
|
||||
implements ILiveProgressListener, ILiveMultiRoomStatusListener {
|
||||
|
||||
@@ -142,7 +142,7 @@ public class TrafficLiveCurrentManager
|
||||
mLivePushConfig.setDevicesId(sn);
|
||||
// 登录要查看的SN房间
|
||||
MoGoLiveManager.getInstance().loginMultiRoom(liveSn);
|
||||
MoGoLiveManager.getInstance().setMediaPlayerStateListener(mediaPlayerStateListener);
|
||||
MoGoLiveManager.getInstance().addLivePullStateListener(mediaPlayerStateListener);
|
||||
// 直接 查看对应SN的直播
|
||||
MoGoLiveManager.getInstance().startLive(surfaceView);
|
||||
if (TrafficLiveCurrentManager.this.trafficLiveCallBack != null) {
|
||||
@@ -165,7 +165,7 @@ public class TrafficLiveCurrentManager
|
||||
mLivePushConfig.setDevicesId(sn);
|
||||
// 登录要查看的SN房间
|
||||
MoGoLiveManager.getInstance().loginMultiRoom(liveSn);
|
||||
MoGoLiveManager.getInstance().setMediaPlayerStateListener(mediaPlayerStateListener);
|
||||
MoGoLiveManager.getInstance().addLivePullStateListener(mediaPlayerStateListener);
|
||||
// 直接 查看对应SN的直播
|
||||
MoGoLiveManager.getInstance().startLive(textureView);
|
||||
if (TrafficLiveCurrentManager.this.trafficLiveCallBack != null) {
|
||||
@@ -271,7 +271,8 @@ public class TrafficLiveCurrentManager
|
||||
trafficLiveCallBack.onDisConnect();
|
||||
}
|
||||
}
|
||||
private IMediaPlayerStateListener mediaPlayerStateListener = new IMediaPlayerStateListener() {
|
||||
|
||||
private ILivePullStateListener mediaPlayerStateListener = new ILivePullStateListener() {
|
||||
@Override
|
||||
public void onVideoFirstFrame() {
|
||||
if (trafficLiveCallBack != null) {
|
||||
@@ -280,23 +281,30 @@ public class TrafficLiveCurrentManager
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remoteDeviceError() {
|
||||
public void onPlayerStateUpdate(int statusCode) {
|
||||
if (trafficLiveCallBack != null) {
|
||||
trafficLiveCallBack.onError("");
|
||||
switch (statusCode) {
|
||||
case 0: {
|
||||
trafficLiveCallBack.onError("onPullStreamError:");
|
||||
break;
|
||||
}
|
||||
case 1: {
|
||||
trafficLiveCallBack.onPlaRequesting();
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
trafficLiveCallBack.onPlaying();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPullStreamError(int errorCode) {
|
||||
if (trafficLiveCallBack != null) {
|
||||
trafficLiveCallBack.onError("" + errorCode);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDeviceError(int errorCode) {
|
||||
if (trafficLiveCallBack != null) {
|
||||
trafficLiveCallBack.onError("" + errorCode);
|
||||
trafficLiveCallBack.onError("onDeviceError:" + errorCode);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user