Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
胡斌
/
liveAssistant_web_demo
转到一个项目
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-05-02 22:18:01 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
14201435a67be9d399e02b016e3c30e754f7d92f
14201435
1 parent
41255e19
get_rtmp_port,format default url with the rtmp port got
显示空白字符变更
内嵌
并排对比
正在显示
1 个修改的文件
包含
40 行增加
和
10 行删除
demo.html
demo.html
查看文件 @
1420143
...
...
@@ -144,6 +144,7 @@ a:active {
var
websocket
;
var
initload
=
true
;
var
player
;
var
rtmp_port
=
1935
;
function
testWebSocket
()
...
...
@@ -168,6 +169,12 @@ a:active {
wsState
=
"idle"
;
}
function
playRTMPStream
(
url
){
document
.
getElementById
(
'inputURL'
).
value
=
url
;
queryParameters
[
'source'
]
=
url
;
initialize
();
}
function
onMessage
(
evt
)
{
if
(
typeof
(
evt
.
data
)
==
"string"
){
...
...
@@ -184,7 +191,16 @@ a:active {
var
byte_order
=
dv
.
getUint8
(
2
,
true
);
var
data_len
=
dv
.
getUint32
(
4
,
true
);
if
(
result
==
83
){
//get camera sucess
if
(
0
==
result
){
//mov_start success
playRTMPStream
(
"rtmp://127.0.0.1:"
+
rtmp_port
+
"/live/ms"
);
}
else
if
(
11
==
result
){
//ss_start success
playRTMPStream
(
"rtmp://127.0.0.1:"
+
rtmp_port
+
"/live/ss"
);
}
else
if
(
55
==
result
){
//ds_start success
playRTMPStream
(
"rtmp://127.0.0.1:"
+
rtmp_port
+
"/live/ds"
);
}
else
if
(
result
==
83
){
//get camera sucess
if
(
data_len
>
4
){
var
cam_num
=
dv
.
getUint32
(
8
,
true
);
var
offset
=
12
;
...
...
@@ -228,18 +244,25 @@ a:active {
}
}
else
if
(
85
==
result
){
//cam_share success
document
.
getElementById
(
'inputURL'
).
value
=
"rtmp://127.0.0.1/live/cs"
;
queryParameters
[
'source'
]
=
"rtmp://127.0.0.1/live/cs"
;
initialise
();
playRTMPStream
(
"rtmp://127.0.0.1:"
+
rtmp_port
+
"/live/cs"
);
}
else
if
(
95
==
result
){
//get_videoparam success
var
data
=
new
Uint8Array
(
evt
.
target
.
result
,
8
,
evt
.
target
.
result
.
byteLength
-
8
-
1
);
//var data_sting = new TextDecoder("utf-8").decode(data);
var
data_sting
=
utf8to16
(
data
);
var
td
=
document
.
getElementById
(
'videoparam'
);
td
.
value
=
data_sting
;
var
input
=
document
.
getElementById
(
'videoparam'
);
input
.
value
=
data_sting
;
writeToScreen
(
'<span style="color: blue;">get_videoparam result: '
+
data_sting
+
' </span>'
);
}
else
if
(
105
==
result
){
//get_rtmp_port_success
var
data
=
new
Uint8Array
(
evt
.
target
.
result
,
8
,
evt
.
target
.
result
.
byteLength
-
8
-
1
);
//var data_sting = new TextDecoder("utf-8").decode(data);
var
data_sting
=
utf8to16
(
data
);
var
input
=
document
.
getElementById
(
'rtmp_port'
);
input
.
value
=
data_sting
;
rtmp_port
=
data_sting
;
writeToScreen
(
'<span style="color: blue;">get_rtmp_port result: '
+
data_sting
+
' </span>'
);
}
else
{
var
data
=
new
Uint8Array
(
evt
.
target
.
result
,
8
,
evt
.
target
.
result
.
byteLength
-
8
);
//var data_sting = new TextDecoder("utf-8").decode(data);
...
...
@@ -439,7 +462,9 @@ a:active {
cmd
.
data
=
utf16to8
(
param
.
value
);
cmd
.
data_len
=
cmd
.
data
.
length
;
}
else
if
(
obj
.
id
==
"get_rtmp_port"
){
cmd
.
type
=
52
;
}
doSendWSCmd
(
cmd
);
}
...
...
@@ -483,7 +508,7 @@ a:active {
player
=
document
.
getElementById
(
id
);
}
function
initiali
s
e
()
function
initiali
z
e
()
{
function
getUrlParam
(
name
)
{
...
...
@@ -576,7 +601,7 @@ a:active {
function
playStream
()
{
queryParameters
[
'source'
]
=
document
.
getElementById
(
'inputURL'
).
value
;
initiali
s
e
();
initiali
z
e
();
}
function
checkbox
(
type
)
...
...
@@ -625,7 +650,7 @@ a:active {
output
.
innerHTML
=
""
;
}
initiali
s
e
();
initiali
z
e
();
</script>
...
...
@@ -684,6 +709,11 @@ a:active {
<table
width=
"510"
border=
"0"
cellspacing=
"0"
cellpadding=
"0"
>
<tr>
<td
width=
"35"
colspan=
"2"
><img
src=
"images/spacer.gif"
width=
"20"
height=
"10"
/></td>
<td
colspan=
"3"
><button
type=
"button"
id=
"get_rtmp_port"
onclick=
"onTestClick(this)"
>
get_rtmp_port
</button></td>
<td
colspan=
"3"
><input
id=
"rtmp_port"
width=
"400"
/></td>
</tr>
<tr>
<td
width=
"35"
colspan=
"2"
><img
src=
"images/spacer.gif"
width=
"20"
height=
"10"
/></td>
<td
colspan=
"3"
><button
type=
"button"
id=
"ss_start"
onclick=
"onTestClick(this)"
>
ss_start
</button></td>
<td
colspan=
"3"
><input
id=
"ss_start_input"
width=
"400"
/></td>
<td
colspan=
"3"
><button
type=
"button"
id=
"ss_stop"
onclick=
"javascript:onTestClick(this);"
>
ss_stop
</button></td>
...
...
请
注册
或
登录
后发表评论