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
李勇
7 years ago
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
12f562be9af678a8322a562adddc01757bf6b17b
12f562be
1 parent
71f14e28
webRtc增加老师和主讲人的旁路推流设置,视频的分辨率为480X360 ,新增对H5的支持,提供m3u8地址
隐藏空白字符变更
内嵌
并排对比
正在显示
3 个修改的文件
包含
66 行增加
和
32 行删除
src/EngineEntrance.js
src/apes/VideoApe.js
src/apes/WebRtcApe.js
src/EngineEntrance.js
查看文件 @
12f562b
...
...
@@ -62,7 +62,7 @@ export default class MessageEntrance extends Emiter {
constructor
()
{
super
();
//sdk 信息
GlobalConfig
.
sdkVersion
=
"v2.1
6.8.20171012
"
;
GlobalConfig
.
sdkVersion
=
"v2.1
7.11.20171014
"
;
loger
.
warn
(
"sdkVersion:"
+
GlobalConfig
.
sdkVersion
);
//设置
...
...
@@ -1225,15 +1225,15 @@ export default class MessageEntrance extends Emiter {
//主讲人和老师可以设置旁录
if
(
GlobalConfig
.
appId
&&!
GlobalConfig
.
openFlash
){
//加入之前先设置旁录地址,只有直播支持旁路
if
(
_webRtc
&&
GlobalConfig
.
isTeachOrAssistant
){
let
publishData
=
this
.
_getVideoPublishPath
();
loger
.
log
(
"加入之前先设置旁录地址"
,
publishData
);
if
(
publishData
&&
publishData
.
code
==
0
){
_webRtc
.
setConfigPublisherUrl
(
publishData
.
publishUrl
);
}
}
setTimeout
(()
=>
{
/*//加入之前先设置旁录地址,只有直播支持旁路
if(_webRtc&&GlobalConfig.isTeachOrAssistant){
let publishData=this._getVideoPublishPath();
loger.log("加入之前先设置旁录地址",publishData);
if(publishData&&publishData.code==0){
_webRtc.setConfigPublisherUrl(publishData.publishUrl);
}
}*/
//加入音视频通话模块,延迟一秒处理,因为视频需要根据用户列表信息来判断放的位置,太早的话用户列表没有数据
this
.
_joinChannel
({
channelId
:
GlobalConfig
.
channelId
,
channelKey
:
GlobalConfig
.
channelKey
,
uid
:
GlobalConfig
.
userUid
,
info
:
""
+
GlobalConfig
.
userRole
});
},
1600
);
...
...
src/apes/VideoApe.js
查看文件 @
12f562b
...
...
@@ -121,6 +121,7 @@ class VideoApe extends Ape {
//根据推流的地址获取对应的频道信息
let
needPublishChannelInfo
=
this
.
mediaModule
.
getNeedPublishMediaChannel
(
_param
.
publishUrl
);
console
.
log
(
"needPublishChannelInfo"
,
needPublishChannelInfo
);
if
(
needPublishChannelInfo
==
null
)
{
loger
.
warn
(
'推流->推流数据已经无效'
,
_param
);
this
.
_emit
(
MessageTypes
.
VIDEO_PUBLISH_RESULT
,
{
...
...
@@ -223,6 +224,18 @@ class VideoApe extends Ape {
"toNodeId"
:
0
,
"data"
:
_data
||
""
});
//如果是老师或主讲人助教,推流需要同步
if
(
GlobalConfig
.
isTeachOrAssistant
){
_data
.
nodeId
=
GlobalConfig
.
nodeId
;
if
(
_data
.
status
==
1
){
this
.
publishVideo
(
_data
);
}
else
if
(
_data
.
status
==
0
){
_data
.
nodeId
=
GlobalConfig
.
nodeId
;
this
.
stopPublishVideo
(
_data
)
}
}
}
//==========================屏幕共享=========================================================================
...
...
@@ -482,6 +495,7 @@ class VideoApe extends Ape {
dataObj
=
videoReceivePdu
.
data
;
}
videoReceivePdu
.
data
=
dataObj
;
//录制回放和H5需要处理
if
(
GlobalConfig
.
isRecordPlayBack
){
//录制回放的处理
if
(
videoReceivePdu
.
toNodeId
!=
0
){
...
...
@@ -502,7 +516,7 @@ class VideoApe extends Ape {
"timestamp": 1505886364100,
"recordTimestamp": 27
}*/
switch
(
videoReceivePdu
.
actionType
){
/*
switch (videoReceivePdu.actionType){
case ApeConsts.MEDIA_ACTION_PUBLISH_STATUS:
//webRtc的推流和停止推流的消息
let videoInfo={};
...
...
@@ -520,7 +534,7 @@ class VideoApe extends Ape {
break;
default:
break
}
}
*/
}
else
{
//判断接收者的id,如果不是0,并且也不是自己的nodeId,那么消息不做处理
...
...
@@ -529,6 +543,35 @@ class VideoApe extends Ape {
}
else
{
loger
.
log
(
'视频控制消息处理 .'
,
videoReceivePdu
);
this
.
_emit
(
MessageTypes
.
VIDEO_BROADCAST
,
videoReceivePdu
);
let
data
=
videoReceivePdu
.
data
;
if
(
data
){
switch
(
videoReceivePdu
.
actionType
){
case
ApeConsts
.
MEDIA_ACTION_PUBLISH_STATUS
:
//webRtc的推流和停止推流的消息
let
videoInfo
=
{};
let
videoData
=
data
;
/* videoData.streamId=data.channel+"_"+data.userId+"_"+data.uid+"_"+(parseInt(parseInt(data.timestamp)/1000));
if(data.status==1){
loger.log("播放文件->", "userName",data.userName,"uid",data.uid,"时间:"+new Date(1505886364100).toString());
videoInfo=this.packVideoInfoAndSendToClient(videoData,seek);
this._emit(MessageTypes.VIDEO_PLAY, videoInfo);
}else if(data.status==0){
loger.log("停止播放文件->", "userName",data.userName,"uid",data.uid,"时间:"+new Date(1505886364100).toString());
videoInfo=this.packVideoInfoAndSendToClient(videoData,seek);
this._emit(MessageTypes.VIDEO_STOP, videoInfo);
}*/
/* if(data.status==1){
this.publishVideo(data);
}else if(data.status==0){
data.nodeId=videoReceivePdu.toNodeId;
this.stopPublishVideo(data)
}*/
break
;
default
:
break
}
}
}
}
...
...
src/apes/WebRtcApe.js
查看文件 @
12f562b
...
...
@@ -45,8 +45,8 @@ class WebRtcApe extends Emiter {
this
.
pFrameRate
=
30
;
this
.
pBitrate
=
500
;
//this.videoResolution = "360P_8";//480x360 30 490
this
.
videoResolution
=
"240P"
;
//
this
.
videoResolution
=
"360P_8"
;
//480x360 30 490
//this.videoResolution = "240P";//
this
.
isOpenVideo
=
true
;
this
.
isPublish
=
false
;
//当前是否正在推流
...
...
@@ -251,7 +251,7 @@ class WebRtcApe extends Emiter {
for (let i=normalList.length-1;i>=0;i--){
divItem=normalList[i];
if(divItem&&divItem.children.length<2){
console.log("
删除无效的
视图
",divItem
);
console.log("
删除无效的
学生视图
"
);
divItem.remove();
}
}
...
...
@@ -261,7 +261,7 @@ class WebRtcApe extends Emiter {
for (let i=hostList.length-1;i>=0;i--){
divItem=hostList[i];
if(divItem&&divItem.children.length<2){
console.log("
删除无效的
视图
",divItem
);
console.log("
删除无效的
老师视图
"
);
divItem.remove();
}
}
...
...
@@ -271,7 +271,7 @@ class WebRtcApe extends Emiter {
for (let i=localList.length-1;i>=0;i--){
divItem=localList[i];
if(divItem&&divItem.children.length<2){
console.log("
删除无效的
视图
",divItem
);
console.log("
删除无效的
本地视图
"
);
divItem.remove();
}
}
...
...
@@ -423,12 +423,13 @@ class WebRtcApe extends Emiter {
* 设置旁录地址
* */
setConfigPublisherUrl(_publishUrl){
loger.warn("
设置旁路地址
->
",_publishUrl);
this.configPublisherUrl=_publishUrl;
if(this.client&& this.configPublisherUrl){
this.client.configPublisher(
{width: this.pWidth, height: this.pHeight, framerate: this.pFrameRate, bitrate: this.pBitrate, publishUrl: this.configPublisherUrl}
);
let configObj={width: parseInt(this.pWidth), height: parseInt(this.pHeight), framerate: parseInt(this.pFrameRate), bitrate: parseInt(this.pBitrate), publishUrl:""+this.configPublisherUrl};
//let configObj={width: 480, height:360, framerate:30, bitrate:500, publishUrl:_publishUrl};
//let configObj={width: 480, height:360, framerate:30, bitrate:500, publishUrl:'rtmp://txlivepush.xuedianyun.com/live/markettest_395312484_T8440_983041_1507888360?bizid=11220&txSecret=15cc50d93f86f9e1a2a76a10db2b09a8&txTime=59e135a8&record=hls|flv&record_interval=5400'};
loger.warn("
设置旁路地址
->
",configObj);
this.client.configPublisher(configObj);
}else {
loger.warn("
设置旁路地址
->
失败
->
为初始化或旁路地址无效
",_publishUrl);
}
...
...
@@ -556,9 +557,6 @@ class WebRtcApe extends Emiter {
$("
.
"+this.normalWebRtcVideoClass).css("
width
",this.normalRemoteVideoWidth*this.videoScale);
$("
.
"+this.normalWebRtcVideoClass).css("
height
",this.normalRemoteVideoHeight*this.videoScale);
//监课的不需要设置
//$("
.
"+this.invisibleWebRtcVideoClass).css("
width
",this.localVideoWidth);
//$("
.
"+this.invisibleWebRtcVideoClass).css("
height
",this.localVideoHeight);
}
/*
...
...
@@ -575,14 +573,6 @@ class WebRtcApe extends Emiter {
}
this.videoScale=scale;
loger.log("
更新视频视图大小
->
videoScale
:
"+this.videoScale);
/* this.localVideoWidth=this.localVideoWidth*this.videoScale;
this.localVideoHeight=this.localVideoHeight*this.videoScale;
this.hostRemoteVideoWidth=this.hostRemoteVideoWidth*this.videoScale;
this.hostRemoteVideoHeight=this.hostRemoteVideoHeight*this.videoScale;
this.normalRemoteVideoWidth=this.normalRemoteVideoWidth*this.videoScale;
this.normalRemoteVideoHeight=this.normalRemoteVideoHeight*this.videoScale;*/
this.updateAllVideoSize();
}
...
...
@@ -751,7 +741,8 @@ class WebRtcApe extends Emiter {
userName: GlobalConfig.userName,
userRole: GlobalConfig.userRole,
timestamp: curTimestamp,
recordTimestamp: GlobalConfig.recordTimestamp
recordTimestamp: GlobalConfig.recordTimestamp,
publishUrl:this.configPublisherUrl
});
return data;
}
...
...
请
注册
或
登录
后发表评论