From ff4b28f4d407cf5241e8c0b7efb366a07a6966e1 Mon Sep 17 00:00:00 2001 From: winlin Date: Wed, 18 Dec 2013 13:44:18 +0800 Subject: [PATCH] extract the srs.js --- trunk/auto/depends.sh | 3 +- trunk/research/players/index.html | 18 ++++++---- trunk/research/players/js/srs.js | 40 +++++++++++++++++++++++ trunk/research/players/jwplayer6.html | 18 ++++++---- trunk/research/players/osmf.html | 18 ++++++---- trunk/research/players/srs_bwt.html | 14 ++++---- trunk/research/players/srs_player.html | 14 ++++---- trunk/research/players/srs_publisher.html | 14 ++++---- trunk/research/players/vlc.html | 20 +++++++----- 9 files changed, 111 insertions(+), 48 deletions(-) create mode 100755 trunk/research/players/js/srs.js diff --git a/trunk/auto/depends.sh b/trunk/auto/depends.sh index 31541ad12..a866c05bd 100755 --- a/trunk/auto/depends.sh +++ b/trunk/auto/depends.sh @@ -254,7 +254,8 @@ if [ $SRS_HLS = YES ]; then html_file=${SRS_OBJS}/nginx/html/forward/live/livestream_sd.html && hls_stream=livestream_sd.m3u8 && write_nginx_html5 # copy players to nginx html dir. - cp research/players ${SRS_OBJS}/nginx/html/ -r + rm -rf ${SRS_OBJS}/nginx/html/players && + ln -sf `pwd`/research/players ${SRS_OBJS}/nginx/html/ fi if [ $SRS_HLS = YES ]; then diff --git a/trunk/research/players/index.html b/trunk/research/players/index.html index 7ff349bcb..a9c235cdc 100755 --- a/trunk/research/players/index.html +++ b/trunk/research/players/index.html @@ -7,11 +7,17 @@ + + diff --git a/trunk/research/players/js/srs.js b/trunk/research/players/js/srs.js new file mode 100755 index 000000000..5d9442879 --- /dev/null +++ b/trunk/research/players/js/srs.js @@ -0,0 +1,40 @@ +function update_nav() { + $("#nav_srs_player").attr("href", "srs_player.html" + window.location.search); + $("#nav_srs_publisher").attr("href", "srs_publisher.html" + window.location.search); + $("#nav_srs_bwt").attr("href", "srs_bwt.html" + window.location.search); + $("#nav_jwplayer6").attr("href", "jwplayer6.html" + window.location.search); + $("#nav_osmf").attr("href", "osmf.html" + window.location.search); + $("#nav_vlc").attr("href", "vlc.html" + window.location.search); +} + +function parse_query_string(){ + var query_string = String(window.location.search).replace(" ", "").split("?")[1]; + if(query_string == undefined){ + return {}; + } + + var queries = query_string.split("&"); + var obj = {}; + $(queries).each(function(){ + var query = this.split("="); + obj[query[0]] = query[1]; + }); + + return obj; +} + +function build_default_url() { + var query = parse_query_string(); + var port = (query.port == undefined)? 1935:query.port; + var vhost = (query.vhost == undefined)? window.location.hostname:query.vhost; + + return "rtmp://"+vhost+":"+port+"/live/livestream"; +} + +function srs_init(url_obj) { + update_nav(); + + if (url_obj) { + $(url_obj).val(build_default_url()); + } +} diff --git a/trunk/research/players/jwplayer6.html b/trunk/research/players/jwplayer6.html index b0811fc91..a8de4c029 100755 --- a/trunk/research/players/jwplayer6.html +++ b/trunk/research/players/jwplayer6.html @@ -6,6 +6,7 @@ + + @@ -24,12 +26,12 @@ SrsPlayers diff --git a/trunk/research/players/srs_player.html b/trunk/research/players/srs_player.html index a077c3947..877c86e18 100755 --- a/trunk/research/players/srs_player.html +++ b/trunk/research/players/srs_player.html @@ -7,6 +7,7 @@ + @@ -24,12 +26,12 @@ SrsPlayers diff --git a/trunk/research/players/srs_publisher.html b/trunk/research/players/srs_publisher.html index 425e0ea04..f5f0400cd 100755 --- a/trunk/research/players/srs_publisher.html +++ b/trunk/research/players/srs_publisher.html @@ -7,6 +7,7 @@ + @@ -24,12 +26,12 @@ SrsPlayers diff --git a/trunk/research/players/vlc.html b/trunk/research/players/vlc.html index 4a2be4083..997bc1d86 100755 --- a/trunk/research/players/vlc.html +++ b/trunk/research/players/vlc.html @@ -7,6 +7,7 @@ + @@ -25,19 +27,19 @@ SrsPlayers -
- -
+ +
+