mirror of
https://github.com/ossrs/srs.git
synced 2025-02-13 03:41:55 +00:00
function set_srs_player_url(url, params)
在实际环境中,player.swf 等静态资源 和页面可能部署到不同的域名或路径下。 所以在此处提供设置 srs_player.swf 的url的方法。
This commit is contained in:
parent
2c21f74efb
commit
c548ab5019
1 changed files with 21 additions and 1 deletions
|
@ -25,6 +25,7 @@ function SrsPlayer(container, width, height, private_object) {
|
|||
this.buffer_time = 0.3; // default to 0.3
|
||||
this.volume = 1.0; // default to 100%
|
||||
this.callbackObj = null;
|
||||
this.srs_player_url = "srs_player/release/srs_player.swf?_version="+srs_get_version_code();
|
||||
|
||||
// callback set the following values.
|
||||
this.meatadata = {}; // for on_player_metadata
|
||||
|
@ -88,7 +89,7 @@ SrsPlayer.prototype.start = function(url) {
|
|||
var self = this;
|
||||
|
||||
swfobject.embedSWF(
|
||||
"srs_player/release/srs_player.swf?_version="+srs_get_version_code(),
|
||||
this.srs_player_url,
|
||||
this.container,
|
||||
this.width, this.height,
|
||||
"11.1.0", "js/AdobeFlashPlayerInstall.swf",
|
||||
|
@ -183,6 +184,25 @@ SrsPlayer.prototype.set_bt = function(buffer_time) {
|
|||
this.buffer_time = buffer_time;
|
||||
this.callbackObj.ref.__set_bt(buffer_time);
|
||||
}
|
||||
/**
|
||||
* set the srs_player.swf url
|
||||
* @param url, srs_player.swf's url.
|
||||
* @param params, object.
|
||||
*/
|
||||
SrsPlayer.prototype.set_srs_player_url = function(url, params) {
|
||||
var query_array = [],
|
||||
query_string = "",
|
||||
p;
|
||||
params = params || {};
|
||||
params._version = srs_get_version_code();
|
||||
for (p in params) {
|
||||
if (params.hasOwnProperty(p)) {
|
||||
query_array.push(p + "=" + encodeURIComponent(params[p]));
|
||||
}
|
||||
}
|
||||
query_string = query_array.join("&");
|
||||
this.srs_player_url = url + "?" + query_string;
|
||||
}
|
||||
SrsPlayer.prototype.on_player_ready = function() {
|
||||
}
|
||||
SrsPlayer.prototype.on_player_metadata = function(metadata) {
|
||||
|
|
Loading…
Reference in a new issue