From a666398b496513f1fe56a44195247c254a861656 Mon Sep 17 00:00:00 2001 From: 胡仁荣 <897853850@qq.com> Date: 星期三, 29 三月 2023 13:35:34 +0800 Subject: [PATCH] 直播 --- src/main/java/com/qxueyou/scc/stucontroller/StuLiveController.java | 42 +++++++++++++++++++++++------------------- 1 files changed, 23 insertions(+), 19 deletions(-) diff --git a/src/main/java/com/qxueyou/scc/stucontroller/StuLiveController.java b/src/main/java/com/qxueyou/scc/stucontroller/StuLiveController.java index 0e76919..7f889bc 100644 --- a/src/main/java/com/qxueyou/scc/stucontroller/StuLiveController.java +++ b/src/main/java/com/qxueyou/scc/stucontroller/StuLiveController.java @@ -1,11 +1,10 @@ package com.qxueyou.scc.stucontroller; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; +import java.util.*; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.qxueyou.scc.sdk.MTCloud; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; @@ -115,22 +114,27 @@ /** * 鏌ョ湅鐩存挱鏄庣粏 - * @param liveId 鐩存挱id + * @param couresId 鐩存挱id * @return */ @GetMapping(value = "view") - public Result view(String liveId) { - - MediaVideoLive live = liveService.read(liveId); - - return new Result(true, "success", CollectionUtils.newObjectMap( - "startTime",live.getStartTime(), - "endTime",live.getEndTime(), - "name",live.getName(), - "hlsPullUrl",live.getHlsPullUrl(), - "imgPath",live.getPreviewImgUrl(), - "chatroomId",dao.getChatRoomId(liveId), - "remark",live.getRemark() - )); + public Result view(String couresId) throws Exception { + + + MTCloud client = new MTCloud(); + + HashMap<Object,Object> options = new HashMap<Object, Object>(); + + String res = client.courseAccess(couresId, ClientUtils.getUserId(), ClientUtils.getUserName(), MTCloud.ROLE_USER, 10000, options); + + JSONObject jsonObject = JSON.parseObject(res); + + JSONObject data = jsonObject.getJSONObject("data"); + + String liveUrl = (String) data.get("liveUrl"); + + System.out.println(liveUrl); + + return new Result(true, "success",liveUrl); } } -- Gitblit v1.8.0