winlin

refine js, move the consts to the head of srs.js

1 ////////////////////////////////////////////////////////////////////////////////// 1 //////////////////////////////////////////////////////////////////////////////////
2 ////////////////////////////////////////////////////////////////////////////////// 2 //////////////////////////////////////////////////////////////////////////////////
3 ////////////////////////////////////////////////////////////////////////////////// 3 //////////////////////////////////////////////////////////////////////////////////
  4 +
  5 +/**
  6 +* player specified size.
  7 +*/
  8 +function srs_get_player_modal() { return 740; }
  9 +function srs_get_player_width() { return srs_get_player_modal() - 30; }
  10 +function srs_get_player_height() { return srs_get_player_width() * 9 / 19; }
  11 +
  12 +// to query the swf anti cache.
  13 +function srs_get_version_code() { return "1.9"; }
  14 +// get the default vhost for players.
  15 +function srs_get_player_vhost() { return "players"; }
  16 +// the api server port, for chat room.
  17 +function srs_get_api_server_port() { return 8085; }
  18 +// get the stream published to vhost,
  19 +// generally we need to transcode the stream to support HLS and filters.
  20 +// for example, src_vhost is "players", we transcode stream to vhost "players_pub".
  21 +// if not equals to the player vhost, return the orignal vhost.
  22 +function srs_get_player_publish_vhost(src_vhost) { return (src_vhost != srs_get_player_vhost())? src_vhost:(src_vhost + "_pub"); }
  23 +// for chat, use rtmp only vhost, low latecy, without gop cache.
  24 +function srs_get_player_chat_vhost(src_vhost) { return (src_vhost != srs_get_player_vhost())? src_vhost:(src_vhost + "_pub_rtmp"); }
  25 +
  26 +//////////////////////////////////////////////////////////////////////////////////
  27 +//////////////////////////////////////////////////////////////////////////////////
  28 +//////////////////////////////////////////////////////////////////////////////////
4 /** 29 /**
5 * padding the output. 30 * padding the output.
6 * padding(3, 5, '0') is 00003 31 * padding(3, 5, '0') is 00003
@@ -194,27 +219,6 @@ function srs_parse_rtmp_url(rtmp_url) { @@ -194,27 +219,6 @@ function srs_parse_rtmp_url(rtmp_url) {
194 } 219 }
195 220
196 /** 221 /**
197 -* player specified size.  
198 -*/  
199 -function srs_get_player_modal() { return 740; }  
200 -function srs_get_player_width() { return srs_get_player_modal() - 30; }  
201 -function srs_get_player_height() { return srs_get_player_width() * 9 / 19; }  
202 -  
203 -// to query the swf anti cache.  
204 -function srs_get_version_code() { return "1.7"; }  
205 -// get the default vhost for players.  
206 -function srs_get_player_vhost() { return "players"; }  
207 -// the api server port, for chat room.  
208 -function srs_get_api_server_port() { return 8085; }  
209 -// get the stream published to vhost,  
210 -// generally we need to transcode the stream to support HLS and filters.  
211 -// for example, src_vhost is "players", we transcode stream to vhost "players_pub".  
212 -// if not equals to the player vhost, return the orignal vhost.  
213 -function srs_get_player_publish_vhost(src_vhost) { return (src_vhost != srs_get_player_vhost())? src_vhost:(src_vhost + "_pub"); }  
214 -// for chat, use rtmp only vhost, low latecy, without gop cache.  
215 -function srs_get_player_chat_vhost(src_vhost) { return (src_vhost != srs_get_player_vhost())? src_vhost:(src_vhost + "_pub_rtmp"); }  
216 -  
217 -/**  
218 * initialize the page. 222 * initialize the page.
219 * @param rtmp_url the div id contains the rtmp stream url to play 223 * @param rtmp_url the div id contains the rtmp stream url to play
220 * @param hls_url the div id contains the hls stream url to play 224 * @param hls_url the div id contains the hls stream url to play