diff --git a/trunk/research/players/js/srs.js b/trunk/research/players/js/srs.js index 6ea8814b9..8ac49c084 100755 --- a/trunk/research/players/js/srs.js +++ b/trunk/research/players/js/srs.js @@ -80,11 +80,19 @@ function build_default_hls_url() { } /** -* initialize the page. -* @param rtmp_url the rtmp stream url to play -* @param hls_url the hls stream url to play +* player specified size. */ -function srs_init(rtmp_url, hls_url) { +function srs_get_player_modal() { return 740; } +function srs_get_player_width() { return srs_get_player_modal() - 30; } +function srs_get_player_height() { return srs_get_player_width() * 9 / 19; } + +/** +* initialize the page. +* @param rtmp_url the div id contains the rtmp stream url to play +* @param hls_url the div id contains the hls stream url to play +* @param modal_player the div id contains the modal player +*/ +function srs_init(rtmp_url, hls_url, modal_player) { update_nav(); if (rtmp_url) { @@ -93,6 +101,10 @@ function srs_init(rtmp_url, hls_url) { if (hls_url) { $(hls_url).val(build_default_hls_url()); } + if (modal_player) { + $(modal_player).width(srs_get_player_modal() + "px"); + $(modal_player).css("margin-left", "-" + srs_get_player_modal() / 2 +"px"); + } } ////////////////////////////////////////////////////////////////////////////////// diff --git a/trunk/research/players/jwplayer6.html b/trunk/research/players/jwplayer6.html index bf4609ca7..6f057e4de 100755 --- a/trunk/research/players/jwplayer6.html +++ b/trunk/research/players/jwplayer6.html @@ -11,6 +11,10 @@ body{ padding-top: 55px; } + #main_modal { + width: 700px; + margin-left: -350px; + } @@ -21,7 +25,7 @@ // 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 - srs_init("#txt_rtmp_url", "#txt_hls_url"); + srs_init("#txt_rtmp_url", "#txt_hls_url", "#main_modal"); $("#main_modal").on("hide", function(){ $("#div_container").remove(); @@ -42,8 +46,8 @@ var conf = { file: _url, - width: "530", - height: "300", + width: srs_get_player_width(), + height: srs_get_player_height(), autostart: true, analytics: { enabled: false} }; diff --git a/trunk/research/players/osmf.html b/trunk/research/players/osmf.html index f69bcf393..1cbccd26b 100755 --- a/trunk/research/players/osmf.html +++ b/trunk/research/players/osmf.html @@ -12,6 +12,10 @@ body{ padding-top: 55px; } + #main_modal { + width: 700px; + margin-left: -350px; + }