Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
胡斌
/
srs
转到一个项目
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
winlin
2015-08-20 16:11:17 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
fe87bf1b618807818cce4267628c8b5840b23ce4
fe87bf1b
1 parent
018af55d
support generate link page for rtmp url
显示空白字符变更
内嵌
并排对比
正在显示
2 个修改的文件
包含
81 行增加
和
1 行删除
trunk/research/players/js/winlin.utility.js
trunk/research/players/srs_player.html
trunk/research/players/js/winlin.utility.js
查看文件 @
fe87bf1
...
...
@@ -234,6 +234,15 @@ function parse_rtmp_url(rtmp_url) {
}
}
// when vhost equals to server, and server is ip,
// the vhost is __defaultVhost__
if
(
a
.
hostname
==
vhost
)
{
var
re
=
/^
(\d
+
)\.(\d
+
)\.(\d
+
)\.(\d
+
)
$/
;
if
(
re
.
test
(
a
.
hostname
))
{
vhost
=
"__defaultVhost__"
;
}
}
var
ret
=
{
server
:
a
.
hostname
,
port
:
port
,
vhost
:
vhost
,
app
:
app
,
stream
:
stream
...
...
trunk/research/players/srs_player.html
查看文件 @
fe87bf1
...
...
@@ -49,6 +49,60 @@
URL:
<input
type=
"text"
id=
"txt_url"
class=
"input-xxlarge"
value=
""
></input>
<button
class=
"btn btn-primary"
id=
"btn_play"
>
播放视频
</button>
<button
class=
"btn"
id=
"btn_generate_link"
>
生成链接
</button>
</div>
<div
id=
"link_modal"
class=
"modal hide fade"
>
<div
class=
"modal-header"
>
<button
type=
"button"
class=
"close"
data-dismiss=
"modal"
aria-hidden=
"true"
>
×
</button>
<h3><a
href=
"https://github.com/simple-rtmp-server/srs"
>
SRS Link Generator
</a></h3>
</div>
<div
class=
"modal-body"
>
<div
class=
"form-horizontal"
>
<div
class=
"control-group"
>
<label
class=
"control-label"
for=
"link_server"
>
服务器地址
</label>
<div
class=
"controls"
>
<span
id=
"link_server"
class=
"span4 uneditable-input"
></span>
</div>
</div>
<div
class=
"control-group"
>
<label
class=
"control-label"
for=
"link_port"
>
服务器端口
</label>
<div
class=
"controls"
>
<span
id=
"link_port"
class=
"span2 uneditable-input"
></span>
</div>
</div>
<div
class=
"control-group"
>
<label
class=
"control-label"
for=
"link_vhost"
>
RTMP Vhost
</label>
<div
class=
"controls"
>
<span
id=
"link_vhost"
class=
"span4 uneditable-input"
></span>
</div>
</div>
<div
class=
"control-group"
>
<label
class=
"control-label"
for=
"link_app"
>
RTMP App
</label>
<div
class=
"controls"
>
<span
id=
"link_app"
class=
"span4 uneditable-input"
></span>
</div>
</div>
<div
class=
"control-group"
>
<label
class=
"control-label"
for=
"link_stream"
>
RTMP Stream
</label>
<div
class=
"controls"
>
<span
id=
"link_stream"
class=
"span4 uneditable-input"
></span>
</div>
</div>
<div
class=
"control-group"
>
<label
class=
"control-label"
for=
"link_rtmp"
>
RTMP地址
</label>
<div
class=
"controls"
>
<span
id=
"link_rtmp"
class=
"span4 uneditable-input"
></span>
</div>
</div>
<div
class=
"control-group"
>
<label
class=
"control-label"
for=
"link_url"
>
播放链接地址
</label>
<div
class=
"controls"
>
<div
style=
"margin-top:5px;"
><a
href=
"#"
id=
"link_url"
>
请右键拷贝此链接地址.
</a></div>
</div>
</div>
</div>
</div>
<div
class=
"modal-footer"
></div>
</div>
<div
class=
"container"
>
<hr/>
...
...
@@ -337,6 +391,8 @@
}
$
(
function
(){
var
query
=
parse_query_string
();
// get the vhost and port to set the default url.
// for example: http://192.168.1.213/players/jwplayer6.html?port=1935&vhost=demo
// url set to: rtmp://demo:1935/live/livestream
...
...
@@ -408,6 +464,22 @@
}
});
$
(
"#btn_generate_link"
).
click
(
function
(){
var
rtmp
=
parse_rtmp_url
(
$
(
"#txt_url"
).
val
());
var
url
=
"http://"
+
query
.
host
+
query
.
pathname
+
"?"
+
"vhost="
+
rtmp
.
vhost
+
"&app="
+
rtmp
.
app
+
"&stream="
+
rtmp
.
stream
+
"&server="
+
rtmp
.
server
+
"&port="
+
rtmp
.
port
+
"&autostart=true"
;
$
(
"#link_server"
).
text
(
rtmp
.
server
);
$
(
"#link_port"
).
text
(
rtmp
.
port
);
$
(
"#link_vhost"
).
text
(
rtmp
.
vhost
);
$
(
"#link_app"
).
text
(
rtmp
.
app
);
$
(
"#link_stream"
).
text
(
rtmp
.
stream
);
$
(
"#link_rtmp"
).
text
(
$
(
"#txt_url"
).
val
());
$
(
"#link_url"
).
attr
(
"href"
,
url
);
$
(
"#link_modal"
).
modal
({
show
:
true
,
keyboard
:
false
});
});
$
(
"#btn_play"
).
click
(
function
(){
url
=
$
(
"#txt_url"
).
val
();
$
(
"#main_modal"
).
modal
({
show
:
true
,
keyboard
:
false
});
...
...
@@ -450,7 +522,6 @@
});
}
var
query
=
parse_query_string
();
var
jwplayer_url
=
"http://"
+
query
.
host
+
query
.
dir
+
"/jwplayer6.html?vhost=demo.srs.com&app=live&hls_autostart=true"
;
if
(
true
)
{
$
(
"#srs_publish_hls"
).
attr
(
"href"
,
jwplayer_url
+
"&stream=livestream"
);
...
...
请
注册
或
登录
后发表评论