Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
李勇
/
McuClient
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
李勇
8 years ago
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
56e0398845c01942fd8df5d14e6e60ef926551e3
56e03988
1 parent
2b2e8d06
1.增加设置老师、监课、学生视图的接口,根据身份分别显示不同的视图
隐藏空白字符变更
内嵌
并排对比
正在显示
2 个修改的文件
包含
74 行增加
和
28 行删除
src/EngineEntrance.js
src/apes/WebRtcApe.js
src/EngineEntrance.js
查看文件 @
56e0398
...
...
@@ -62,7 +62,7 @@ export default class MessageEntrance extends Emiter {
constructor
()
{
super
();
//sdk 信息
GlobalConfig
.
sdkVersion
=
"v2.4.
2
.20170908"
;
GlobalConfig
.
sdkVersion
=
"v2.4.
4
.20170908"
;
loger
.
warn
(
"sdkVersion:"
+
GlobalConfig
.
sdkVersion
);
//设置
...
...
@@ -285,9 +285,11 @@ export default class MessageEntrance extends Emiter {
this
.
publishMedia
=
this
.
_publishMedia
.
bind
(
this
);
this
.
unpublishMedia
=
this
.
_unpublishMedia
.
bind
(
this
);
this
.
changeDevices
=
this
.
_changeDevices
.
bind
(
this
);
this
.
setLocalMediaView
=
this
.
_setLocalMediaView
.
bind
(
this
);
this
.
setRemoteMediaView
=
this
.
_setRemoteMediaView
.
bind
(
this
);
this
.
setInvisibleMediaView
=
this
.
_setInvisibleMediaView
.
bind
(
this
);
this
.
setLocalMediaView
=
this
.
_setLocalMediaView
.
bind
(
this
);
//设置自己的视图
this
.
setHostRemoteMediaView
=
this
.
_setHostRemoteMediaView
.
bind
(
this
);
//设置远程老师的视图
this
.
setNormalRemoteMediaView
=
this
.
_setNormalRemoteMediaView
.
bind
(
this
);
//设置远程学生的视图
this
.
setInvisibleMediaView
=
this
.
_setInvisibleMediaView
.
bind
(
this
);
//设置监课身份的视图
this
.
setAppConfig
=
this
.
_setAppConfig
.
bind
(
this
);
this
.
recordControl
=
this
.
_recordControl
.
bind
(
this
);
...
...
@@ -2867,16 +2869,29 @@ export default class MessageEntrance extends Emiter {
}
}
/*
* 设置房间内
其他人
的视图
* 设置房间内
老师身份
的视图
* */
_setRemoteMediaView
(
_params
){
_set
Host
RemoteMediaView
(
_params
){
if
(
GlobalConfig
.
deviceType
==
1
||
GlobalConfig
.
deviceType
==
2
){
return
;
}
if
(
_webRtc
){
_webRtc
.
set
Remote
View
(
_params
);
_webRtc
.
set
HostRemoteMedia
View
(
_params
);
}
}
/*
* 设置房间内普通身份的视图
* */
_setNormalRemoteMediaView
(
_params
){
if
(
GlobalConfig
.
deviceType
==
1
||
GlobalConfig
.
deviceType
==
2
){
return
;
}
if
(
_webRtc
){
_webRtc
.
setNormalRemoteMediaView
(
_params
);
}
}
/*
* 设置监课和需要隐藏显示的用户视图
* */
...
...
src/apes/WebRtcApe.js
查看文件 @
56e0398
...
...
@@ -36,21 +36,25 @@ class WebRtcApe extends Emiter {
this
.
isPublish
=
false
;
//当前是否正在推流
this
.
localVideoWidth
=
320
;
this
.
localVideoHeight
=
240
;
this
.
remoteVideoWidth
=
320
;
this
.
remoteVideoHeight
=
240
;
this
.
normalRemoteViewId
=
""
;
this
.
normalRemoteStyle
=
""
;
this
.
normalRemoteVideoWidth
=
320
;
this
.
normalRemoteVideoHeight
=
240
;
this
.
localViewId
=
""
;
this
.
localStyle
=
""
;
this
.
localVideoWidth
=
320
;
this
.
localVideoHeight
=
240
;
this
.
remoteViewId
=
""
;
this
.
remoteStyle
=
""
;
this
.
hostRemoteViewId
=
""
;
this
.
hostRemoteStyle
=
""
;
this
.
hostRemoteVideoWidth
=
320
;
this
.
hostRemoteVideoHeight
=
240
;
this
.
invisibleViewId
=
""
;
this
.
invisibleStyle
=
""
;
this
.
invisibleVideoWidth
=
320
;
this
.
invisibleVideoHeight
=
240
;
this
.
xdyRemote
=
"xdy_remote"
;
//webRtc sdk
this
.
client
=
AgoraRTC
.
createClient
({
mode
:
this
.
mode
});
...
...
@@ -117,15 +121,29 @@ class WebRtcApe extends Emiter {
this
.
client
.
on
(
'stream-subscribed'
,
(
evt
)
=>
{
let
stream
=
evt
.
stream
;
if
(
stream
){
loger
.
log
(
"获取远程视频流成功: "
+
stream
.
getId
(),
new
Date
().
getTime
());
let
viewDiv
=
`
<
div
id
=
"${this.xdyRemote + stream.getId()}"
style
=
"width:${this.remoteVideoWidth}px;height:${this.remoteVideoHeight}px;"
><
/div>`
;
//let viewDiv=`<div id="${this.xdyRemote + stream.getId()}" style="width:${this.hostRemoteVideoWidth}px;height:${this.hostRemoteVideoHeight}px;"></div>`;
if
(
GlobalConfig
.
getUserRoleFromeNodeId
(
stream
.
getId
())
==
ApeConsts
.
invisible
){
//显示隐藏用户
//把远程视频添加到监课列表
loger
.
log
(
"获取远程视频流成功->监课:"
+
stream
.
getId
(),
new
Date
().
getTime
());
let
viewDiv
=
`
<
div
id
=
"${this.xdyRemote + stream.getId()}"
style
=
"width:${this.invisibleVideoWidth}px;height:${this.invisibleVideoHeight}px;"
><
/div>`
;
$
(
this
.
invisibleViewId
).
append
(
viewDiv
);
}
else
if
(
GlobalConfig
.
getUserRoleFromeNodeId
(
stream
.
getId
())
==
ApeConsts
.
host
){
//把远程视图添加到老师列表
loger
.
log
(
"获取远程视频流成功->老师:"
+
stream
.
getId
(),
new
Date
().
getTime
());
let
viewDiv
=
`
<
div
id
=
"${this.xdyRemote + stream.getId()}"
style
=
"width:${this.hostRemoteVideoWidth}px;height:${this.hostRemoteVideoHeight}px;"
><
/div>`
;
$
(
this
.
hostRemoteViewId
).
append
(
viewDiv
);
}
else
{
$
(
this
.
remoteViewId
).
append
(
viewDiv
);
//把视图添加到学生列表
loger
.
log
(
"获取远程视频流成功->学生:"
+
stream
.
getId
(),
new
Date
().
getTime
());
let
viewDiv
=
`
<
div
id
=
"${this.xdyRemote + stream.getId()}"
style
=
"width:${this.normalRemoteVideoWidth}px;height:${this.normalRemoteVideoHeight}px;"
><
/div>`
;
$
(
this
.
normalRemoteViewId
).
append
(
viewDiv
);
}
//播放视频
try
{
stream
.
play
(
this
.
xdyRemote
+
stream
.
getId
());
}
catch
(
err
){
}
stream
.
play
(
this
.
xdyRemote
+
stream
.
getId
());
}
});
...
...
@@ -293,7 +311,7 @@ class WebRtcApe extends Emiter {
* 设置本地回显视图
* */
setLoaclView
(
_params
)
{
loger
.
log
(
"设置本地回显视图"
);
loger
.
log
(
"设置
自己
本地回显视图"
);
this
.
localViewId
=
_params
.
divId
||
""
;
this
.
localStyle
=
_params
.
styleStr
||
""
;
this
.
localVideoWidth
=
parseInt
(
_params
.
width
)
||
320
;
...
...
@@ -303,21 +321,34 @@ class WebRtcApe extends Emiter {
/*
* 设置其他人的video视图容器
* */
setRemoteView
(
_params
)
{
loger
.
log
(
"设置其他人的video视图容器"
);
this
.
remoteViewId
=
_params
.
divId
||
""
;
this
.
remoteStyle
=
_params
.
styleStr
||
""
;
this
.
remoteVideoWidth
=
parseInt
(
_params
.
width
)
||
320
;
this
.
remoteVideoHeight
=
parseInt
(
_params
.
height
)
||
240
;
setHostRemoteMediaView
(
_params
)
{
loger
.
log
(
"设置老师视图容器"
);
this
.
hostRemoteViewId
=
_params
.
divId
||
""
;
this
.
hostRemoteStyle
=
_params
.
styleStr
||
""
;
this
.
hostRemoteVideoWidth
=
parseInt
(
_params
.
width
)
||
320
;
this
.
hostRemoteVideoHeight
=
parseInt
(
_params
.
height
)
||
240
;
}
/*
* 设置其他人的video视图容器
* */
setNormalRemoteMediaView
(
_params
)
{
loger
.
log
(
"设置学生视图容器"
);
this
.
normalRemoteViewId
=
_params
.
divId
||
""
;
this
.
normalRemoteStyle
=
_params
.
styleStr
||
""
;
this
.
normalRemoteVideoWidth
=
parseInt
(
_params
.
width
)
||
320
;
this
.
normalRemoteVideoHeight
=
parseInt
(
_params
.
height
)
||
240
;
}
/*
* 设置隐藏用户的video视图容器
* */
setInvisibleMediaView
(
_params
)
{
loger
.
log
(
"设置
隐藏用户的video
视图容器"
);
loger
.
log
(
"设置
监课
视图容器"
);
this
.
invisibleViewId
=
_params
.
divId
||
""
;
this
.
invisibleStyle
=
_params
.
styleStr
||
""
;
this
.
invisibleVideoWidth
=
parseInt
(
_params
.
width
)
||
320
;
this
.
invisibleVideoHeight
=
parseInt
(
_params
.
height
)
||
240
;
}
/*
* 切换当前使用的设备
...
...
请
注册
或
登录
后发表评论