Merge pull request #483 from CallMeNP/patch-1
为research/players/srs_player 考虑静态资源部署到单独域名的情况
正在显示
2 个修改的文件
包含
24 行增加
和
2 行删除
@@ -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) { |
@@ -79,6 +79,8 @@ package | @@ -79,6 +79,8 @@ package | ||
79 | 79 | ||
80 | this.stage.addEventListener(FullScreenEvent.FULL_SCREEN, this.user_on_stage_fullscreen); | 80 | this.stage.addEventListener(FullScreenEvent.FULL_SCREEN, this.user_on_stage_fullscreen); |
81 | 81 | ||
82 | + Security.allowDomain("*"); | ||
83 | + | ||
82 | this.addChild(this.control_fs_mask); | 84 | this.addChild(this.control_fs_mask); |
83 | this.control_fs_mask.buttonMode = true; | 85 | this.control_fs_mask.buttonMode = true; |
84 | this.control_fs_mask.addEventListener(MouseEvent.CLICK, user_on_click_video); | 86 | this.control_fs_mask.addEventListener(MouseEvent.CLICK, user_on_click_video); |
@@ -591,4 +593,4 @@ package | @@ -591,4 +593,4 @@ package | ||
591 | ExternalInterface.call("console.log", msg); | 593 | ExternalInterface.call("console.log", msg); |
592 | } | 594 | } |
593 | } | 595 | } |
594 | -} | ||
596 | +} |
-
请 注册 或 登录 后发表评论