正在显示
6 个修改的文件
包含
24 行增加
和
9 行删除
@@ -78,6 +78,9 @@ SrsPlayer.prototype.start = function(url) { | @@ -78,6 +78,9 @@ SrsPlayer.prototype.start = function(url) { | ||
78 | * @param volume the volume, 0 is mute, 1 is 100%, 2 is 200%. | 78 | * @param volume the volume, 0 is mute, 1 is 100%, 2 is 200%. |
79 | */ | 79 | */ |
80 | SrsPlayer.prototype.play = function(url, volume) { | 80 | SrsPlayer.prototype.play = function(url, volume) { |
81 | + this.stop(); | ||
82 | + SrsPlayer.__players.push(this); | ||
83 | + | ||
81 | if (url) { | 84 | if (url) { |
82 | this.stream_url = url; | 85 | this.stream_url = url; |
83 | } | 86 | } |
@@ -118,8 +121,8 @@ SrsPlayer.prototype.resume = function() { | @@ -118,8 +121,8 @@ SrsPlayer.prototype.resume = function() { | ||
118 | * use metadata width if 0. | 121 | * use metadata width if 0. |
119 | * use user specified width if -1. | 122 | * use user specified width if -1. |
120 | */ | 123 | */ |
121 | -SrsPlayer.prototype.dar = function(num, den) { | ||
122 | - this.callbackObj.ref.__dar(num, den); | 124 | +SrsPlayer.prototype.set_dar = function(num, den) { |
125 | + this.callbackObj.ref.__set_dar(num, den); | ||
123 | } | 126 | } |
124 | /** | 127 | /** |
125 | * set the fullscreen size data. | 128 | * set the fullscreen size data. |
@@ -78,8 +78,11 @@ | @@ -78,8 +78,11 @@ | ||
78 | realtime_player = new SrsPlayer("realtime_player", 430, 185); | 78 | realtime_player = new SrsPlayer("realtime_player", 430, 185); |
79 | realtime_player.on_player_ready = function() { | 79 | realtime_player.on_player_ready = function() { |
80 | this.set_bt(0.5); | 80 | this.set_bt(0.5); |
81 | - this.set_fs("screen", 100); | ||
82 | }; | 81 | }; |
82 | + realtime_player.on_player_metadata = function(metadata) { | ||
83 | + this.set_dar(0, 0); | ||
84 | + this.set_fs("screen", 100); | ||
85 | + } | ||
83 | realtime_player.start(); | 86 | realtime_player.start(); |
84 | } | 87 | } |
85 | 88 | ||
@@ -230,8 +233,11 @@ | @@ -230,8 +233,11 @@ | ||
230 | var _player = new SrsPlayer("rp_raw_" + chat.id, 600, 300, chat); | 233 | var _player = new SrsPlayer("rp_raw_" + chat.id, 600, 300, chat); |
231 | _player.on_player_ready = function() { | 234 | _player.on_player_ready = function() { |
232 | this.set_bt(0.5); | 235 | this.set_bt(0.5); |
233 | - this.set_fs("screen", 100); | ||
234 | }; | 236 | }; |
237 | + _player.on_player_metadata = function(metadata) { | ||
238 | + this.set_dar(0, 0); | ||
239 | + this.set_fs("screen", 100); | ||
240 | + } | ||
235 | _player.start(chat.url); | 241 | _player.start(chat.url); |
236 | 242 | ||
237 | chat.player = _player; | 243 | chat.player = _player; |
@@ -34,7 +34,7 @@ | @@ -34,7 +34,7 @@ | ||
34 | 34 | ||
35 | var __active_dar = null; | 35 | var __active_dar = null; |
36 | function select_dar(dar_id, num, den) { | 36 | function select_dar(dar_id, num, den) { |
37 | - srs_player.dar(num, den); | 37 | + srs_player.set_dar(num, den); |
38 | 38 | ||
39 | if (__active_dar) { | 39 | if (__active_dar) { |
40 | __active_dar.removeClass("active"); | 40 | __active_dar.removeClass("active"); |
@@ -115,7 +115,7 @@ package | @@ -115,7 +115,7 @@ package | ||
115 | flash.external.ExternalInterface.addCallback("__stop", this.js_call_stop); | 115 | flash.external.ExternalInterface.addCallback("__stop", this.js_call_stop); |
116 | flash.external.ExternalInterface.addCallback("__pause", this.js_call_pause); | 116 | flash.external.ExternalInterface.addCallback("__pause", this.js_call_pause); |
117 | flash.external.ExternalInterface.addCallback("__resume", this.js_call_resume); | 117 | flash.external.ExternalInterface.addCallback("__resume", this.js_call_resume); |
118 | - flash.external.ExternalInterface.addCallback("__dar", this.js_call_dar); | 118 | + flash.external.ExternalInterface.addCallback("__set_dar", this.js_call_set_dar); |
119 | flash.external.ExternalInterface.addCallback("__set_fs", this.js_call_set_fs_size); | 119 | flash.external.ExternalInterface.addCallback("__set_fs", this.js_call_set_fs_size); |
120 | flash.external.ExternalInterface.addCallback("__set_bt", this.js_call_set_bt); | 120 | flash.external.ExternalInterface.addCallback("__set_bt", this.js_call_set_bt); |
121 | 121 | ||
@@ -229,7 +229,7 @@ package | @@ -229,7 +229,7 @@ package | ||
229 | * use metadata width if 0. | 229 | * use metadata width if 0. |
230 | * use user specified width if -1. | 230 | * use user specified width if -1. |
231 | */ | 231 | */ |
232 | - private function js_call_dar(num:int, den:int):void { | 232 | + private function js_call_set_dar(num:int, den:int):void { |
233 | user_dar_num = num; | 233 | user_dar_num = num; |
234 | user_dar_den = den; | 234 | user_dar_den = den; |
235 | 235 |
@@ -80,16 +80,22 @@ | @@ -80,16 +80,22 @@ | ||
80 | remote_player = new SrsPlayer("remote_player", 430, 185); | 80 | remote_player = new SrsPlayer("remote_player", 430, 185); |
81 | remote_player.on_player_ready = function() { | 81 | remote_player.on_player_ready = function() { |
82 | this.set_bt(0.8); | 82 | this.set_bt(0.8); |
83 | - this.set_fs("screen", 100); | ||
84 | }; | 83 | }; |
84 | + remote_player.on_player_metadata = function(metadata) { | ||
85 | + this.set_dar(0, 0); | ||
86 | + this.set_fs("screen", 100); | ||
87 | + } | ||
85 | remote_player.start(); | 88 | remote_player.start(); |
86 | 89 | ||
87 | // start the realtime player. | 90 | // start the realtime player. |
88 | realtime_player = new SrsPlayer("realtime_player", 430, 185); | 91 | realtime_player = new SrsPlayer("realtime_player", 430, 185); |
89 | realtime_player.on_player_ready = function() { | 92 | realtime_player.on_player_ready = function() { |
90 | this.set_bt(0.8); | 93 | this.set_bt(0.8); |
91 | - this.set_fs("screen", 100); | ||
92 | }; | 94 | }; |
95 | + realtime_player.on_player_metadata = function(metadata) { | ||
96 | + this.set_dar(0, 0); | ||
97 | + this.set_fs("screen", 100); | ||
98 | + } | ||
93 | realtime_player.start(); | 99 | realtime_player.start(); |
94 | } | 100 | } |
95 | }); | 101 | }); |
-
请 注册 或 登录 后发表评论