Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wecloud_im_server
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hewei
wecloud_im_server
Commits
b50bfc64
Commit
b50bfc64
authored
Oct 18, 2021
by
giaogiao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.增加接口:创建频道,并邀请客户端加入;
2.RTC相关实体类创建; 3.RTC相关工具类创建;
parent
54fb1017
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
328 additions
and
0 deletions
+328
-0
common/src/main/java/com/wecloud/im/controller/ImRtcController.java
+73
-0
common/src/main/java/com/wecloud/im/param/CreateRtcChannelResult.java
+24
-0
common/src/main/java/com/wecloud/im/param/add/CreateRtcChannelParam.java
+41
-0
common/src/main/java/com/wecloud/im/param/add/JoinRtcChannelParam.java
+22
-0
common/src/main/java/com/wecloud/rtc/entity/RtcChannelInfo.java
+19
-0
common/src/main/java/com/wecloud/rtc/entity/RtcJoinUser.java
+22
-0
common/src/main/java/com/wecloud/rtc/entity/RtcJoinUsers.java
+13
-0
common/src/main/java/com/wecloud/rtc/service/RtcService.java
+37
-0
common/src/main/java/com/wecloud/rtc/service/impl/RtcServiceImpl.java
+77
-0
No files found.
common/src/main/java/com/wecloud/im/controller/ImRtcController.java
0 → 100644
View file @
b50bfc64
package
com
.
wecloud
.
im
.
controller
;
import
com.wecloud.im.param.CreateRtcChannelResult
;
import
com.wecloud.im.param.add.CreateRtcChannelParam
;
import
com.wecloud.rtc.service.RtcService
;
import
io.geekidea.springbootplus.framework.common.api.ApiResult
;
import
io.geekidea.springbootplus.framework.common.controller.BaseController
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* 音视频通话 控制器
*
* @author wei
* @since 2021-10-18
*/
@Slf4j
@RestController
@RequestMapping
(
"/rtc"
)
@Api
(
value
=
"音视频通话"
,
tags
=
{
"音视频通话"
})
public
class
ImRtcController
extends
BaseController
{
@Autowired
private
RtcService
rtcService
;
/**
* 创建频道,并邀请客户端加入
*/
@PostMapping
(
"/createAndCall"
)
@ApiOperation
(
value
=
"创建频道,并邀请客户端加入"
,
notes
=
"创建频道,并邀请客户端加入"
)
public
ApiResult
<
CreateRtcChannelResult
>
createAndCall
(
@RequestBody
CreateRtcChannelParam
createRtcChannelParam
)
throws
Exception
{
CreateRtcChannelResult
createRtcChannelResult
=
rtcService
.
create
(
createRtcChannelParam
);
return
ApiResult
.
ok
(
createRtcChannelResult
);
}
public
ApiResult
<
Boolean
>
join
()
{
return
ApiResult
.
result
(
true
);
}
public
ApiResult
<
Boolean
>
reject
()
{
return
ApiResult
.
result
(
true
);
}
public
ApiResult
<
Boolean
>
leave
()
{
return
ApiResult
.
result
(
true
);
}
public
ApiResult
<
Boolean
>
sdpForword
()
{
return
ApiResult
.
result
(
true
);
}
public
ApiResult
<
Boolean
>
candidateForword
()
{
return
ApiResult
.
result
(
true
);
}
}
common/src/main/java/com/wecloud/im/param/CreateRtcChannelResult.java
0 → 100644
View file @
b50bfc64
package
com
.
wecloud
.
im
.
param
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* 创建频道返回参数
*
* @author wei
* @since 2021-04-29
*/
@Data
@ApiModel
(
value
=
"CreateRtcChannelResult"
)
public
class
CreateRtcChannelResult
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
@ApiModelProperty
(
"频道id"
)
private
Long
channelId
;
}
common/src/main/java/com/wecloud/im/param/add/CreateRtcChannelParam.java
0 → 100644
View file @
b50bfc64
package
com
.
wecloud
.
im
.
param
.
add
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* 创建频道请求参数
*
* @author wei
* @since 2021-04-29
*/
@Data
@ApiModel
(
value
=
"CreateRtcChannelParam"
)
public
class
CreateRtcChannelParam
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
@ApiModelProperty
(
value
=
"被邀请的客户端ID"
,
required
=
true
)
private
String
toClient
;
@ApiModelProperty
(
value
=
"客户端自定义数据"
,
required
=
false
)
private
String
attrs
;
@ApiModelProperty
(
value
=
"类型: video或voice"
,
required
=
true
)
private
String
type
;
@ApiModelProperty
(
value
=
"绑定的会话id,可选"
,
required
=
false
)
private
String
toConversation
;
@ApiModelProperty
(
value
=
"接收方展示的系统推送内容,可"
,
required
=
false
,
example
=
"{"
+
" \"title\":\"xxx正在邀请你视频通话\","
+
" \"subTitle\":\"点击接听\""
+
" }"
)
private
String
push
;
@ApiModelProperty
(
value
=
"是否需要给对方发系统通知"
,
required
=
true
)
private
Boolean
pushCall
;
}
common/src/main/java/com/wecloud/im/param/add/JoinRtcChannelParam.java
0 → 100644
View file @
b50bfc64
package
com
.
wecloud
.
im
.
param
.
add
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* 创建频道请求参数
*
* @author wei
* @since 2021-04-29
*/
@Data
@ApiModel
(
value
=
"CreateRtcChannelParam"
)
public
class
JoinRtcChannelParam
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
@ApiModelProperty
(
"频道id"
)
private
Long
channelId
;
}
common/src/main/java/com/wecloud/rtc/entity/RtcChannelInfo.java
0 → 100644
View file @
b50bfc64
package
com
.
wecloud
.
rtc
.
entity
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* rtc 频道信息
*/
@Data
public
class
RtcChannelInfo
implements
Serializable
{
@ApiModelProperty
(
"当前房主"
)
String
owner
;
@ApiModelProperty
(
"创建时间"
)
Long
createTimestamp
;
}
common/src/main/java/com/wecloud/rtc/entity/RtcJoinUser.java
0 → 100644
View file @
b50bfc64
package
com
.
wecloud
.
rtc
.
entity
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* rtc 频道内的用户
*/
@Data
public
class
RtcJoinUser
implements
Serializable
{
@ApiModelProperty
(
"客户端"
)
String
clientId
;
@ApiModelProperty
(
"加入时间"
)
Long
createTimestamp
;
String
sdp
;
}
common/src/main/java/com/wecloud/rtc/entity/RtcJoinUsers.java
0 → 100644
View file @
b50bfc64
package
com
.
wecloud
.
rtc
.
entity
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* rtc 频道内所有用户
*/
@Data
public
class
RtcJoinUsers
implements
Serializable
{
}
common/src/main/java/com/wecloud/rtc/service/RtcService.java
0 → 100644
View file @
b50bfc64
package
com
.
wecloud
.
rtc
.
service
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
com.wecloud.im.param.CreateRtcChannelResult
;
import
com.wecloud.im.param.add.CreateRtcChannelParam
;
/**
* 管理rtc频道
*/
public
interface
RtcService
{
/**
* 创建一个频道
*/
CreateRtcChannelResult
create
(
CreateRtcChannelParam
createRtcChannelParam
)
throws
JsonProcessingException
;
/**
* 加入频道
*/
void
join
();
/**
* 拒接加入频道
*/
void
reject
();
/**
* 退出频道
*/
void
leave
();
void
sdpForword
();
void
candidateForword
();
}
common/src/main/java/com/wecloud/rtc/service/impl/RtcServiceImpl.java
0 → 100644
View file @
b50bfc64
package
com
.
wecloud
.
rtc
.
service
.
impl
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
com.wecloud.im.entity.ImApplication
;
import
com.wecloud.im.entity.ImClient
;
import
com.wecloud.im.param.CreateRtcChannelResult
;
import
com.wecloud.im.param.add.CreateRtcChannelParam
;
import
com.wecloud.im.service.ImApplicationService
;
import
com.wecloud.im.service.ImClientService
;
import
com.wecloud.rtc.service.MangerRtcCacheService
;
import
com.wecloud.rtc.service.RtcService
;
import
io.geekidea.springbootplus.framework.shiro.util.SnowflakeUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
@Service
public
class
RtcServiceImpl
implements
RtcService
{
@Autowired
private
ImApplicationService
imApplicationService
;
/**
* redis缓存
*/
@Autowired
private
MangerRtcCacheService
mangerRtcCacheService
;
@Autowired
private
ImClientService
imClientService
;
@Override
public
CreateRtcChannelResult
create
(
CreateRtcChannelParam
createRtcChannelParam
)
throws
JsonProcessingException
{
ImClient
client
=
imClientService
.
getCurentClient
();
Long
rtcChannelId
=
SnowflakeUtil
.
getId
();
// 根据appKey查询appid
ImApplication
imApplication
=
imApplicationService
.
getById
(
client
.
getFkAppid
());
mangerRtcCacheService
.
create
(
imApplication
.
getAppKey
(),
client
.
getClientId
(),
rtcChannelId
);
CreateRtcChannelResult
createRtcChannelResult
=
new
CreateRtcChannelResult
();
createRtcChannelResult
.
setChannelId
(
rtcChannelId
);
// 像对方发送邀请
return
createRtcChannelResult
;
}
@Override
public
void
join
()
{
}
@Override
public
void
reject
()
{
}
@Override
public
void
leave
()
{
}
@Override
public
void
sdpForword
()
{
}
@Override
public
void
candidateForword
()
{
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment