diff --git a/trunk/research/players/js/winlin.utility.js b/trunk/research/players/js/winlin.utility.js
index 70a16be7f..8cc498e0b 100644
--- a/trunk/research/players/js/winlin.utility.js
+++ b/trunk/research/players/js/winlin.utility.js
@@ -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
diff --git a/trunk/research/players/srs_player.html b/trunk/research/players/srs_player.html
index 7bd381f54..7295886ff 100755
--- a/trunk/research/players/srs_player.html
+++ b/trunk/research/players/srs_player.html
@@ -49,6 +49,60 @@
URL:
+
+
+
@@ -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");