This commit is contained in:
lixiaopeng
2020-12-14 15:37:01 +08:00
parent feac7a579d
commit 1bbf312f1b
15 changed files with 49 additions and 42 deletions

1
.idea/gradle.xml generated
View File

@@ -84,6 +84,7 @@
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
<option name="useQualifiedModuleNames" value="true" />
</GradleProjectSettings>
</option>
</component>

View File

@@ -183,7 +183,7 @@ public class WebSocketManager implements IMogoWebSocketManager, ISocketMsgSettin
WebSocketData webSocketData = GsonUtil.objectFromJson(message, WebSocketData.class);
int msgType = webSocketData.getMsgType();
Logger.d(TAG, "websocket received msg type = " + msgType);
// Logger.d("liyz", "websocket received msg = " + message + "----type = " + msgType);
//服务端下发数据返回,上传数据回执默认不返回
if (msgType == MSG_TYPE_DOWNLINK_CAR_DATA.getMsgType()) {
List<IMogoOnWebSocketMessageListener> listeners = mListeners.get(msgType);
@@ -192,6 +192,7 @@ public class WebSocketManager implements IMogoWebSocketManager, ISocketMsgSettin
while (iterator.hasNext()) {
IMogoOnWebSocketMessageListener listener = iterator.next();
if (listener != null) {
// Logger.d("liyz", "received msgId = " + webSocketData.getSeq() + ", content = " + webSocketData.getData());
Logger.d(TAG, "received msgId = " + webSocketData.getSeq() + ", content = " + webSocketData.getData());
Object receiveObj = GsonUtil.objectFromJson(webSocketData.getData(),listener.target());
listener.onMsgReceived(receiveObj);

View File

@@ -34,7 +34,6 @@ public class EntranceProvider implements IMogoModuleProvider {
public Fragment createFragment( Context context, Bundle data ) {
mFragment = new EntranceFragment();
mFragment.setArguments( data );
Log.d("liyz", " createFragment ------> ");
ExtensionServiceManager.init(context);
return mFragment;
}
@@ -77,7 +76,6 @@ public class EntranceProvider implements IMogoModuleProvider {
@Override
public void init( Context context ) {
Log.d("liyz", " EntranceProvider init ------> ");
ExtensionServiceManager.init(context);
}

View File

@@ -28,7 +28,7 @@ import com.tencent.rtmp.ui.TXCloudVideoView;
* V2XLiveGSYVideoView
*/
public class CameraLiveGSYVideoView extends LiveRoundLayout implements IMogoSkinCompatSupportable {
private static final String TAG = "CameraLiveGSYVideoView";
private static final String TAG = "liyz";
private TXCloudVideoView mTxcVideoView;
private ProgressBar mLoading;
@@ -150,6 +150,7 @@ public class CameraLiveGSYVideoView extends LiveRoundLayout implements IMogoSkin
}
} catch (Exception e) {
e.printStackTrace();
Logger.w(TAG, "播放器onNetStatus e = " + e);
mLoading.setVisibility(GONE);
mClLoadError.setVisibility(VISIBLE);
}

View File

@@ -17,28 +17,28 @@ import com.mogo.utils.logger.Logger;
* 路边摄像头直播控制 V2XPushLiveCarScenario
*/
public class CameraLiveManager extends AbsCameraScenario<CloudRoadData> implements IMogoTopViewStatusListener {
private static final String TAG = "CameraLiveManager";
private static CameraLiveManager mCameraLiveCarScenario;
private static final String TAG = "liyz";
private static CameraLiveManager mCameraLiveManager;
private boolean isShowWindow;
private CameraLiveManager() {
}
public static CameraLiveManager getInstance() {
if (mCameraLiveCarScenario == null) {
if (mCameraLiveManager == null) {
synchronized (CameraLiveManager.class) {
if (mCameraLiveCarScenario == null) {
mCameraLiveCarScenario = new CameraLiveManager();
mCameraLiveCarScenario.setV2XWindow(new PushCameraLiveWindow());
if (mCameraLiveManager == null) {
mCameraLiveManager = new CameraLiveManager();
mCameraLiveManager.setV2XWindow(new PushCameraLiveWindow());
}
}
}
return mCameraLiveCarScenario;
return mCameraLiveManager;
}
@Override
public void init(@Nullable CloudRoadData cloudRoadData) {
Log.d(TAG, "CameraLiveManager init -----> ");
Log.d(TAG, "CameraLiveManager init -----> isShowWindow = " + isShowWindow);
if (isShowWindow) {
close();
}
@@ -54,11 +54,10 @@ public class CameraLiveManager extends AbsCameraScenario<CloudRoadData> implemen
@Override
public void showWindow() {
Log.d(TAG, "CameraLiveManager showWindow --------");
Log.d(TAG, "CameraLiveManager showWindow getV2XWindow = " + getV2XWindow());
if (getV2XWindow() != null) {
ViewGroup.LayoutParams layoutParams =
new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
(int) AbsMogoApplication.getApp().getResources()
.getDimension(R.dimen.module_video_window_height_content));
@@ -67,7 +66,6 @@ public class CameraLiveManager extends AbsCameraScenario<CloudRoadData> implemen
.addViewNoLinkage(getV2XWindow().getView(), layoutParams, this);
getV2XWindow().show(getmCloudRoadData());
isShowWindow = true;
// ExtensionServiceManager.getMoGoV2XStatusManager().setRoadLiveCarWindowShow(TAG, true);
}
}
@@ -77,7 +75,6 @@ public class CameraLiveManager extends AbsCameraScenario<CloudRoadData> implemen
getV2XWindow().close();
}
isShowWindow = false;
// ExtensionServiceManager.getMoGoV2XStatusManager().setRoadLiveCarWindowShow(TAG, false);
}
@Override

View File

@@ -77,7 +77,7 @@ public class PushCameraLiveWindow extends RelativeLayout implements ICameraWindo
Logger.w(TAG, "更新直播信息 show entity = " + entity);
if (!TextUtils.isEmpty(entity.getRtmpUrl())) {
Logger.w(TAG, "entity.getRtmpUrl() = " + entity.getRtmpUrl());
mIvReportHead.setVisibility(VISIBLE);
mIvReportHead.setVisibility(INVISIBLE);
ExtensionServiceManager.getImageLoader()
.displayImage(entity.getRtmpUrl(), mIvReportHead);
mLiveGSYVideoView.startLive(entity.getRtmpUrl());

View File

@@ -3,16 +3,12 @@ package com.mogo.module.extensions.utils;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.text.TextUtils;
import android.util.Log;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.commons.network.Utils;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.marker.IMogoMarkerClickListener;
import com.mogo.map.marker.MogoMarkerOptions;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.constants.DataTypes;
import com.mogo.module.common.entity.CloudRoadData;
import com.mogo.module.common.entity.MogoSnapshotSetData;
import com.mogo.module.extensions.R;
@@ -30,15 +26,25 @@ import com.mogo.utils.logger.Logger;
*
*/
public class CameraLiveNoticeHelper implements IMogoOnWebSocketMessageListener<MogoSnapshotSetData> {
private static final String TAG = "CameraLiveNoticeHelper";
private static final String TAG = "liyz";
private Context mContext;
private static IMogoMarker mMogoMarker;
private CloudRoadData mCloudRoadData;
public void init(Context context) {
Logger.d(TAG, "init====");
Logger.d(TAG, "init ======= ");
mContext = context;
//test
// UiThreadHandler.postDelayed( () -> {
// mCloudRoadData = new CloudRoadData();
// mCloudRoadData.setRtmpUrl("rtmp://58.200.131.2:1935/livetv/hunantv");
// mCloudRoadData.setLat(40.200353);
// mCloudRoadData.setLon(116.745467);
// CameraLiveManager.getInstance().init(mCloudRoadData);
// }, 2_000 );
ExtensionServiceManager
.getMogoRegisterCenter().registerMogoMarkerClickListener(PushDataType.TYPE_PUSH_CAMERA_DATA, new IMogoMarkerClickListener() {
@Override
@@ -70,23 +76,19 @@ public class CameraLiveNoticeHelper implements IMogoOnWebSocketMessageListener<M
* @param roadData
*/
private void addCameraMarker(CloudRoadData roadData) {
Logger.d(TAG, "addCameraMarker ------ ");
Logger.d(TAG, "addCameraMarker ------lat = " + roadData.getLat() + "--lon =" + roadData.getLon());
MogoMarkerOptions options = new MogoMarkerOptions()
.object(roadData)
.latitude(roadData.getLat())
.longitude(roadData.getLon());
options.anchor(0.5f, 0.5f);
// options.anchor(0.5f, 0.5f);
Bitmap bitmap = BitmapFactory.decodeResource(mContext.getResources(), R.drawable.module_camera_real_time_traffic, null);
options.icon(bitmap);
mMogoMarker = MogoApisHandler
.getInstance()
.getApis()
.getMapServiceApi()
.getMarkerManager(AbsMogoApplication.getApp())
mMogoMarker = ExtensionServiceManager.getMapService().getMarkerManager(mContext)
.addMarker(PushDataType.TYPE_PUSH_CAMERA_DATA, options);
//TODO
ExtensionServiceManager.getMapService().getMarkerManager(mContext).addMarker(PushDataType.TYPE_PUSH_CAMERA_DATA, options);
}
private void removeCameraMarker() {

View File

@@ -10,10 +10,9 @@
<com.mogo.module.extensions.live.CameraLiveGSYVideoView
android:id="@+id/videoPlayer"
android:layout_width="match_parent"
android:layout_height="@dimen/v2x_video_window_height_content"
android:layout_height="@dimen/module_video_window_height_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:roundLayoutRadius="@dimen/dp_30" />
@@ -32,6 +31,6 @@
app:miv_placeHolder="@drawable/icon_default_user_head"
app:miv_shape="circle"
app:miv_shapeBorderWidth="@dimen/dp_4"
tools:visibility="visible" />
tools:visibility="invisible" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -3,7 +3,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/rlRoadEventDetail"
android:layout_width="match_parent"
android:layout_height="@dimen/v2x_video_window_height_content"
android:layout_height="@dimen/module_video_window_height_content"
android:clipToPadding="false">
<include

View File

@@ -4,5 +4,6 @@
<dimen name="module_common_btn_bottom">0px</dimen>
<dimen name="module_entrance_id_button_marginLeft">-6px</dimen>
<dimen name="module_event_live_error_text_size">20px</dimen>
<dimen name="module_video_window_height_content">370px</dimen>
<dimen name="module_video_window_height_content">300px</dimen>
<dimen name="module_video_window_width_content">400px</dimen>
</resources>

View File

@@ -14,6 +14,6 @@
<dimen name="module_ext_navi_width">-1</dimen>
<dimen name="module_ext_bottom_btn_margin_bottom">0px</dimen>
<dimen name="module_event_live_error_text_size">20px</dimen>
<dimen name="module_video_window_height_content">370px</dimen>
<dimen name="module_video_window_height_content">300px</dimen>
<dimen name="module_video_window_width_content">400px</dimen>
</resources>

View File

@@ -161,5 +161,6 @@
<dimen name="module_ext_bottom_btn_margin_bottom">0px</dimen>
<dimen name="module_event_live_error_text_size">36px</dimen>
<dimen name="module_video_window_height_content">664px</dimen>
<dimen name="module_video_window_height_content">393px</dimen>
<dimen name="module_video_window_width_content">700px</dimen>
</resources>

View File

@@ -178,6 +178,7 @@
<dimen name="module_ext_navi_small_margin_right">20px</dimen>
<dimen name="module_event_live_error_text_size">36px</dimen>
<dimen name="module_video_window_height_content">664px</dimen>
<dimen name="module_video_window_height_content">393px</dimen>
<dimen name="module_video_window_width_content">700px</dimen>
</resources>

View File

@@ -238,7 +238,8 @@
<dimen name="module_ext_navi_in_vr_traffic_light_left_time_txt_size">36px</dimen>
<dimen name="module_ext_navi_in_vr_traffic_light_left_time_unit_size">21px</dimen>
<dimen name="module_ext_navi_in_vr_traffic_light_no_time_margin_top">21px</dimen>
<dimen name="module_video_window_width_content">400px</dimen>
<dimen name="module_video_window_height_content">300px</dimen>
<dimen name="module_video_window_height_content">370px</dimen>
</resources>

View File

@@ -122,6 +122,10 @@ public class MediaWindow2 implements IMusicView , IMogoStatusChangedListener {
}
if (descriptor == StatusDescriptor.VR_MODE) {
if (mWindowView == null) {
return;
}
ServiceMediaHandler.getMogoWindowManager().removeView(mWindowView);
mHasAddWindow = false;
addWindowView();