没——问题

function set_srs_player_url(url, params)

在实际环境中,player.swf 等静态资源 和页面可能部署到不同的域名或路径下。

所以在此处提供设置 srs_player.swf 的url的方法。
@@ -25,6 +25,7 @@ function SrsPlayer(container, width, height, private_object) { @@ -25,6 +25,7 @@ function SrsPlayer(container, width, height, private_object) {
25 this.buffer_time = 0.3; // default to 0.3 25 this.buffer_time = 0.3; // default to 0.3
26 this.volume = 1.0; // default to 100% 26 this.volume = 1.0; // default to 100%
27 this.callbackObj = null; 27 this.callbackObj = null;
  28 + this.srs_player_url = "srs_player/release/srs_player.swf?_version="+srs_get_version_code();
28 29
29 // callback set the following values. 30 // callback set the following values.
30 this.meatadata = {}; // for on_player_metadata 31 this.meatadata = {}; // for on_player_metadata
@@ -88,7 +89,7 @@ SrsPlayer.prototype.start = function(url) { @@ -88,7 +89,7 @@ SrsPlayer.prototype.start = function(url) {
88 var self = this; 89 var self = this;
89 90
90 swfobject.embedSWF( 91 swfobject.embedSWF(
91 - "srs_player/release/srs_player.swf?_version="+srs_get_version_code(), 92 + this.srs_player_url,
92 this.container, 93 this.container,
93 this.width, this.height, 94 this.width, this.height,
94 "11.1.0", "js/AdobeFlashPlayerInstall.swf", 95 "11.1.0", "js/AdobeFlashPlayerInstall.swf",
@@ -183,6 +184,25 @@ SrsPlayer.prototype.set_bt = function(buffer_time) { @@ -183,6 +184,25 @@ SrsPlayer.prototype.set_bt = function(buffer_time) {
183 this.buffer_time = buffer_time; 184 this.buffer_time = buffer_time;
184 this.callbackObj.ref.__set_bt(buffer_time); 185 this.callbackObj.ref.__set_bt(buffer_time);
185 } 186 }
  187 +/**
  188 + * set the srs_player.swf url
  189 + * @param url, srs_player.swf's url.
  190 + * @param params, object.
  191 + */
  192 + SrsPlayer.prototype.set_srs_player_url = function(url, params) {
  193 + var query_array = [],
  194 + query_string = "",
  195 + p;
  196 + params = params || {};
  197 + params._version = srs_get_version_code();
  198 + for (p in params) {
  199 + if (params.hasOwnProperty(p)) {
  200 + query_array.push(p + "=" + encodeURIComponent(params[p]));
  201 + }
  202 + }
  203 + query_string = query_array.join("&");
  204 + this.srs_player_url = url + "?" + query_string;
  205 +}
186 SrsPlayer.prototype.on_player_ready = function() { 206 SrsPlayer.prototype.on_player_ready = function() {
187 } 207 }
188 SrsPlayer.prototype.on_player_metadata = function(metadata) { 208 SrsPlayer.prototype.on_player_metadata = function(metadata) {