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-02 11:07:05 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
9ec1399e12a7a260bd1ebc08e9ccdea3ffa6cf07
9ec1399e
1 parent
183ea409
老师多次开关自己音视频OK 学生正常播放
隐藏空白字符变更
内嵌
并排对比
正在显示
2 个修改的文件
包含
105 行增加
和
99 行删除
index.html
src/videoWithFlash.js
index.html
查看文件 @
9ec1399
...
...
@@ -590,7 +590,7 @@
<div
class=
"fourParamsOut"
>
<ul
class=
"fourParams clear"
>
<li><span>
classId:
</span><input
class=
"classId"
type=
"text"
value=
"1
20394398
"
></li>
<li><span>
classId:
</span><input
class=
"classId"
type=
"text"
value=
"1
154006572
"
></li>
<!--<li><span>userRole:</span><input class="userRole" type="text" value=""></li>-->
<!--<li><span>portal:</span><input class="portal" type="text" value=""></li>-->
<li><span>
userId:
</span><input
class=
"userId"
type=
"text"
value=
""
></li>
...
...
src/videoWithFlash.js
查看文件 @
9ec1399
...
...
@@ -8,9 +8,14 @@ var client; //客户端
var
stuNodeId
;
var
videoWithFlash
=
{};
var
pushTeaResult
;
//推老师音视频结果
var
pushTeaAudioResult
;
//推老师音频结果
window
.
videoWithFlash
=
videoWithFlash
;
videoWithFlash
.
flashInit
=
function
(
_client
){
...
...
@@ -124,20 +129,20 @@ $(function () {
if
(
teaVoiceDisplay
==
"block"
){
$
(
"#teacherVideo-voiceBg"
).
trigger
(
"click"
);
}
$
(
".teacherVideo-videoBg"
).
css
(
"display"
,
"block"
);
$
(
".teacherVideo-video"
).
css
(
"display"
,
"none"
);
$
(
"#teacherVideo-voice"
).
html
(
""
);
$
(
"#teacherVideo-voice"
).
addClass
(
"teacherVideo-voice"
);
$
(
"#teacherVideo-voice"
).
removeClass
(
"teacherVideo-voiceBg"
);
$
(
".teacherVideoBg"
).
css
(
"display"
,
"none"
);
$
(
".teacherVideo"
).
css
(
"background"
,
"#CCCCCC"
);
$
(
".teacherVideo-voice"
).
css
(
"bottom"
,
"4px"
);
$
(
".teacherVoicing"
).
css
(
"display"
,
"none"
);
if
(
classAllInfo
.
userRole
==
"host"
){
$
(
".teacherVideo-videoBg"
).
css
(
"display"
,
"block"
);
$
(
".teacherVideo-video"
).
css
(
"display"
,
"none"
);
$
(
"#teacherVideo-voice"
).
html
(
""
);
$
(
"#teacherVideo-voice"
).
addClass
(
"teacherVideo-voice"
);
$
(
"#teacherVideo-voice"
).
removeClass
(
"teacherVideo-voiceBg"
);
$
(
".teacherVideoBg"
).
css
(
"display"
,
"none"
);
$
(
".teacherVideo"
).
css
(
"background"
,
"#CCCCCC"
);
$
(
".teacherVideo-voice"
).
css
(
"bottom"
,
"4px"
);
$
(
".teacherVoicing"
).
css
(
"display"
,
"none"
);
}
//获取推流地址
achieveTeaStream
();
achieveTea
Video
Stream
();
});
...
...
@@ -148,7 +153,6 @@ $(function () {
type
:
5
,
videoId
:
publishflashVideoId
,
});
console
.
log
(
"publishflashVideoId"
,
publishflashVideoId
);
console
.
log
(
publishflash
.
_js2native
(
stopInfo
));
}
...
...
@@ -158,11 +162,20 @@ $(function () {
console
.
log
(
classAllInfo
.
nodeId
);
client
.
stopPublishVideo
(
paramInfo
);
$
(
".publish"
).
css
(
"display"
,
"none"
);
$
(
".teacherVideo"
).
css
(
"background"
,
"#f5f9fb"
);
$
(
".teacherVideoBg"
).
css
(
"display"
,
"block"
);
$
(
"#teacherVideo-video"
).
css
(
"display"
,
"block"
);
$
(
"#teacherVideo-videoBg"
).
css
(
"display"
,
"none"
);
if
(
classAllInfo
.
userRole
==
"host"
){
$
(
".publish"
).
css
({
"width"
:
"1px"
,
"height"
:
"1px"
});
$
(
".teacherVideo"
).
css
(
"background"
,
"#f5f9fb"
);
$
(
".teacherVideoBg"
).
css
(
"display"
,
"block"
);
$
(
"#teacherVideo-video"
).
css
(
"display"
,
"block"
);
$
(
"#teacherVideo-videoBg"
).
css
(
"display"
,
"none"
);
}
if
(
classAllInfo
.
userRole
==
"normal"
){
$
(
".play"
).
css
({
"width"
:
"1px"
,
"height"
:
"1px"
});
}
});
//老师音频按钮点击
...
...
@@ -172,50 +185,44 @@ $(function () {
if
(
teaVideoDisplay
==
"block"
){
$
(
"#teacherVideo-videoBg"
).
trigger
(
"click"
);
}
$
(
"#teacherVideo-voice"
).
css
(
"display"
,
"none"
);
$
(
"#teacherVideo-voiceBg"
).
css
(
"display"
,
"block"
);
$
(
".publish"
).
css
(
"display"
,
"none"
);
$
(
".teacherVideoBg"
).
css
(
"display"
,
"none"
);
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"
);
}
// /获取老师只推音频地址
achieveTea
Voice
();
achieveTea
AudioStream
();
});
//老师音频关闭按钮点击
$
(
"#teacherVideo-voiceBg"
).
click
(
function
(
e
)
{
console
.
log
(
"teacherVideo-voice点击"
);
$
(
".publish"
).
css
(
"display"
,
"none"
);
$
(
".teacherVideo"
).
css
(
"background"
,
"#f5f9fb"
);
$
(
".teacherVoicing"
).
css
(
"display"
,
"none"
);
$
(
".teacherVideo-voiceBg"
).
css
(
"display"
,
"none"
);
$
(
".teacherVideo-voice"
).
css
(
"display"
,
"block"
);
if
(
classAllInfo
.
userRole
==
"host"
){
$
(
".publish"
).
css
({
"width"
:
"1px"
,
"height"
:
"1px"
});
$
(
".teacherVideo"
).
css
(
"background"
,
"#f5f9fb"
);
$
(
".teacherVoicing"
).
css
(
"display"
,
"none"
);
$
(
".teacherVideo-voiceBg"
).
css
(
"display"
,
"none"
);
$
(
".teacherVideo-voice"
).
css
(
"display"
,
"block"
);
}
var
paramInfo
=
{
"nodeId"
:
Number
(
classAllInfo
.
nodeId
)
//用户的nodeId
};
client
.
stopPublishAudio
(
paramInfo
);
if
(
window
.
publishflashVoice
)
{
if
(
window
.
publishflashAudio
)
{
const
stopTeaInfo
=
JSON
.
stringify
({
type
:
5
,
videoId
:
publishflash
Voice
Id
,
videoId
:
publishflash
Audio
Id
,
});
console
.
log
(
publishflash
Voice
.
_js2native
(
stopTeaInfo
));
console
.
log
(
publishflash
Audio
.
_js2native
(
stopTeaInfo
));
}
$
(
".publish"
).
css
(
"display"
,
"none"
);
$
(
".teacherVideo"
).
css
(
"background"
,
"#f5f9fb"
);
$
(
".teacherVideoBg"
).
css
(
"display"
,
"block"
);
$
(
"#teacherVideo-video"
).
css
(
"display"
,
"block"
);
$
(
"#teacherVideo-videoBg"
).
css
(
"display"
,
"none"
);
$
(
"#teacherVideo-voice"
).
css
(
"display"
,
"block"
);
$
(
"#teacherVideo-voiceBg"
).
css
(
"display"
,
"none"
);
});
...
...
@@ -327,8 +334,6 @@ function _videoUpdate(callbackDate){
}
if
((
classAllInfo
.
userRole
==
"normal"
)
&&
(
callbackDate
.
status
==
1
)
&&
(
callbackDate
.
channelId
!==
''
)
&&
(
callbackDate
.
fromNodeId
==
stuNodeId
)){
achievePlayStream
(
callbackDate
);
...
...
@@ -343,7 +348,7 @@ function _videoUpdate(callbackDate){
console
.
log
(
callbackDate
.
fromNodeId
,
stuNodeId
);
if
(
callbackDate
.
fromNodeId
==
stuNodeId
){
if
(
classAllInfo
.
userRole
==
"normal"
){
// $(".play").css("display","none"
);
$
(
".play"
).
css
({
"width"
:
"1px"
,
"height"
:
"1px"
}
);
}
// $(".play").css("display","none");
...
...
@@ -376,24 +381,27 @@ function _audioUpdate(callbackDate){
if
((
classAllInfo
.
userRole
==
"normal"
)
&&
(
callbackDate
.
status
==
1
)
&&
(
callbackDate
.
channelId
!==
''
)
&&
(
callbackDate
.
fromNodeId
==
stuNodeId
)){
achievePlay
Voice
Stream
(
callbackDate
);
achievePlay
Audio
Stream
(
callbackDate
);
}
if
(
callbackDate
.
status
==
0
){
$
(
".teacherVideoBg"
).
css
(
"display"
,
"block"
);
$
(
".teacherVideo"
).
css
(
"background"
,
"#f5f9fb"
);
if
(
window
.
playflashVoice
)
{
console
.
log
(
"playflashVoiceId"
,
playflashVoiceId
);
if
(
window
.
playflashAudio
)
{
console
.
log
(
"playflashVoiceId"
,
playflashAudioId
);
if
(
callbackDate
.
fromNodeId
==
stuNodeId
)
{
if
(
classAllInfo
.
userRole
==
"normal"
){
$
(
".play"
).
css
(
"display"
,
"none"
);
$
(
".play"
).
css
(
{
"width"
:
"1px"
,
"height"
:
"1px"
}
);
}
const
stopPlayInfo
=
JSON
.
stringify
({
type
:
5
,
videoId
:
playflash
Voice
Id
videoId
:
playflash
Audio
Id
});
console
.
log
(
playflash
Voice
.
_js2native
(
stopPlayInfo
));
console
.
log
(
playflash
Audio
.
_js2native
(
stopPlayInfo
));
}
}
}
...
...
@@ -603,19 +611,17 @@ function publishStuVoiceURL(rtmpURL) {
//获取老师只推音频
function
achieveTeaVoice
()
{
$
(
".publish"
).
css
(
"display"
,
"block"
);
$
(
".play"
).
css
(
"display"
,
"none"
);
//获取老师只推音频
function
achieveTeaAudioStream
()
{
var
paramInfo
=
{
"type"
:
"flash"
};
var
pubResult
=
client
.
getAudioPublishPath
(
paramInfo
);
console
.
log
(
"执行getAudioPublishPath,返回的结果"
,
pubResult
);
pushTeaAudioResult
=
client
.
getAudioPublishPath
(
paramInfo
);
console
.
log
(
"执行getAudioPublishPath,返回的结果"
,
pushTeaAudioResult
);
//code为0,代表成功
if
(
pubResult
.
code
==
0
){
if
(
!
window
.
publishflashVoice
)
{
if
(
pushTeaAudioResult
.
code
==
0
){
if
(
!
window
.
publishflashAudio
)
{
flashvideo
(
'publish'
,
'100%'
,
...
...
@@ -624,10 +630,10 @@ function achieveTeaVoice() {
if
(
error
)
{
return
console
.
error
(
error
);
}
window
.
publishflashVoice
=
publishflash
;
window
.
publishflashVoiceId
=
teaTimeStamp
();
window
.
publishflashAudio
=
publishflash
;
window
.
publishflashAudioId
=
teaTimeStamp
();
publishTea
VoiceURL
(
pub
Result
.
publishUrl
);
publishTea
AudioURL
(
pushTeaAudio
Result
.
publishUrl
);
},
function
(
msg
)
{
...
...
@@ -637,7 +643,7 @@ function achieveTeaVoice() {
if
(
_msg
.
data
.
result
==
0
){
//将之前底层取的推流结果传递给底层
var
_successErrorResult
=
client
.
publishAudio
(
pu
b
Result
);
var
_successErrorResult
=
client
.
publishAudio
(
pu
shTeaAudio
Result
);
console
.
log
(
"_successErrorResult======>"
,
_successErrorResult
)
if
(
_successErrorResult
.
code
==
0
){
console
.
log
(
"底层广播推流成功"
);
...
...
@@ -654,44 +660,43 @@ function achieveTeaVoice() {
}
else
{
publishTea
VoiceURL
(
pub
Result
.
publishUrl
);
publishTea
AudioURL
(
pushTeaAudio
Result
.
publishUrl
);
}
}
else
if
(
pu
b
Result
.
code
==
1
){
}
else
if
(
pu
shTeaAudio
Result
.
code
==
1
){
}
}
function
publishTeaVoiceURL
(
rtmpURL
)
{
function
publishTeaAudioURL
(
rtmpURL
)
{
const
msg
=
JSON
.
stringify
({
type
:
10
,
videoId
:
publishflash
Voice
Id
,
videoId
:
publishflash
Audio
Id
,
data
:
{
video
:
false
,
audio
:
true
,
url
:
rtmpURL
}
});
console
.
log
(
publishflash
Voice
.
_js2native
(
msg
));
console
.
log
(
publishflash
Audio
.
_js2native
(
msg
));
}
//获取老师推流音视频地址
function
achieveTeaStream
(){
$
(
".publish"
).
css
(
"display"
,
"block"
);
function
achieveTeaVideoStream
(){
$
(
".publish"
).
css
({
"width"
:
"240px"
,
"height"
:
"180px"
});
$
(
".play"
).
css
(
"display"
,
"none"
);
var
paramInfo
=
{
"type"
:
"flash"
};
var
pubResult
=
client
.
getVideoPublishPath
(
paramInfo
);
console
.
log
(
"执行getPublishVideoPath,返回的结果"
,
pubResult
);
pushTeaResult
=
client
.
getVideoPublishPath
(
paramInfo
);
console
.
log
(
"执行getPublishVideoPath,返回的结果"
,
pushTeaResult
);
//code为0,代表成功
if
(
pu
b
Result
.
code
==
0
){
if
(
pu
shTea
Result
.
code
==
0
){
if
(
!
window
.
publishflash
)
{
console
.
log
(
"if==================>"
);
flashvideo
(
'publish'
,
'100%'
,
...
...
@@ -703,7 +708,7 @@ function achieveTeaStream(){
window
.
publishflash
=
publishflash
;
window
.
publishflashVideoId
=
teaTimeStamp
();
publishURL
(
pu
b
Result
.
publishUrl
);
publishURL
(
pu
shTea
Result
.
publishUrl
);
},
function
(
msg
)
{
console
.
log
(
' [publish] native 2 js'
,
msg
);
...
...
@@ -711,7 +716,8 @@ function achieveTeaStream(){
console
.
log
(
"_msg===========>"
,
_msg
);
if
(
_msg
.
data
.
result
==
0
){
//将之前底层取的推流结果传递给底层
var
_successErrorResult
=
client
.
publishVideo
(
pubResult
);
console
.
log
(
"之前的推流结果"
,
pushTeaResult
);
var
_successErrorResult
=
client
.
publishVideo
(
pushTeaResult
);
console
.
log
(
"_successErrorResult======>"
,
_successErrorResult
)
if
(
_successErrorResult
.
code
==
0
){
console
.
log
(
"底层广播推流成功"
);
...
...
@@ -726,16 +732,15 @@ function achieveTeaStream(){
)
}
else
{
console
.
log
(
"else=============>"
);
publishURL
(
pubResult
.
publishUrl
);
publishURL
(
pushTeaResult
.
publishUrl
);
}
}
else
if
(
pu
b
Result
.
code
==
1
){
}
else
if
(
pu
shTea
Result
.
code
==
1
){
console
.
log
(
"pubResult.code==1"
);
}
}
//推音视频 js2native
//推
老师
音视频 js2native
function
publishURL
(
rtmpURL
)
{
const
msg
=
JSON
.
stringify
({
type
:
10
,
...
...
@@ -747,12 +752,13 @@ function publishURL(rtmpURL) {
}
});
console
.
log
(
"publishflashVideoId======>"
,
publishflashVideoId
);
console
.
log
(
publishflash
);
console
.
log
(
publishflash
.
_js2native
(
msg
));
}
//获取播放音频地址
function
achievePlay
Voice
Stream
(
_pubResultObj
){
function
achievePlay
Audio
Stream
(
_pubResultObj
){
console
.
log
(
"_pubResultObj==========>"
,
_pubResultObj
)
var
_paramInfo
=
{
...
...
@@ -765,12 +771,12 @@ function achievePlayVoiceStream(_pubResultObj){
};
var
streamInfo
=
client
.
getAudioPlayPath
(
_paramInfo
);
console
.
log
(
"result是=============>"
,
streamInfo
);
$
(
".play"
).
css
(
"display"
,
"block"
);
$
(
".play"
).
css
(
{
"width"
:
"240px"
,
"height"
:
"180px"
}
);
$
(
".teacherVideoBg"
).
css
(
"display"
,
"none"
);
$
(
".teacherVideo"
).
css
(
"background"
,
"#CCCCCC"
);
$
(
".teacherVideo-voice"
).
css
(
"bottom"
,
"4px"
);
if
(
!
window
.
playflash
Voice
)
{
if
(
!
window
.
playflash
Audio
)
{
flashvideo
(
'play'
,
'100%'
,
...
...
@@ -779,10 +785,10 @@ function achievePlayVoiceStream(_pubResultObj){
if
(
error
)
{
return
console
.
error
(
error
);
}
window
.
playflashVoice
=
playflash
;
window
.
playflashVoiceId
=
teaTimeStamp
();
window
.
playflashAudio
=
playflash
;
window
.
playflashAudioId
=
teaTimeStamp
();
play
Voice
URL
(
streamInfo
.
playUrl
);
play
Audio
URL
(
streamInfo
.
playUrl
);
},
function
(
msg
)
{
console
.
log
(
' [play] native 2 js'
,
msg
);
...
...
@@ -790,25 +796,25 @@ function achievePlayVoiceStream(_pubResultObj){
)
}
else
{
play
Voice
URL
(
streamInfo
.
playUrl
);
play
Audio
URL
(
streamInfo
.
playUrl
);
}
}
function
play
Voice
URL
(
rtmpURL
){
function
play
Audio
URL
(
rtmpURL
){
const
msg
=
JSON
.
stringify
({
type
:
2
,
videoId
:
playflash
Voice
Id
,
videoId
:
playflash
Audio
Id
,
data
:
{
url
:
rtmpURL
// url:'rtmp://123.56.205.116:1935/live/alexwang'
}
});
console
.
log
(
playflash
Voice
.
_js2native
(
msg
));
console
.
log
(
playflash
Audio
.
_js2native
(
msg
));
}
//获取音视频播流地址
//获取
老师
音视频播流地址
function
achievePlayStream
(
_pubResultObj
){
console
.
log
(
"_pubResultObj==========>"
,
_pubResultObj
)
var
_paramInfo
=
{
...
...
@@ -821,7 +827,7 @@ function playVoiceURL(rtmpURL){
};
var
streamInfo
=
client
.
getVideoPlayPath
(
_paramInfo
);
console
.
log
(
"result是=============>"
,
streamInfo
);
// $(".play").css("display","block"
);
$
(
".play"
).
css
({
"width"
:
"240px"
,
"height"
:
"180px"
}
);
$
(
".teacherVideoBg"
).
css
(
"display"
,
"none"
);
$
(
".teacherVideo"
).
css
(
"background"
,
"#CCCCCC"
);
$
(
".teacherVideo-voice"
).
css
(
"bottom"
,
"4px"
);
...
...
请
注册
或
登录
后发表评论