Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
张桐
/
xdykt-build
转到一个项目
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
张桐
2017-03-03 18:08:21 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
ccf48e78658853555d98ca7ab329ac4b80261668
ccf48e78
1 parent
cd6b95c4
0303 音视频ok
隐藏空白字符变更
内嵌
并排对比
正在显示
4 个修改的文件
包含
124 行增加
和
105 行删除
index.html
js/index.js
src/main.js
src/videoWithFlash.js
index.html
查看文件 @
ccf48e7
...
...
@@ -16,8 +16,8 @@
<script
type=
"text/javascript"
src=
"js/xdyEvent.js"
></script>
<script
type=
"text/javascript"
src=
"js/drag.js"
></script>
<script
type=
"text/javascript"
src=
"js/McuClient.js?v=1.0.0303.10"
></script>
<!--<script type="text/javascript" src="http://192.168.1.140/McuClient/McuClient.js?722836"></script>-->
<!--<script type="text/javascript" src="js/McuClient.js?v=1.0.0303.10"></script>-->
<script
type=
"text/javascript"
src=
"http://192.168.1.140/McuClient/McuClient.js?722898936"
></script>
<script
type=
"text/javascript"
src=
"js/jquery-1.11.3.min.js"
></script>
<script
type=
"text/javascript"
src=
"src/main.js"
></script>
...
...
js/index.js
查看文件 @
ccf48e7
...
...
@@ -92,19 +92,6 @@ $(function (){
});
}
//->点击焦点实现切换
// $tipList.bind("touchstart", function (e) {
// console.log("触摸事件touchstart1");
// step = $(this).index();
// if (document.documentElement.clientWidth > 1366) {
// $inner.stop().animate({left: -step * 360}, 500);
// } else if (document.documentElement.clientWidth <= 1366 && document.documentElement.clientWidth > 1280) {
// $inner.stop().animate({left: -step * 256}, 500);
// } else if (document.documentElement.clientWidth <= 1280) {
// $inner.stop().animate({left: -step * 238}, 500);
// }
// changeTip();
// });
$tipList
.
bind
(
"click"
,
function
()
{
...
...
@@ -119,17 +106,14 @@ $(function (){
changeTip
();
});
// $(".inner-slide").on("touchstart", "li", function (e) {
// console.log("触摸事件touchstart2");
// $("#txt_message").val($("#txt_message").val() + "[img:" + $(this).find("img").attr("data-type") + "]");
// });
$
(
".inner-slide"
).
on
(
"click"
,
"li"
,
function
(
e
)
{
$
(
"#txt_message"
).
val
(
$
(
"#txt_message"
).
val
()
+
"[img:"
+
$
(
this
).
find
(
"img"
).
attr
(
"data-type"
)
+
"]"
);
faceList
.
style
.
display
=
"none"
;
});
// $(".inner-slide")[0].onclick=function () {
// $("#txt_message").val($("#txt_message").val() + "[img:" + $(this).find("img").attr("data-type") + "]");
// }
...
...
src/main.js
查看文件 @
ccf48e7
...
...
@@ -484,9 +484,12 @@ function docDelete(callbackData){
console
.
log
(
"监听文档删除"
);
console
.
log
(
callbackData
);
updateDocList
(
callbackData
,
1
);
$
(
"#docImage"
).
attr
(
"src"
,
""
);
$
(
"#showImage"
).
attr
(
"src"
,
""
);
if
(
classAllInfo
.
userRole
==
"normal"
){
$
(
"#docImage"
).
attr
(
"src"
,
""
);
$
(
"#showImage"
).
attr
(
"src"
,
""
);
}
//操作页面
$
(
"li"
).
remove
(
".xin"
);
...
...
src/videoWithFlash.js
查看文件 @
ccf48e7
...
...
@@ -57,10 +57,7 @@ $(function () {
};
console
.
log
(
"stuNodeId"
,
stuNodeId
);
client
.
sendVideoBroadcastMsg
(
paramInfo
);
if
(
classAllInfo
.
userRole
==
"normal"
){
$
(
".stuVideo-voice"
).
css
(
"display"
,
"none"
);
$
(
".stuVideo-video"
).
css
(
"display"
,
"none"
);
}
});
...
...
@@ -74,15 +71,13 @@ $(function () {
};
client
.
sendVideoBroadcastMsg
(
paramInfo
);
$
(
"#stuVideo-video"
).
css
(
"display"
,
"block"
);
$
(
"#stuVideo-videoBg"
).
css
(
"display"
,
"none"
);
if
(
classAllInfo
.
userRole
==
"host"
){
$
(
"#stuVideo-video"
).
css
(
"display"
,
"block"
);
$
(
"#stuVideo-videoBg"
).
css
(
"display"
,
"none"
);
}
});
//学生音频按钮点击
$
(
"#stuVideo-voice"
).
click
(
function
(
e
)
{
...
...
@@ -93,12 +88,10 @@ $(function () {
$
(
".stuVideo-voiceBg"
).
css
(
"display"
,
"block"
);
$
(
".stuVideo-voice"
).
css
(
"display"
,
"none"
);
}
var
stuVideoDisplay
=
$
(
".stuVideo-videoBg"
).
css
(
"display"
);
if
(
stuVideoDisplay
==
"block"
){
$
(
"#stuVideo-videoBg"
).
trigger
(
"click"
);
}
// var stuVideoDisplay= $(".stuVideo-videoBg").css("display");
// if(stuVideoDisplay=="block"){
// $("#stuVideo-videoBg").trigger("click");
// }
var
paramInfo
=
{
...
...
@@ -108,14 +101,7 @@ $(function () {
};
console
.
log
(
"stuNodeId"
,
stuNodeId
);
client
.
sendAudioBroadcastMsg
(
paramInfo
);
if
(
classAllInfo
.
userRole
==
"normal"
){
$
(
".stuVideo-voice"
).
css
(
"display"
,
"none"
);
$
(
".stuVideo-video"
).
css
(
"display"
,
"none"
);
$
(
"#stuVideo-voice"
).
css
(
"display"
,
"none"
);
$
(
"#stuVideo-voiceBg"
).
css
(
"display"
,
"block"
);
$
(
".stuPublish"
).
css
({
"width"
:
"240px"
,
"height"
:
"180px"
});
$
(
".studentVideoBg"
).
css
(
"display"
,
"none"
);
}
});
...
...
@@ -127,23 +113,29 @@ $(function () {
"data"
:
"0"
};
client
.
sendAudioBroadcastMsg
(
paramInfo
);
$
(
"#stuVideo-voice"
).
css
(
"display"
,
"block"
);
$
(
"#stuVideo-voiceBg"
).
css
(
"display"
,
"none"
);
if
(
classAllInfo
.
userRole
==
"normal"
){
$
(
".stuVideo-voice"
).
css
(
"display"
,
"none"
);
$
(
".stuVideo-video"
).
css
(
"display"
,
"none"
);
if
(
classAllInfo
.
userRole
==
"host"
){
$
(
"#stuVideo-voice"
).
css
(
"display"
,
"block"
);
$
(
"#stuVideo-voiceBg"
).
css
(
"display"
,
"none"
);
}
// if (classAllInfo.userRole=="normal"){
// $(".stuVideo-voice").css("display","none");
// $(".stuVideo-video").css("display","none");
// }
});
//老师视频按钮点击
$
(
"#teacherVideo-video"
).
click
(
function
(
e
)
{
console
.
log
(
"teacherVideo-video点击"
);
var
teaVoiceDisplay
=
$
(
".teacherVideo-voiceBg"
).
css
(
"display"
);
if
(
teaVoiceDisplay
==
"block"
){
$
(
"#teacherVideo-voiceBg"
).
trigger
(
"click"
);
}
$
(
".teacherVideo-voice"
).
css
(
"color"
,
"#cccccc"
);
// $(".teacherVideo-voice").unbind("click");//音频按钮不可点
// var teaVoiceDisplay= $(".teacherVideo-voiceBg").css("display");
// if(teaVoiceDisplay=="block"){
// $("#teacherVideo-voiceBg").trigger("click");
// }
if
(
classAllInfo
.
userRole
==
"host"
){
$
(
".teacherVideo-videoBg"
).
css
(
"display"
,
"block"
);
$
(
".teacherVideo-video"
).
css
(
"display"
,
"none"
);
...
...
@@ -163,6 +155,8 @@ $(function () {
});
//老师视频关闭按钮点击
$
(
"#teacherVideo-videoBg"
).
click
(
function
(
e
)
{
$
(
".teacherVideo-voice"
).
css
(
"color"
,
"#333333"
);
if
(
window
.
publishflash
)
{
const
stopInfo
=
JSON
.
stringify
({
type
:
5
,
...
...
@@ -192,13 +186,14 @@ $(function () {
});
//老师音频按钮点击
$
(
"#teacherVideo-voice"
).
click
(
function
(
e
)
{
console
.
log
(
"teacherVideo-voice点击"
);
var
teaVideoDisplay
=
$
(
".teacherVideo-videoBg"
).
css
(
"display"
);
if
(
teaVideoDisplay
==
"block"
){
$
(
"#teacherVideo-videoBg"
).
trigger
(
"click"
);
}
// var teaVideoDisplay= $(".teacherVideo-videoBg").css("display");
// if(teaVideoDisplay=="block"){
//
// }
if
(
classAllInfo
.
userRole
==
"host"
){
$
(
".publish"
).
css
({
"width"
:
"240px"
,
"height"
:
"180px"
});
...
...
@@ -223,6 +218,7 @@ $(function () {
$
(
".teacherVoicing"
).
css
(
"display"
,
"none"
);
$
(
".teacherVideo-voiceBg"
).
css
(
"display"
,
"none"
);
$
(
".teacherVideo-voice"
).
css
(
"display"
,
"block"
);
$
(
".teacherVideoBg"
).
css
(
"display"
,
"block"
);
}
var
paramInfo
=
{
"nodeId"
:
Number
(
classAllInfo
.
nodeId
)
//用户的nodeId
...
...
@@ -240,6 +236,24 @@ $(function () {
});
//老师音频点击事件
function
teaAudioClick
(){
console
.
log
(
"teacherVideo-voice点击"
);
if
(
classAllInfo
.
userRole
==
"host"
){
$
(
".publish"
).
css
({
"width"
:
"240px"
,
"height"
:
"180px"
});
$
(
".play"
).
css
({
"width"
:
"1px"
,
"height"
:
"1px"
});
$
(
"#teacherVideo-voice"
).
css
(
"display"
,
"none"
);
$
(
"#teacherVideo-voiceBg"
).
css
(
"display"
,
"block"
);
$
(
".teacherVideoBg"
).
css
(
"display"
,
"none"
);
}
// /获取老师只推音频地址
achieveTeaAudioStream
();
}
//监听学生视频更新
function
stuBroadcast
(
callbackDate
){
if
(
callbackDate
.
fromNodeId
===
classAllInfo
.
nodeId
)
return
;
...
...
@@ -300,14 +314,33 @@ function stuBroadcast(callbackDate){
function
stuAudioBroadcast
(
callbackDate
){
if
(
callbackDate
.
fromNodeId
===
classAllInfo
.
nodeId
)
return
;
if
(
callbackDate
.
actionType
==
1
){
$
(
".stuVideoBg"
).
css
(
"display"
,
"none"
);
$
(
".stuPlay"
).
css
({
"width"
:
"1px"
,
"height"
:
"1px"
});
if
(
classAllInfo
.
userRole
==
"normal"
){
$
(
".stuVideoBg"
).
css
(
"display"
,
"none"
);
$
(
".stuPublish"
).
css
({
"width"
:
"240px"
,
"height"
:
"180px"
});
$
(
".stuPlay"
).
css
({
"width"
:
"1px"
,
"height"
:
"1px"
});
//获取学生只推音频地址
achieveStuVoice
();
}
if
(
classAllInfo
.
userRole
==
"host"
){
$
(
".stuVideoBg"
).
css
(
"display"
,
"none"
);
}
}
if
(
callbackDate
.
actionType
==
2
){
else
if
(
callbackDate
.
actionType
==
2
){
if
(
classAllInfo
.
userRole
==
"normal"
){
var
paramInfo
=
{
"nodeId"
:
Number
(
classAllInfo
.
nodeId
)
//用户的nodeId
};
client
.
stopPublishAudio
(
paramInfo
);
$
(
".stuPlay"
).
css
({
"width"
:
"1px"
,
"height"
:
"1px"
});
$
(
".stuPublish"
).
css
({
"width"
:
"1px"
,
"height"
:
"1px"
});
$
(
".studentVideo"
).
css
(
"background"
,
"#f5f9fb"
);
$
(
".stuVideoBg"
).
css
(
"display"
,
"block"
);
}
if
(
window
.
publishflashStuVoice
)
{
const
stopStuInfo
=
JSON
.
stringify
({
type
:
5
,
...
...
@@ -316,23 +349,7 @@ function stuAudioBroadcast(callbackDate){
console
.
log
(
publishflashStuVoice
.
_js2native
(
stopStuInfo
));
}
var
paramInfo
=
{
"nodeId"
:
Number
(
stuNodeId
)
//用户的nodeId
};
client
.
stopPublishAudio
(
paramInfo
);
$
(
".stuPlay"
).
css
({
"width"
:
"1px"
,
"height"
:
"1px"
});
$
(
".stuPublish"
).
css
({
"width"
:
"1px"
,
"height"
:
"1px"
});
$
(
".studentVideo"
).
css
(
"background"
,
"#f5f9fb"
);
$
(
".stuVideoBg"
).
css
(
"display"
,
"block"
);
$
(
"#stuVideo-video"
).
css
(
"display"
,
"block"
);
$
(
"#stuVideo-videoBg"
).
css
(
"display"
,
"none"
);
if
(
classAllInfo
.
userRole
==
"normal"
){
$
(
".stuVideo-voice"
).
css
(
"display"
,
"none"
);
$
(
".stuVideo-video"
).
css
(
"display"
,
"none"
);
$
(
".stuPublish"
).
css
({
"width"
:
"240px"
,
"height"
:
"180px"
});
}
}
}
...
...
@@ -383,6 +400,9 @@ function _videoUpdate(callbackDate){
$
(
"#stuVideo-voice"
).
css
(
"display"
,
"block"
);
$
(
"#stuVideo-voiceBg"
).
css
(
"display"
,
"none"
);
$
(
".stuVideoBg"
).
css
(
"display"
,
"block"
);
$
(
".stuVideo-video"
).
css
(
"display"
,
"block"
);
$
(
".stuVideo-videoBg"
).
css
(
"display"
,
"none"
);
}
if
((
classAllInfo
.
userRole
==
"normal"
)
&&
(
callbackDate
.
status
==
0
)
&&
(
callbackDate
.
fromNodeId
==
stuNodeId
)){
...
...
@@ -422,29 +442,13 @@ function _audioUpdate(callbackDate){
}
if
((
classAllInfo
.
userRole
==
"normal"
)
&&
(
callbackDate
.
status
==
1
)
&&
(
callbackDate
.
fromNodeId
==
stuNodeId
)){
achievePlayAudioStream
(
callbackDate
);
}
if
(
callbackDate
.
status
==
0
){
$
(
".teacherVideoBg"
).
css
(
"display"
,
"block"
);
$
(
".teacherVideo"
).
css
(
"background"
,
"#f5f9fb"
);
if
(
window
.
playflashAudio
)
{
console
.
log
(
"playflashVoiceId"
,
playflashAudioId
);
if
(
callbackDate
.
fromNodeId
==
stuNodeId
)
{
if
(
classAllInfo
.
userRole
==
"normal"
){
$
(
".play"
).
css
({
"width"
:
"1px"
,
"height"
:
"1px"
});
}
const
stopPlayInfo
=
JSON
.
stringify
({
type
:
5
,
videoId
:
playflashAudioId
});
console
.
log
(
playflashAudio
.
_js2native
(
stopPlayInfo
));
}
}
//流状态为0
if
((
classAllInfo
.
userRole
==
"host"
)
&&
(
callbackDate
.
status
==
0
)
&&
(
callbackDate
.
fromNodeId
==
stuNodeId
)){
if
(
window
.
playflashStuAudio
)
{
const
stopStuInfo
=
JSON
.
stringify
({
type
:
5
,
...
...
@@ -452,13 +456,33 @@ function _audioUpdate(callbackDate){
});
console
.
log
(
playflashStuAudio
.
_js2native
(
stopStuInfo
));
}
$
(
".stuPublish"
).
css
({
"width"
:
"1px"
,
"height"
:
"1px"
});
$
(
".stuPlay"
).
css
({
"width"
:
"1px"
,
"height"
:
"1px"
});
$
(
".studentVideo"
).
css
(
"background"
,
"#f5f9fb"
);
$
(
"#stuVideo-voice"
).
css
(
"display"
,
"block"
);
$
(
"#stuVideo-voiceBg"
).
css
(
"display"
,
"none"
);
$
(
".stuVideoBg"
).
css
(
"display"
,
"block"
);
$
(
".stuVideo-video"
).
css
(
"display"
,
"block"
);
$
(
".stuVideo-videoBg"
).
css
(
"display"
,
"none"
);
}
if
((
classAllInfo
.
userRole
==
"normal"
)
&&
(
callbackDate
.
status
==
0
)
&&
(
callbackDate
.
fromNodeId
==
stuNodeId
)){
if
(
window
.
playflashAudio
)
{
console
.
log
(
"playflashAudioId"
,
playflashAudioId
);
const
stopPlayInfo
=
JSON
.
stringify
({
type
:
5
,
videoId
:
playflashAudioId
});
console
.
log
(
playflashAudio
.
_js2native
(
stopPlayInfo
));
}
$
(
".play"
).
css
({
"width"
:
"1px"
,
"height"
:
"1px"
});
$
(
".stuVideo-voice"
).
css
(
"display"
,
"none"
);
$
(
".teacherVideoBg"
).
css
(
"display"
,
"block"
);
$
(
".teacherVideo"
).
css
(
"background"
,
"#f5f9fb"
);
}
}
...
...
@@ -628,7 +652,7 @@ function achieveStuVoice() {
console
.
log
(
' [publish] native 2 js'
,
msg
);
var
_msg
=
JSON
.
parse
(
msg
);
console
.
log
(
"_msg===========>"
,
_msg
);
if
(
_msg
.
data
.
result
==
0
){
if
(
(
_msg
.
data
.
result
==
0
)
&&
(
_msg
.
data
.
type
==
10
)
){
//将之前底层取的推流结果传递给底层
var
_successErrorResult
=
client
.
publishAudio
(
pubStuAudioResult
);
...
...
@@ -640,7 +664,11 @@ function achieveStuVoice() {
console
.
log
(
"底层广播推流失败,关闭推流"
);
}
}
else
{
}
else
if
((
_msg
.
data
.
result
==
0
)
&&
(
_msg
.
data
.
type
==
5
)){
console
.
log
(
"5,flash把学生音频流关闭成功"
);
}
else
{
console
.
error
(
'publish error'
);
}
}
...
...
@@ -684,7 +712,7 @@ function achieveStuPlayAudioStream(_pubResultObj){
var
streamInfo
=
client
.
getAudioPlayPath
(
_paramInfo
);
console
.
log
(
"result是=============>"
,
streamInfo
);
$
(
".stuPlay"
).
css
({
"width"
:
"240px"
,
"height"
:
"180px"
});
$
(
".teacherVideoBg"
).
css
(
"display"
,
"none"
);
//
$(".teacherVideoBg").css("display","none");
// $(".teacherVideo").css("background", "#CCCCCC");
$
(
".teacherVideo-voice"
).
css
(
"bottom"
,
"4px"
);
...
...
@@ -729,6 +757,8 @@ function stuPlayAudioURL(rtmpURL){
//获取老师只推音频
function
achieveTeaAudioStream
()
{
$
(
".publish"
).
css
({
"width"
:
"240px"
,
"height"
:
"180px"
});
$
(
".play"
).
css
({
"width"
:
"1px"
,
"height"
:
"1px"
});
var
paramInfo
=
{
"type"
:
"flash"
};
...
...
@@ -757,7 +787,6 @@ function achieveTeaAudioStream() {
var
_msg
=
JSON
.
parse
(
msg
);
console
.
log
(
"_msg===========>"
,
_msg
);
if
(
_msg
.
data
.
result
==
0
){
//将之前底层取的推流结果传递给底层
var
_successErrorResult
=
client
.
publishAudio
(
pushTeaAudioResult
);
console
.
log
(
"_successErrorResult======>"
,
_successErrorResult
)
...
...
@@ -785,6 +814,7 @@ function achieveTeaAudioStream() {
}
//推老师音频 js2native
function
publishTeaAudioURL
(
rtmpURL
)
{
const
msg
=
JSON
.
stringify
({
type
:
10
,
...
...
@@ -887,6 +917,8 @@ function achievePlayAudioStream(_pubResultObj){
console
.
log
(
"result是=============>"
,
streamInfo
);
$
(
".play"
).
css
({
"width"
:
"240px"
,
"height"
:
"180px"
});
$
(
".teacherVideoBg"
).
css
(
"display"
,
"none"
);
// $(".teacherVideo").css("background", "#CCCCCC");
$
(
".teacherVideo-voice"
).
css
(
"bottom"
,
"4px"
);
...
...
请
注册
或
登录
后发表评论