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-01 10:06:47 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
13583e6a841fe38e8ea869b17432371ccf389137
13583e6a
1 parent
18ce3072
set rmtp url by recreate swf object,instead of reload web with different parameters
隐藏空白字符变更
内嵌
并排对比
正在显示
2 个修改的文件
包含
50 行增加
和
23 行删除
demo.html
scripts/swfobject.js
demo.html
查看文件 @
13583e6
...
...
@@ -141,8 +141,10 @@ a:active {
var
output
;
var
wsState
=
"idle"
;
var
websocket
;
var
initload
=
true
;
var
player
;
function
testWebSocket
()
function
testWebSocket
()
{
websocket
=
new
WebSocket
(
wsUri
);
websocket
.
onopen
=
function
(
evt
)
{
onOpen
(
evt
)
};
...
...
@@ -180,7 +182,7 @@ a:active {
var
byte_order
=
dv
.
getUint8
(
2
,
true
);
var
data_len
=
dv
.
getUint32
(
4
,
true
);
if
(
result
==
83
){
if
(
result
==
83
){
//get camera sucess
if
(
data_len
>
4
){
var
cam_num
=
dv
.
getUint32
(
8
,
true
);
var
offset
=
12
;
...
...
@@ -201,7 +203,7 @@ a:active {
}
}
}
else
if
(
53
==
result
){
else
if
(
53
==
result
){
//get mic success
if
(
data_len
>
4
){
var
mic_num
=
dv
.
getUint32
(
8
,
true
);
var
offset
=
12
;
...
...
@@ -221,6 +223,11 @@ 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
();
}
else
{
var
data_sting
=
new
TextDecoder
(
"utf-8"
).
decode
(
data
);
writeToScreen
(
'<span style="color: blue;">RESPONSE: '
+
data_sting
+
' </span>'
);
...
...
@@ -289,8 +296,8 @@ a:active {
var
buffer
=
new
ArrayBuffer
(
cmd
.
data_len
);
var
mic_name_len
=
new
Uint32Array
(
buffer
,
0
,
1
);
var
micSel
=
document
.
getElementById
(
"mics"
);
var
index
=
micSel
.
selectedIndex
;
// 选中索引
var
sel_mic_name
=
micSel
.
options
[
index
].
text
;
// 选中文本
var
index
=
micSel
.
selectedIndex
;
var
sel_mic_name
=
micSel
.
options
[
index
].
text
;
mic_name_len
[
0
]
=
sel_mic_name
.
length
;
var
urlname_len
=
new
Uint32Array
(
buffer
,
4
,
1
);
urlname_len
[
0
]
=
0
;
...
...
@@ -316,8 +323,8 @@ a:active {
var
buffer
=
new
ArrayBuffer
(
cmd
.
data_len
);
var
cam_name_len
=
new
Uint32Array
(
buffer
,
0
,
1
);
var
camSel
=
document
.
getElementById
(
"cameras"
);
var
index
=
camSel
.
selectedIndex
;
// 选中索引
var
sel_cam_name
=
camSel
.
options
[
index
].
text
;
// 选中文本
var
index
=
camSel
.
selectedIndex
;
var
sel_cam_name
=
camSel
.
options
[
index
].
text
;
cam_name_len
[
0
]
=
sel_cam_name
.
length
;
var
urlname_len
=
new
Uint32Array
(
buffer
,
4
,
1
);
urlname_len
[
0
]
=
0
;
...
...
@@ -371,6 +378,10 @@ a:active {
}
}
function
onJavaScriptBridgeCreated
(
id
){
player
=
document
.
getElementById
(
id
);
}
function
initialise
()
{
...
...
@@ -386,9 +397,23 @@ a:active {
return
unescape
(
results
[
1
]
);
}
if
(
initload
==
true
){
queryParameters
[
'source'
]
=
getUrlParam
(
'source'
);
queryParameters
[
'type'
]
=
getUrlParam
(
'type'
);
queryParameters
[
'idx'
]
=
getUrlParam
(
'idx'
);
initload
=
false
;
}
else
{
flashVars
=
""
;
swfobject
.
removeSWF
(
"StrobeMediaPlayback"
);
var
v
=
document
.
getElementById
(
"flashContent"
);
if
(
v
==
null
){
var
flashContentParent
=
document
.
getElementById
(
"flashContentParent"
);
if
(
flashContentParent
){
flashContentParent
.
innerHTML
=
"<div id=\"flashContent\"></div>"
;
}
}
}
if
(
queryParameters
[
'source'
]
==
""
)
queryParameters
[
'source'
]
=
"rtmp://localhost/live/ss"
;
...
...
@@ -398,6 +423,7 @@ a:active {
if
(
queryParameters
[
'idx'
]
==
""
)
queryParameters
[
'idx'
]
=
"2"
;
flashVars
+=
"&src="
;
flashVars
+=
queryParameters
[
'source'
];
...
...
@@ -419,7 +445,8 @@ a:active {
streamType
:
queryParameters
[
'type'
],
autoPlay
:
"true"
,
controlBarAutoHide
:
"true"
,
controlBarPosition
:
"bottom"
controlBarPosition
:
"bottom"
,
javascriptCallbackFunction
:
"onJavaScriptBridgeCreated"
};
tag
=
"<object width='640' height='377' id='StrobeMediaPlayback' name='StrobeMediaPlayback' type='application/x-shockwave-flash' classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' ><param name='movie' value='swfs/StrobeMediaPlayback.swf' /> <param name='quality' value='high' /> <param name='bgcolor' value='#000000' /> <param name='allowfullscreen' value='true' /> <param name='flashvars' value= '"
+
...
...
@@ -440,23 +467,15 @@ a:active {
attributes
.
align
=
"middle"
;
swfobject
.
embedSWF
(
"swfs/StrobeMediaPlayback.swf"
,
"flashContent"
,
"640"
,
"377"
,
swfVersionStr
,
xiSwfUrlStr
,
soFlashVars
,
params
,
attributes
);
<!--
JavaScript
enabled
so
display
the
flashContent
div
in
case
it
is
not
replaced
with
a
swf
object
.
-->
swfobject
.
createCSS
(
"#flashContent"
,
"display:block;text-align:left;"
);
if
(
initload
==
true
){
swfobject
.
createCSS
(
"#flashContent"
,
"display:block;text-align:left;"
);
}
}
function
playStream
()
{
var
url
=
"source="
+
document
.
getElementById
(
'inputURL'
).
value
;
var
type
;
if
(
document
.
getElementById
(
'vodCheckbox'
).
checked
==
true
)
type
=
"vod"
;
else
type
=
"live"
;
url
+=
(
"&type="
+
type
);
document
.
getElementById
(
'playBtn'
).
href
=
"demo.html?"
+
url
;
queryParameters
[
'source'
]
=
document
.
getElementById
(
'inputURL'
).
value
;
initialise
();
}
function
checkbox
(
type
)
...
...
@@ -548,8 +567,8 @@ a:active {
JavaScript and Flash plug-in support is available. The div is initially hidden so that it doesn't show
when JavaScript is disabled.
-->
<div
id=
"flashContent"
>
<div
id=
"flashContentParent"
>
<div
id=
"flashContent"
>
<p>
To view this page ensure that Adobe Flash Player version 10.3.0 or greater is installed.
</p>
<script
type=
"text/javascript"
>
var
pageHost
=
((
document
.
location
.
protocol
==
"https:"
)
?
"https://"
:
"http://"
);
...
...
@@ -557,6 +576,7 @@ a:active {
+
pageHost
+
"www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' /></a>"
);
</script>
</div>
</div>
<noscript>
<a
href=
"http://www.adobe.com/go/getflashplayer/"
style=
"color:black"
><img
src=
"images/ERROR_getFlashPlayer.gif"
width=
"640"
height=
"377"
/></a>
...
...
scripts/swfobject.js
查看文件 @
13583e6
...
...
@@ -30,6 +30,7 @@ var swfobject = function() {
dynamicStylesheet
,
dynamicStylesheetMedia
,
autoHideShow
=
true
,
needRebuild
=
false
,
/* Centralized function for browser feature detection
- User agent string detection is only used when no good alternative is possible
...
...
@@ -137,6 +138,11 @@ var swfobject = function() {
}
function
addDomLoadEvent
(
fn
)
{
if
(
needRebuild
){
isDomLoaded
=
false
;
fn
();
return
;
}
if
(
isDomLoaded
)
{
fn
();
}
...
...
@@ -474,6 +480,7 @@ var swfobject = function() {
function
removeSWF
(
id
)
{
var
obj
=
getElementById
(
id
);
if
(
obj
&&
obj
.
nodeName
==
"OBJECT"
)
{
needRebuild
=
true
;
if
(
ua
.
ie
&&
ua
.
win
)
{
obj
.
style
.
display
=
"none"
;
(
function
(){
...
...
请
注册
或
登录
后发表评论